- Fixed TC 41, TC 42, TC 43, TC 44, TC 45
- TC 40 fixed. Handled no internet - TC 19 fixed. Now if the count it 0 it will hide the badge - Added error handling to shop - Fixed issue while switching themes. Now doing it on main thread with completion handler
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4469E533EC95AC428FE50FB2 /* Pods_WOKA.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B045136DB6D1DB0D38BD128 /* Pods_WOKA.framework */; };
|
||||
5201D4292C7F22E7008E3211 /* NetworkMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5201D4282C7F22E7008E3211 /* NetworkMonitor.swift */; };
|
||||
5202AAFE2BDF90590043B7BD /* TextFieldImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5202AAFD2BDF90590043B7BD /* TextFieldImage.swift */; };
|
||||
5202AB012BDFA7900043B7BD /* EmailValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5202AB002BDFA7900043B7BD /* EmailValidation.swift */; };
|
||||
520346962C64E29A00D0BD20 /* MyListViewAllCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 520346952C64E29A00D0BD20 /* MyListViewAllCell.xib */; };
|
||||
@@ -399,6 +400,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
2081C2B186A876137E7DBDF2 /* Pods-WOKA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WOKA.release.xcconfig"; path = "Target Support Files/Pods-WOKA/Pods-WOKA.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3B045136DB6D1DB0D38BD128 /* Pods_WOKA.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WOKA.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5201D4282C7F22E7008E3211 /* NetworkMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkMonitor.swift; sourceTree = "<group>"; };
|
||||
5202AAFD2BDF90590043B7BD /* TextFieldImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldImage.swift; sourceTree = "<group>"; };
|
||||
5202AB002BDFA7900043B7BD /* EmailValidation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailValidation.swift; sourceTree = "<group>"; };
|
||||
520346942C64E29A00D0BD20 /* MyListViewAllCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListViewAllCell.swift; sourceTree = "<group>"; };
|
||||
@@ -809,6 +811,14 @@
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5201D4272C7F22DD008E3211 /* Network */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5201D4282C7F22E7008E3211 /* NetworkMonitor.swift */,
|
||||
);
|
||||
path = Network;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5202AAFF2BDFA7860043B7BD /* Validations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1467,6 +1477,7 @@
|
||||
52C8B0512BDA4B51003B51D0 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5201D4272C7F22DD008E3211 /* Network */,
|
||||
9CDAEB0F2C53F12800890C47 /* Shadows */,
|
||||
9C834EDA2C1C26C000B29A9C /* HTML */,
|
||||
527AC6FF2C182D1700434FB7 /* Timer */,
|
||||
@@ -2471,6 +2482,7 @@
|
||||
528E5F222C24660F00E33E4E /* SeasonCategoryCell.swift in Sources */,
|
||||
525954272BE9178F00191286 /* UserDataDM.swift in Sources */,
|
||||
52A6DCB62C4E748100F63C51 /* ShopSubCategoryDM.swift in Sources */,
|
||||
5201D4292C7F22E7008E3211 /* NetworkMonitor.swift in Sources */,
|
||||
52BBFCB92C52782600F7D0D1 /* AddressCell.swift in Sources */,
|
||||
9C27E1652BDB6FBC00EC1DA9 /* StoryBoardID.swift in Sources */,
|
||||
520346972C64E29A00D0BD20 /* MyListViewAllCell.swift in Sources */,
|
||||
|
||||
@@ -1382,17 +1382,17 @@ Sent to Your Parent’s Email</string>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BackgroundSplash" translatesAutoresizingMaskIntoConstraints="NO" id="kVU-tZ-Qxe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="428" height="932"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="430" height="932"/>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="WokaLogo" translatesAutoresizingMaskIntoConstraints="NO" id="Ux8-r9-rZb">
|
||||
<rect key="frame" x="144" y="50" width="140" height="52.666666666666657"/>
|
||||
<rect key="frame" x="145" y="50" width="140" height="52.666666666666657"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="Ux8-r9-rZb" secondAttribute="height" multiplier="8:3" id="3Bo-85-Opy"/>
|
||||
<constraint firstAttribute="width" constant="140" id="abR-fA-jTS"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="60" translatesAutoresizingMaskIntoConstraints="NO" id="OXs-y6-ZlP">
|
||||
<rect key="frame" x="34" y="132.66666666666669" width="374" height="675.33333333333326"/>
|
||||
<rect key="frame" x="36" y="132.66666666666669" width="374" height="675.33333333333326"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your Email Looks Familiar!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wlw-Ne-TMy" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="10" y="0.0" width="354" height="29"/>
|
||||
@@ -1420,10 +1420,10 @@ Sent to Your Parent’s Email</string>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="35" translatesAutoresizingMaskIntoConstraints="NO" id="xXI-1K-L56">
|
||||
<rect key="frame" x="30" y="828" width="368" height="50"/>
|
||||
<rect key="frame" x="30" y="828" width="370" height="50"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sli-1N-tGE" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="368" height="50"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="370" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="jaN-n0-fQU"/>
|
||||
</constraints>
|
||||
@@ -1496,17 +1496,17 @@ Sent to Your Parent’s Email</string>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BackgroundSplash" translatesAutoresizingMaskIntoConstraints="NO" id="XCD-Eq-dfg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="428" height="932"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="430" height="932"/>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="WokaLogo" translatesAutoresizingMaskIntoConstraints="NO" id="hPv-w5-A5k">
|
||||
<rect key="frame" x="144" y="50" width="140" height="52.666666666666657"/>
|
||||
<rect key="frame" x="145" y="50" width="140" height="52.666666666666657"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="hPv-w5-A5k" secondAttribute="height" multiplier="8:3" id="3G1-6h-fef"/>
|
||||
<constraint firstAttribute="width" constant="140" id="Tgm-h7-QiJ"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="60" translatesAutoresizingMaskIntoConstraints="NO" id="b6i-JR-2Em">
|
||||
<rect key="frame" x="34" y="132.66666666666669" width="374" height="675.33333333333326"/>
|
||||
<rect key="frame" x="36" y="132.66666666666669" width="374" height="675.33333333333326"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username Found" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sbg-9k-ezS" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="10" y="0.0" width="354" height="29"/>
|
||||
@@ -1534,10 +1534,10 @@ Sent to Your Parent’s Email</string>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="35" translatesAutoresizingMaskIntoConstraints="NO" id="KTf-VW-iuU">
|
||||
<rect key="frame" x="30" y="828" width="368" height="50"/>
|
||||
<rect key="frame" x="30" y="828" width="370" height="50"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pa7-nj-fa0" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="368" height="50"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="370" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="t2D-jB-n8u"/>
|
||||
</constraints>
|
||||
@@ -1709,43 +1709,43 @@ Sent to Your Parent’s Email</string>
|
||||
<size key="intrinsicContentSize" width="6.666666666666667" height="22.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="4gw-z0-s4a">
|
||||
<size key="intrinsicContentSize" width="198" height="19"/>
|
||||
<size key="intrinsicContentSize" width="148" height="19"/>
|
||||
</designable>
|
||||
<designable name="68c-1b-KSI">
|
||||
<size key="intrinsicContentSize" width="199" height="20.333333333333332"/>
|
||||
<size key="intrinsicContentSize" width="149" height="20.333333333333332"/>
|
||||
</designable>
|
||||
<designable name="81S-Fa-CiD">
|
||||
<size key="intrinsicContentSize" width="6.666666666666667" height="22.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="DSB-Ge-wNO">
|
||||
<size key="intrinsicContentSize" width="166" height="20.666666666666668"/>
|
||||
<size key="intrinsicContentSize" width="116" height="20.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="Hcd-Mm-IxW">
|
||||
<size key="intrinsicContentSize" width="6.666666666666667" height="22.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="JRR-Bk-5UP">
|
||||
<size key="intrinsicContentSize" width="214.33333333333334" height="19"/>
|
||||
<size key="intrinsicContentSize" width="164.33333333333334" height="19"/>
|
||||
</designable>
|
||||
<designable name="MpT-bm-drv">
|
||||
<size key="intrinsicContentSize" width="6.666666666666667" height="22.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="Skx-Ig-91N">
|
||||
<size key="intrinsicContentSize" width="196.33333333333334" height="19"/>
|
||||
<size key="intrinsicContentSize" width="146.33333333333334" height="19"/>
|
||||
</designable>
|
||||
<designable name="aPP-h8-int">
|
||||
<size key="intrinsicContentSize" width="215.66666666666666" height="20.666666666666668"/>
|
||||
<size key="intrinsicContentSize" width="165.66666666666666" height="20.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="iJE-dm-qal">
|
||||
<size key="intrinsicContentSize" width="198" height="19"/>
|
||||
<size key="intrinsicContentSize" width="148" height="19"/>
|
||||
</designable>
|
||||
<designable name="m50-FZ-yVO">
|
||||
<size key="intrinsicContentSize" width="199" height="20.666666666666668"/>
|
||||
<size key="intrinsicContentSize" width="149" height="20.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="tgW-LH-XfR">
|
||||
<size key="intrinsicContentSize" width="168" height="20.666666666666668"/>
|
||||
<size key="intrinsicContentSize" width="117.66666666666667" height="20.666666666666668"/>
|
||||
</designable>
|
||||
<designable name="wy2-0C-rxG">
|
||||
<size key="intrinsicContentSize" width="199" height="20.666666666666668"/>
|
||||
<size key="intrinsicContentSize" width="149" height="20.666666666666668"/>
|
||||
</designable>
|
||||
</designables>
|
||||
<resources>
|
||||
|
||||
@@ -67,6 +67,7 @@ class EmailVC: UIViewController {
|
||||
if vm.forgetUsername != nil{
|
||||
if userType.text == ""{
|
||||
self.toast(msg: K.ConstantString.userType, time: 1.5)
|
||||
return
|
||||
}
|
||||
Utilities.startProgressHUD()
|
||||
vm.getUserName()
|
||||
|
||||
@@ -30,7 +30,6 @@ class LoginVC: UIViewController {
|
||||
}
|
||||
|
||||
@IBAction func loginBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
vm.hideErrors()
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
guard let userName = userNameTF.text?.trimmingCharacters(in: .whitespaces) , let pass = passwordTF.text?.trimmingCharacters(in: .whitespaces) else{return}
|
||||
|
||||
@@ -38,14 +37,24 @@ class LoginVC: UIViewController {
|
||||
Check for userName
|
||||
*/
|
||||
if userName.count == 0{
|
||||
userNameTF.rightView?.isHidden = false
|
||||
userNameTF.setError(K.ConstantString.enterUserName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), show: true)
|
||||
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
|
||||
vcPush.contentLabel = K.ConstantString.enterUserName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.mainTitleText = "Password".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
if userName.count < 2{
|
||||
userNameTF.rightView?.isHidden = false
|
||||
userNameTF.setError("Username is too short.".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), show: true)
|
||||
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
|
||||
vcPush.contentLabel = "Username is too short.".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.mainTitleText = "Password".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -84,20 +93,17 @@ class LoginVC: UIViewController {
|
||||
|
||||
@IBAction func createAccountBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
vm.hideErrors()
|
||||
let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil)
|
||||
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.selectAgeVC) as! SelectAgeVC
|
||||
self.navigationController?.pushViewController(vc, animated: true)
|
||||
}
|
||||
|
||||
@IBAction func continueGuestBtnTapped(_ sender: UIButton) {
|
||||
vm.hideErrors()
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
vm.guestLogin()
|
||||
}
|
||||
|
||||
@IBAction func forgotPasswordBtnTapped(_ sender: UIButton) {
|
||||
vm.hideErrors()
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
|
||||
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.resetPassUserNameVC) as! ResetPassUserNameVC
|
||||
@@ -105,7 +111,6 @@ class LoginVC: UIViewController {
|
||||
}
|
||||
|
||||
@IBAction func forgotUsername(_ sender: LocalisedElementsButton) {
|
||||
vm.hideErrors()
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil)
|
||||
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.emailVC) as! EmailVC
|
||||
@@ -123,19 +128,6 @@ extension LoginVC : UITextFieldDelegate{
|
||||
switch textField{
|
||||
// username - 2,16 , password - 6,16
|
||||
case userNameTF:
|
||||
if let rightView = textField.rightView {
|
||||
// Hide the right view
|
||||
rightView.isHidden = true
|
||||
|
||||
// Check if the right view is hidden
|
||||
if rightView.isHidden {
|
||||
// If hidden, hide the associated error view
|
||||
if let errorView = errorViews.object(forKey: userNameTF) {
|
||||
errorView.isHidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !string.numberAndCharacterAndSpecialChar(){return false}
|
||||
return ValidatorClass.sharedInstanec.limitCharacter(length: 16,textField, shouldChangeCharactersIn: range, replacementString: string)
|
||||
case passwordTF:
|
||||
|
||||
@@ -20,9 +20,6 @@ class LoginVM{
|
||||
vc.passwordTF.placeholder = "Enter your password".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vc.userNameTF.placeholder = "Enter your username".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
|
||||
vc.userNameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(validationIconTapped))
|
||||
vc.userNameTF.rightView?.isHidden = true
|
||||
|
||||
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
|
||||
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
|
||||
let color3 = #colorLiteral(red: 0.968627451, green: 0.7882352941, blue: 0.1294117647, alpha: 1)
|
||||
@@ -37,26 +34,6 @@ class LoginVM{
|
||||
vc.userNameTF.roundCorner()
|
||||
vc.passwordTF.enablePasswordToggle()
|
||||
vc.passwordTF.rightView?.isHidden = true
|
||||
|
||||
self.vc.view.addTapGesture { [weak self] in
|
||||
guard let self else{return}
|
||||
hideErrors()
|
||||
}
|
||||
}
|
||||
|
||||
func hideErrors(){
|
||||
let errorView = errorViews.object(forKey: self.vc.userNameTF)
|
||||
if let errorView = errorView {
|
||||
errorView.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
// Function to handle tap on validation icon
|
||||
@objc func validationIconTapped() {
|
||||
let errorView = errorViews.object(forKey: vc.userNameTF)
|
||||
if let errorView = errorView {
|
||||
errorView.isHidden.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
// Function to handle tap on Password Toggle icon
|
||||
|
||||
@@ -69,7 +69,7 @@ class CartDataCache{
|
||||
}
|
||||
case .failure(let error):
|
||||
Utilities.dismissProgressHUD()
|
||||
Utilities.alert(title: "Error", message: error.localizedDescription, viewController: vc)
|
||||
// Utilities.alert(title: "Error", message: error.localizedDescription, viewController: vc)
|
||||
onCompletion(false)
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,13 @@ class BadgeBarBtn {
|
||||
|
||||
func updateBadge(for button: UIButton, with text: String) {
|
||||
if let badgeLabel = button.viewWithTag(999) as? UILabel {
|
||||
if text == "0"{
|
||||
badgeLabel.backgroundColor = .clear
|
||||
badgeLabel.textColor = .clear
|
||||
}else{
|
||||
badgeLabel.backgroundColor = .red
|
||||
badgeLabel.textColor = .white
|
||||
}
|
||||
badgeLabel.text = text
|
||||
badgeLabel.isHidden = text.isEmpty
|
||||
}
|
||||
|
||||
53
WOKA/Helpers/Network/NetworkMonitor.swift
Normal file
53
WOKA/Helpers/Network/NetworkMonitor.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// NetworkMonitor.swift
|
||||
// WOKA
|
||||
//
|
||||
// Created by MacBook Pro on 28/08/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Network
|
||||
|
||||
extension Notification.Name {
|
||||
static let connectivityStatus = Notification.Name(rawValue: "connectivityStatusChanged")
|
||||
}
|
||||
|
||||
extension NWInterface.InterfaceType: CaseIterable {
|
||||
public static var allCases: [NWInterface.InterfaceType] = [
|
||||
.other,
|
||||
.wifi,
|
||||
.cellular,
|
||||
.loopback,
|
||||
.wiredEthernet
|
||||
]
|
||||
}
|
||||
|
||||
final class NetworkMonitor {
|
||||
static let shared = NetworkMonitor()
|
||||
|
||||
private let queue = DispatchQueue(label: "NetworkConnectivityMonitor")
|
||||
private let monitor: NWPathMonitor
|
||||
|
||||
private(set) var isConnected = false
|
||||
private(set) var isExpensive = false
|
||||
private(set) var currentConnectionType: NWInterface.InterfaceType?
|
||||
|
||||
private init() {
|
||||
monitor = NWPathMonitor()
|
||||
}
|
||||
|
||||
func startMonitoring() {
|
||||
monitor.pathUpdateHandler = { [weak self] path in
|
||||
self?.isConnected = path.status != .unsatisfied
|
||||
self?.isExpensive = path.isExpensive
|
||||
self?.currentConnectionType = NWInterface.InterfaceType.allCases.filter { path.usesInterfaceType($0) }.first
|
||||
|
||||
NotificationCenter.default.post(name: .connectivityStatus, object: nil)
|
||||
}
|
||||
monitor.start(queue: queue)
|
||||
}
|
||||
|
||||
func stopMonitoring() {
|
||||
monitor.cancel()
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,10 @@ class HomeVC: UIViewController ,ChildViewControllerDelegate{
|
||||
}
|
||||
|
||||
print("Switching to view controller with identifier \(identifier)")
|
||||
replaceCurrentChildViewController(with: newVC)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self else{return}
|
||||
self.replaceCurrentChildViewController(with: newVC)
|
||||
}
|
||||
}
|
||||
|
||||
private func add(asChildViewController viewController: UIViewController) {
|
||||
@@ -66,11 +69,12 @@ class HomeVC: UIViewController ,ChildViewControllerDelegate{
|
||||
currentChildViewController = viewController
|
||||
}
|
||||
|
||||
private func remove(asChildViewController viewController: UIViewController) {
|
||||
private func remove(asChildViewController viewController: UIViewController, onCompletion : @escaping () -> Void) {
|
||||
print("Removing child view controller: \(viewController)")
|
||||
viewController.willMove(toParent: nil)
|
||||
viewController.view.removeFromSuperview()
|
||||
viewController.removeFromParent()
|
||||
onCompletion()
|
||||
}
|
||||
|
||||
private func replaceCurrentChildViewController(with newViewController: UIViewController) {
|
||||
@@ -79,10 +83,11 @@ class HomeVC: UIViewController ,ChildViewControllerDelegate{
|
||||
|
||||
// Remove current child view controller if exists
|
||||
if let currentVC = currentChildViewController {
|
||||
remove(asChildViewController: currentVC)
|
||||
remove(asChildViewController: currentVC) { [weak self] in
|
||||
guard let self else{return}
|
||||
// Add new child view controller
|
||||
add(asChildViewController: newViewController)
|
||||
}
|
||||
}
|
||||
|
||||
// Add new child view controller
|
||||
add(asChildViewController: newViewController)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import UIKit
|
||||
class ShopListingVC: UIViewController {
|
||||
|
||||
@IBOutlet weak var tableView: UITableView!
|
||||
@IBOutlet weak var noDataStack: UIStackView!
|
||||
|
||||
var vm = ShopListingVM()
|
||||
|
||||
@@ -48,6 +49,12 @@ class ShopListingVC: UIViewController {
|
||||
// Customize the navigation bar's appearance
|
||||
self.navigationController?.setColor(color: .black)
|
||||
}
|
||||
|
||||
@IBAction func retryBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
noDataStack.isHidden = true
|
||||
tableView.isHidden = false
|
||||
vm.getSuperCategory()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TableView DataSource , Delegates
|
||||
|
||||
@@ -31,12 +31,49 @@
|
||||
<color key="backgroundColor" red="0.82745098039999998" green="0.93725490199999995" blue="0.97254901959999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="OrderBottom" translatesAutoresizingMaskIntoConstraints="NO" id="gRK-pM-dPn">
|
||||
<rect key="frame" x="0.0" y="537.33333333333337" width="393" height="294.66666666666663"/>
|
||||
<rect key="frame" x="0.0" y="557.33333333333337" width="393" height="294.66666666666663"/>
|
||||
</imageView>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="UPY-aY-67P">
|
||||
<rect key="frame" x="0.0" y="59" width="393" height="793"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</tableView>
|
||||
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="gea-3i-ZQC">
|
||||
<rect key="frame" x="84.666666666666686" y="339.66666666666669" width="224" height="198.00000000000006"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SupportGirlImage" translatesAutoresizingMaskIntoConstraints="NO" id="Pxu-Ef-z7I">
|
||||
<rect key="frame" x="29" y="0.0" width="166" height="130"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="130" id="jh0-fo-bKl"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Something went wrong." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ryd-rK-YHP" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="135" width="224" height="24"/>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="20"/>
|
||||
<color key="textColor" name="ImageDarkBlue"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4BM-wb-4iF" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="44.333333333333329" y="164" width="135" height="34"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="135" id="cpN-0n-36y"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" name="ImageDarkBlue"/>
|
||||
<inset key="titleEdgeInsets" minX="10" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" title="Retry?">
|
||||
<color key="titleColor" name="ImageDarkBlue"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="retryBtnTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="XiT-a0-PXp"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
@@ -45,22 +82,25 @@
|
||||
<constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="UPY-aY-67P" secondAttribute="trailing" id="7iM-GP-HTA"/>
|
||||
<constraint firstItem="zhb-Th-KAe" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="B7w-Dx-USZ"/>
|
||||
<constraint firstItem="UPY-aY-67P" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" id="Hyn-4V-Bfy"/>
|
||||
<constraint firstItem="gea-3i-ZQC" firstAttribute="centerY" secondItem="vDu-zF-Fre" secondAttribute="centerY" id="I79-Uk-5rM"/>
|
||||
<constraint firstItem="gRK-pM-dPn" firstAttribute="leading" secondItem="5EZ-qb-Rvc" secondAttribute="leading" id="ICF-iB-ed7"/>
|
||||
<constraint firstItem="gea-3i-ZQC" firstAttribute="centerX" secondItem="vDu-zF-Fre" secondAttribute="centerX" id="QvE-Uh-qgY"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gRK-pM-dPn" secondAttribute="trailing" id="Zyn-bA-Fdh"/>
|
||||
<constraint firstItem="zhb-Th-KAe" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" id="bqB-3f-7QW"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gRK-pM-dPn" secondAttribute="bottom" constant="20" symbolic="YES" id="d2i-QF-oQ4"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gRK-pM-dPn" secondAttribute="bottom" id="d2i-QF-oQ4"/>
|
||||
<constraint firstItem="UPY-aY-67P" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="dTK-fu-JTe"/>
|
||||
<constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="zhb-Th-KAe" secondAttribute="trailing" id="pxo-3d-4Ob"/>
|
||||
<constraint firstAttribute="bottom" secondItem="UPY-aY-67P" secondAttribute="bottom" id="vt7-RK-kbR"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="noDataStack" destination="gea-3i-ZQC" id="ZvA-OA-Dzi"/>
|
||||
<outlet property="tableView" destination="UPY-aY-67P" id="hxW-SC-cSS"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1051" y="-35"/>
|
||||
<point key="canvasLocation" x="-1051.145038167939" y="-35.211267605633807"/>
|
||||
</scene>
|
||||
<!--Shop CategoryVC-->
|
||||
<scene sceneID="aA6-gp-Ayq">
|
||||
|
||||
@@ -76,21 +76,27 @@ class ShopListingVM{
|
||||
Error
|
||||
*/
|
||||
Utilities.dismissProgressHUD()
|
||||
|
||||
vc.noDataStack.isHidden = false
|
||||
vc.tableView.isHidden = true
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.result else{return}
|
||||
vc.noDataStack.isHidden = true
|
||||
vc.tableView.isHidden = false
|
||||
|
||||
self.superCatData = data
|
||||
self.vc.tableView.reloadData()
|
||||
default:
|
||||
break
|
||||
vc.noDataStack.isHidden = false
|
||||
vc.tableView.isHidden = true
|
||||
}
|
||||
case .failure(let error):
|
||||
guard let self else{
|
||||
Utilities.dismissProgressHUD()
|
||||
return
|
||||
}
|
||||
Utilities.dismissProgressHUD()
|
||||
vc.noDataStack.isHidden = false
|
||||
vc.tableView.isHidden = true
|
||||
vc.toast(msg: error.localizedDescription , time: 2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,6 @@ class ContactSupportVC: UIViewController {
|
||||
super.viewWillDisappear(animated)
|
||||
navigationController?.setNavigationBarHidden(true, animated: animated)
|
||||
|
||||
if let errorView = errorViews.object(forKey: emailTF) {
|
||||
errorView.isHidden = true
|
||||
}
|
||||
|
||||
if let errorView = errorViews.object(forKey: nameTF) {
|
||||
errorView.isHidden = true
|
||||
}
|
||||
|
||||
if self.isMovingFromParent {
|
||||
// Back button was pressed
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
@@ -76,8 +68,14 @@ class ContactSupportVC: UIViewController {
|
||||
//validate email fiirst
|
||||
let emailValidate = EmailValidation(email: email).validate()
|
||||
if emailValidate != .isCorrect{
|
||||
emailTF.rightView?.isHidden = false
|
||||
emailTF.setError(emailValidate.rawValue.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), show: true)
|
||||
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
|
||||
|
||||
vcPush.contentLabel = emailValidate.rawValue.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.mainTitleText = "Email".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -86,8 +84,14 @@ class ContactSupportVC: UIViewController {
|
||||
/*
|
||||
Check for username
|
||||
*/
|
||||
nameTF.rightView?.isHidden = false
|
||||
nameTF.setError(K.ConstantString.required.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), show: true)
|
||||
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
|
||||
|
||||
vcPush.contentLabel = K.ConstantString.required.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.mainTitleText = "Name".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -95,8 +99,14 @@ class ContactSupportVC: UIViewController {
|
||||
/*
|
||||
Check for username
|
||||
*/
|
||||
nameTF.rightView?.isHidden = false
|
||||
nameTF.setError(K.ConstantString.shortName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue), show: true)
|
||||
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
|
||||
|
||||
vcPush.contentLabel = K.ConstantString.shortName.localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.mainTitleText = "Name".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -150,21 +160,8 @@ extension ContactSupportVC : UITextFieldDelegate , UITextViewDelegate{
|
||||
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool{
|
||||
switch textField{
|
||||
case emailTF:
|
||||
if let rightView = textField.rightView {
|
||||
// Hide the right view
|
||||
rightView.isHidden = true
|
||||
|
||||
// Check if the right view is hidden
|
||||
if rightView.isHidden {
|
||||
// If hidden, hide the associated error view
|
||||
if let errorView = errorViews.object(forKey: emailTF) {
|
||||
errorView.isHidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return ValidatorClass.sharedInstanec.limitCharacter(length: 255,textField, shouldChangeCharactersIn: range, replacementString: string)
|
||||
case nameTF:
|
||||
textField.hideError()
|
||||
if !string.nameCharacterOnly(){return false}
|
||||
return ValidatorClass.sharedInstanec.limitCharacter(length: 50,textField, shouldChangeCharactersIn: range, replacementString: string)
|
||||
default:
|
||||
|
||||
@@ -41,11 +41,11 @@ class ContactSupportVM{
|
||||
vc.messageTextView.applyInnerShadow(radius: 15)
|
||||
vc.subjectStack.applyInnerShadow(radius: vc.subjectStack.frame.height / 2)
|
||||
|
||||
vc.nameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
|
||||
vc.nameTF.rightView?.isHidden = true
|
||||
|
||||
vc.emailTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorEmail))
|
||||
vc.emailTF.rightView?.isHidden = true
|
||||
// vc.nameTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorName))
|
||||
// vc.nameTF.rightView?.isHidden = true
|
||||
//
|
||||
// vc.emailTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(errorEmail))
|
||||
// vc.emailTF.rightView?.isHidden = true
|
||||
|
||||
dataSource = ["Query" , "Complaint", "Suggestion", "Other"]
|
||||
initDropDown()
|
||||
@@ -62,19 +62,19 @@ class ContactSupportVM{
|
||||
|
||||
}
|
||||
|
||||
@objc func errorName(){
|
||||
let errorView = errorViews.object(forKey: vc.nameTF)
|
||||
if let errorView = errorView {
|
||||
errorView.isHidden.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func errorEmail(){
|
||||
let errorView = errorViews.object(forKey: vc.emailTF)
|
||||
if let errorView = errorView {
|
||||
errorView.isHidden.toggle()
|
||||
}
|
||||
}
|
||||
// @objc func errorName(){
|
||||
// let errorView = errorViews.object(forKey: vc.nameTF)
|
||||
// if let errorView = errorView {
|
||||
// errorView.isHidden.toggle()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @objc func errorEmail(){
|
||||
// let errorView = errorViews.object(forKey: vc.emailTF)
|
||||
// if let errorView = errorView {
|
||||
// errorView.isHidden.toggle()
|
||||
// }
|
||||
// }
|
||||
|
||||
private func userTypeManipulations(){
|
||||
if let userType = AuthFunc.shareInstance.getUserType(){ // 1- kid , 2 - guardian , 3 - guest
|
||||
|
||||
@@ -54,6 +54,7 @@ class ThemeOneVC: UIViewController {
|
||||
NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeOnePush), object: nil)
|
||||
// NotificationCenter.default.removeObserver(self, name: NSNotification.Name.connectivityStatus, object: nil)
|
||||
if let playerItem = vm.playerItem{
|
||||
playerItem.removeObserver(self, forKeyPath: "status")
|
||||
// playerItem.removeObserver(self, forKeyPath: "isPlaybackBufferEmpty")
|
||||
@@ -79,12 +80,13 @@ class ThemeOneVC: UIViewController {
|
||||
if MyListDataTemp.shareInstance.favListingData?.showData == nil {
|
||||
MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(totalRecords: nil, showData: FavouriteListingDM.ResultData.ShowData(hindi: [],english: []),videoData: [],gameData: [],singKaraokeData: [],audioData: [])
|
||||
}
|
||||
|
||||
// NetworkMonitor.shared.startMonitoring()
|
||||
// connectedToNetwork()
|
||||
|
||||
// PersistentStorage.shared.deleteData()
|
||||
// PersistentStorage.shared.retrieveData()
|
||||
vm.setupAvPlayer()
|
||||
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
@@ -207,6 +209,15 @@ extension ThemeOneVC{
|
||||
switch player.timeControlStatus {
|
||||
case .waitingToPlayAtSpecifiedRate:
|
||||
print("Theme 1 Player Buffering...")
|
||||
switch vm.reachability?.isReachable{
|
||||
case true:
|
||||
break
|
||||
case false:
|
||||
break
|
||||
// NetworkMonitor.shared.startMonitoring()
|
||||
default:
|
||||
break
|
||||
}
|
||||
vm.startStopActivity(isStart: true)
|
||||
case .playing:
|
||||
print("Theme 1 Player Playing")
|
||||
|
||||
@@ -57,9 +57,27 @@ class ThemeOneVM{
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.reloadTheme), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleRouteChange(_:)), name: AVAudioSession.routeChangeNotification, object: nil)
|
||||
// NotificationCenter.default.addObserver(self, selector: #selector(showOfflineDeviceUI(notification:)), name: NSNotification.Name.connectivityStatus, object: nil)
|
||||
|
||||
}
|
||||
|
||||
// @objc func showOfflineDeviceUI(notification: Notification) {
|
||||
// if NetworkMonitor.shared.isConnected {
|
||||
//// NetworkMonitor.shared.stopMonitoring()
|
||||
// guard let avPlayer else{return}
|
||||
// if avPlayer.currentItem == nil || avPlayer.currentItem?.status == .failed {
|
||||
// print("Player was Nil")
|
||||
// setupAvPlayer()
|
||||
// } else {
|
||||
// print("Player is not Nil")
|
||||
// setupAvPlayer()
|
||||
// }
|
||||
// print("Connected")
|
||||
// } else {
|
||||
// print("Not connected")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@objc func handleRouteChange(_ notification: Notification) {
|
||||
guard let userInfo = notification.userInfo,
|
||||
let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt,
|
||||
@@ -71,11 +89,9 @@ class ThemeOneVM{
|
||||
case .oldDeviceUnavailable:
|
||||
// Headphones unplugged, avoid pausing if desired
|
||||
avPlayer?.play() // Resume playing if paused
|
||||
|
||||
case .newDeviceAvailable:
|
||||
// Headphones plugged in, you may want to take specific actions if needed
|
||||
avPlayer?.play() // Resume playing if paused
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class WebSeriesVC: UIViewController {
|
||||
@IBOutlet weak var tableHeight: NSLayoutConstraint!
|
||||
|
||||
@IBOutlet weak var continueWatchingStack: UIStackView!
|
||||
@IBOutlet weak var noDataView: UIView!
|
||||
|
||||
@IBOutlet weak var loadMoreBtn: LocalisedElementsButton!
|
||||
@IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView!
|
||||
@@ -115,6 +116,16 @@ class WebSeriesVC: UIViewController {
|
||||
}
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
}
|
||||
|
||||
@IBAction func retryBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
PersistentStorage.shared.addOthersCount()
|
||||
noDataView.isHidden = true
|
||||
// for the first load always send hindi as it is default category
|
||||
vm.startShimmer()
|
||||
// showListingTableView.reloadData()
|
||||
vm.getShowListing(categoryID: 18)
|
||||
self.vm.getCategoryListing()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TableView DataSource , Delegates
|
||||
|
||||
@@ -18,6 +18,7 @@ class WebSeriesVM{
|
||||
|
||||
let dropDownModule = DropDown()
|
||||
var dataSource = [String]()
|
||||
// var tempCount = 2
|
||||
|
||||
//Static url for masila
|
||||
//// var masilaUrl = "https://content.jwplatform.com/videos/Iygt11AD-Ysj2G4DQ.mp4"
|
||||
@@ -27,6 +28,7 @@ class WebSeriesVM{
|
||||
|
||||
func initView(){
|
||||
setupCell()
|
||||
|
||||
startShimmer()
|
||||
vc.scrollView.indicatorStyle = .white // or .white
|
||||
|
||||
@@ -37,7 +39,6 @@ class WebSeriesVM{
|
||||
vc.view.applyGradient(colors: [color2, color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0))
|
||||
|
||||
getCategoryListing()
|
||||
getContinueWatching()
|
||||
|
||||
// for the first load always send hindi as it is default category
|
||||
self.getShowListing(categoryID: 18)
|
||||
@@ -111,7 +112,6 @@ class WebSeriesVM{
|
||||
|
||||
//if the language is changed call the showlisting api
|
||||
if let id = categoryListingData[index].id {
|
||||
Utilities.startProgressHUD()
|
||||
pageNo = 0
|
||||
getShowListing(categoryID: id,languageChange: true)
|
||||
}
|
||||
@@ -193,12 +193,14 @@ class WebSeriesVM{
|
||||
}else{
|
||||
self.showData.append(contentsOf: data)
|
||||
}
|
||||
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.showListingTableView.reloadData()
|
||||
self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height + 100
|
||||
self.vc.showListingTableView.layoutIfNeeded()
|
||||
self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height
|
||||
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
@@ -239,23 +241,29 @@ class WebSeriesVM{
|
||||
Error
|
||||
*/
|
||||
Utilities.dismissProgressHUD()
|
||||
self.stopShimmer()
|
||||
vc.noDataView.isHidden = false
|
||||
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.result else{return}
|
||||
self.categoryListingData = data
|
||||
dataSource = categoryListingData.map({$0.categoryName ?? "Unknown"})
|
||||
getContinueWatching()
|
||||
initDropDown()
|
||||
default:
|
||||
break
|
||||
self.stopShimmer()
|
||||
vc.noDataView.isHidden = false
|
||||
}
|
||||
case .failure(let error):
|
||||
guard let self else{
|
||||
Utilities.dismissProgressHUD()
|
||||
return
|
||||
}
|
||||
self.stopShimmer()
|
||||
Utilities.dismissProgressHUD()
|
||||
vc.toast(msg: error.localizedDescription , time: 2)
|
||||
vc.noDataView.isHidden = false
|
||||
vc.toast(msg: error.localizedDescription, time: 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,10 +150,10 @@
|
||||
<rect key="frame" x="0.0" y="40" width="373" height="50"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yFH-vA-sul">
|
||||
<rect key="frame" x="0.0" y="0.0" width="205" height="50"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="91.666666666666671" height="50"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hindi" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Exa-2W-66W">
|
||||
<rect key="frame" x="15" y="10" width="150" height="30"/>
|
||||
<rect key="frame" x="14.999999999999996" y="10" width="36.666666666666657" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="150" id="RUF-0Z-y7n"/>
|
||||
</constraints>
|
||||
@@ -162,7 +162,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nJQ-BB-3U3">
|
||||
<rect key="frame" x="165" y="10" width="30" height="30"/>
|
||||
<rect key="frame" x="51.666666666666657" y="10" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="30" id="HRV-zm-4xd"/>
|
||||
</constraints>
|
||||
@@ -264,13 +264,63 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.019607843137254902" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</stackView>
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gY9-3R-0TH">
|
||||
<rect key="frame" x="0.0" y="59" width="393" height="793"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="vZv-fa-xPO">
|
||||
<rect key="frame" x="30" y="297.66666666666669" width="333" height="198"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SupportGirlImage" translatesAutoresizingMaskIntoConstraints="NO" id="nZc-6d-co3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="333" height="130"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="130" id="FxA-7F-Chc"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Something went wrong." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1AF-XM-phJ" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="135" width="333" height="24"/>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="20"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UBu-e8-jd3" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="163.99999999999994" width="333" height="34"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="135" id="aVQ-Wf-xxa"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="10" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" title="Retry?"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="retryBtnTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="94H-H9-nfn"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.019607843137254902" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vZv-fa-xPO" firstAttribute="centerY" secondItem="gY9-3R-0TH" secondAttribute="centerY" id="3bc-c1-2jj"/>
|
||||
<constraint firstItem="vZv-fa-xPO" firstAttribute="leading" secondItem="gY9-3R-0TH" secondAttribute="leading" constant="30" id="gfD-Ms-vSV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vZv-fa-xPO" secondAttribute="trailing" constant="30" id="yWP-Fp-qZ0"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="gY9-3R-0TH" secondAttribute="trailing" id="55l-5I-gMd"/>
|
||||
<constraint firstItem="0UD-sZ-RF4" firstAttribute="trailing" secondItem="vDu-zF-Fre" secondAttribute="trailing" id="DCe-Vn-7Dt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gY9-3R-0TH" secondAttribute="bottom" id="Ioi-RB-pBu"/>
|
||||
<constraint firstItem="gY9-3R-0TH" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="U4Y-uu-YCy"/>
|
||||
<constraint firstItem="bTO-Ql-tyN" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="Wo8-6g-sdc"/>
|
||||
<constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="bTO-Ql-tyN" secondAttribute="trailing" id="bPs-s1-jpc"/>
|
||||
<constraint firstItem="gY9-3R-0TH" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" id="dYz-Oz-Sst"/>
|
||||
<constraint firstItem="bTO-Ql-tyN" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" id="qkp-BT-BFx"/>
|
||||
<constraint firstAttribute="bottom" secondItem="0UD-sZ-RF4" secondAttribute="bottom" id="r39-DL-DAV"/>
|
||||
<constraint firstItem="0UD-sZ-RF4" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="uk6-z5-78R"/>
|
||||
@@ -289,6 +339,7 @@
|
||||
<outlet property="loadMoreActivityIndicator" destination="eOC-qb-KNO" id="wjE-aj-J2d"/>
|
||||
<outlet property="loadMoreBtn" destination="7ol-RU-bwy" id="slu-Zm-hE1"/>
|
||||
<outlet property="masilaTrailerView" destination="Cog-DZ-ib0" id="IMd-wS-yNh"/>
|
||||
<outlet property="noDataView" destination="gY9-3R-0TH" id="Faz-ba-PbN"/>
|
||||
<outlet property="scrollView" destination="rom-H6-7RC" id="8bD-vg-lG2"/>
|
||||
<outlet property="showListingTableView" destination="Oxv-4e-Qj0" id="Yye-0B-zRg"/>
|
||||
<outlet property="tableHeight" destination="WLI-rz-zRP" id="g40-aL-ik2"/>
|
||||
@@ -423,7 +474,7 @@
|
||||
<rect key="frame" x="340.66666666666669" y="0.0" width="32.333333333333314" height="49"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hand.thumbsup.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="eng-oC-d9H">
|
||||
<rect key="frame" x="0.0" y="0.66666666666666785" width="20" height="47.666666666666657"/>
|
||||
<rect key="frame" x="0.0" y="0.66666666666666785" width="20" height="47.666666666666671"/>
|
||||
<color key="tintColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Egv-Cu-aPK">
|
||||
@@ -1155,6 +1206,7 @@
|
||||
<image name="PlayButtonSmall" width="28.333333969116211" height="28.333333969116211"/>
|
||||
<image name="ShareImage" width="18" height="18"/>
|
||||
<image name="SupportBottomArrow" width="16.333333969116211" height="16.333333969116211"/>
|
||||
<image name="SupportGirlImage" width="166" height="166"/>
|
||||
<image name="WebSeriesSeasonsBackground" width="142.66667175292969" height="187.33332824707031"/>
|
||||
<image name="hand.thumbsup" catalog="system" width="123" height="128"/>
|
||||
<image name="hand.thumbsup.fill" catalog="system" width="128" height="121"/>
|
||||
|
||||
Reference in New Issue
Block a user