diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 6d01b51..0d468f5 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -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 = ""; }; 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 = ""; }; 5202AAFD2BDF90590043B7BD /* TextFieldImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldImage.swift; sourceTree = ""; }; 5202AB002BDFA7900043B7BD /* EmailValidation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailValidation.swift; sourceTree = ""; }; 520346942C64E29A00D0BD20 /* MyListViewAllCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListViewAllCell.swift; sourceTree = ""; }; @@ -809,6 +811,14 @@ path = Pods; sourceTree = ""; }; + 5201D4272C7F22DD008E3211 /* Network */ = { + isa = PBXGroup; + children = ( + 5201D4282C7F22E7008E3211 /* NetworkMonitor.swift */, + ); + path = Network; + sourceTree = ""; + }; 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 */, diff --git a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard index 740d9a1..a213a1e 100644 --- a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard +++ b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard @@ -1382,17 +1382,17 @@ Sent to Your Parent’s Email - + - + - + - + + + @@ -45,22 +82,25 @@ + + - + + - + diff --git a/WOKA/Shop/ViewModel/ShopListingVM.swift b/WOKA/Shop/ViewModel/ShopListingVM.swift index 3c349a1..e9e470c 100644 --- a/WOKA/Shop/ViewModel/ShopListingVM.swift +++ b/WOKA/Shop/ViewModel/ShopListingVM.swift @@ -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) } } diff --git a/WOKA/SideBarNav/Controller/ContactSupportVC.swift b/WOKA/SideBarNav/Controller/ContactSupportVC.swift index 2aab200..d0291ea 100644 --- a/WOKA/SideBarNav/Controller/ContactSupportVC.swift +++ b/WOKA/SideBarNav/Controller/ContactSupportVC.swift @@ -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: diff --git a/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift b/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift index edd1b12..1b22cad 100644 --- a/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift +++ b/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift @@ -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 diff --git a/WOKA/Theme/Controller/ThemeOneVC.swift b/WOKA/Theme/Controller/ThemeOneVC.swift index 2be7a40..05232c7 100644 --- a/WOKA/Theme/Controller/ThemeOneVC.swift +++ b/WOKA/Theme/Controller/ThemeOneVC.swift @@ -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") diff --git a/WOKA/Theme/ViewModel/ThemeOneVM.swift b/WOKA/Theme/ViewModel/ThemeOneVM.swift index 91611dd..5a0f375 100644 --- a/WOKA/Theme/ViewModel/ThemeOneVM.swift +++ b/WOKA/Theme/ViewModel/ThemeOneVM.swift @@ -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 } diff --git a/WOKA/WebSeries/Controller/WebSeriesVC.swift b/WOKA/WebSeries/Controller/WebSeriesVC.swift index ae7b67f..d5c1313 100644 --- a/WOKA/WebSeries/Controller/WebSeriesVC.swift +++ b/WOKA/WebSeries/Controller/WebSeriesVC.swift @@ -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 diff --git a/WOKA/WebSeries/ViewModel/WebSeriesVM.swift b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift index caf0778..ea8dd85 100644 --- a/WOKA/WebSeries/ViewModel/WebSeriesVM.swift +++ b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift @@ -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) } } } diff --git a/WOKA/WebSeries/WebSeries.storyboard b/WOKA/WebSeries/WebSeries.storyboard index 050c465..2064652 100644 --- a/WOKA/WebSeries/WebSeries.storyboard +++ b/WOKA/WebSeries/WebSeries.storyboard @@ -150,10 +150,10 @@ - + + + + + + + + + + + + + + + @@ -289,6 +339,7 @@ + @@ -423,7 +474,7 @@ - +