From d17fe416ae4d44c99aea3be2a3c6862a9f290cf5 Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Mon, 12 Aug 2024 19:58:58 +0530 Subject: [PATCH] - My list Audio books on add remove fav, only calling audiobooks api and reloading in background - My list Games on add remove fav, only calling Games api and reloading in background - My list Karaoke on add remove fav, only calling Karaoke api and reloading in background -Finalised clicks count for every module --- WOKA.xcodeproj/project.pbxproj | 16 +-- WOKA/Address/Controller/AddNewAddressVC.swift | 7 +- WOKA/Address/Controller/AddressListVC.swift | 9 +- .../Address/Controller/PaymentWebViewVC.swift | 40 +++--- .../Controller/VerifyAddressPincodeVC.swift | 5 + WOKA/Address/ViewModel/AddressListVM.swift | 2 +- WOKA/Audio Books/AudioBookDetailsVC.swift | 42 +++++-- WOKA/Audio Books/AudioBookHomeVC.swift | 21 +++- WOKA/Audio Books/AudioBookHomeVM.swift | 8 +- .../Base.lproj/AuthenticationSB.storyboard | 2 +- WOKA/Authentication/Controller/EmailVC.swift | 6 + .../Controller/LinkedChildVC.swift | 6 + WOKA/Authentication/Controller/LoginVC.swift | 4 + .../Controller/NewPasswordVC.swift | 5 + WOKA/Authentication/Controller/OTPVC.swift | 7 ++ .../Controller/ResetPassUserNameVC.swift | 6 + .../Controller/SelectAvatarVC.swift | 7 ++ .../Controller/UserDetailsRegisterVC.swift | 6 + .../Controller/UserIntrestVC.swift | 8 +- .../ViewModel/NewPasswordVM.swift | 2 +- .../ViewModel/ResetPassUserNameVM.swift | 2 +- .../ViewModel/UserIntrestVM.swift | 2 + WOKA/Cart/Cart.storyboard | 42 +++---- WOKA/Cart/CartDataCache.swift | 7 ++ WOKA/Cart/Controller/CartListVC.swift | 16 ++- .../Controller/CartPaymentOptionsVC.swift | 9 +- WOKA/Constants K/GVar.swift | 4 + WOKA/Constants K/OnBoardVM.swift | 6 + WOKA/Games/Controller/GamesDetailVC.swift | 39 ++++-- WOKA/Games/Controller/GamesListVC.swift | 20 ++- WOKA/Games/Controller/GamesWebViewVC.swift | 22 +++- WOKA/Games/ViewModel/GamesListVM.swift | 7 +- WOKA/Home/Controller/MyListVC.swift | 27 ++++ WOKA/Home/Controller/MyListViewAllVC.swift | 1 - WOKA/Home/MyListDataTemp.swift | 118 ++++++++++++++++++ .../Controller/JWKaraokePlayerVC.swift | 34 ++++- .../Karaoke/Controller/KaraokeDetailsVC.swift | 39 ++++-- .../Karaoke/Controller/KaraokeListingVC.swift | 26 +++- WOKA/Karaoke/Karaoke.storyboard | 3 + .../Karaoke/ViewModel/JWKaraokePlayerVM.swift | 3 + WOKA/Karaoke/ViewModel/KaraokeListingVM.swift | 8 +- .../hi.lproj/Localizable.strings | 2 +- .../Controller/OnBoardVC.swift | 10 ++ .../Controller/SelectAgeVC.swift | 9 +- .../Controller/SplashVC.swift | 3 +- .../OnBoarding Module/Model/GuestDataDM.swift | 2 + .../ViewModel/SelectAgeVM.swift | 2 + .../ViewModel/SplashVM.swift | 2 - WOKA/PersistentStorage.swift | 24 +++- WOKA/Shop/Controller/ProductDetailsVC.swift | 7 ++ WOKA/Shop/Controller/ShopCategoryVC.swift | 8 ++ WOKA/Shop/Controller/ShopListingVC.swift | 7 ++ WOKA/Shop/Controller/ShopProductsVC.swift | 13 ++ WOKA/Shop/ViewModel/ProductDetailsVM.swift | 1 + WOKA/Shop/ViewModel/ShopCategoryVM.swift | 2 + WOKA/Shop/ViewModel/ShopListingVM.swift | 1 + WOKA/Shop/ViewModel/ShopProductsVM.swift | 2 + WOKA/SideBarNav/Controller/MyOrdersVC.swift | 6 +- WOKA/SideBarNav/ViewModel/MyOrdersVM.swift | 2 + WOKA/Theme/Base.lproj/Theme.storyboard | 5 +- WOKA/Theme/Controller/ThemeTwoVC.swift | 8 ++ .../Theme/Controller/UserNotificationVC.swift | 7 ++ WOKA/Theme/ViewModel/ThemeTwoVM.swift | 1 + .../Controller/ContinueWatchingVC.swift | 10 +- .../Controller/EpisodeDetailsVC.swift | 4 + .../Controller/WebSeriesSeasonVC.swift | 30 ++++- WOKA/WebSeries/Controller/WebSeriesVC.swift | 21 ++++ .../ViewModel/WebSeriesSeasonVM.swift | 10 +- WOKA/WebSeries/ViewModel/WebSeriesVM.swift | 2 + 69 files changed, 708 insertions(+), 137 deletions(-) diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 86a86a5..9243c99 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 5202AB012BDFA7900043B7BD /* EmailValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5202AB002BDFA7900043B7BD /* EmailValidation.swift */; }; 520346962C64E29A00D0BD20 /* MyListViewAllCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 520346952C64E29A00D0BD20 /* MyListViewAllCell.xib */; }; 520346972C64E29A00D0BD20 /* MyListViewAllCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 520346942C64E29A00D0BD20 /* MyListViewAllCell.swift */; }; + 5210438E2C69E18F0005A4D1 /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 5210438C2C69E18F0005A4D1 /* WOKA.xcdatamodeld */; }; 5219C2C22C086D9C00A1DF4D /* DataTypeConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5219C2C12C086D9B00A1DF4D /* DataTypeConversion.swift */; }; 521CB1002C493DB80085BDF8 /* JWPlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 521CB0FF2C493DB80085BDF8 /* JWPlayerKit */; }; 522242662BFC74380085C632 /* MyListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522242632BFC74380085C632 /* MyListVC.swift */; }; @@ -307,7 +308,6 @@ 9C85A9F32C5CE1060031C365 /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9F22C5CE1060031C365 /* FirebasePerformance */; }; 9C8C4FAE2C1315410017DD3B /* WebViewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */; }; 9C8C4FB02C1328060017DD3B /* Disclaimer.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */; }; - 9C9BE46C2C65DF2A00C48D6A /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BE46A2C65DF2A00C48D6A /* WOKA.xcdatamodeld */; }; 9C9BE46E2C663B1600C48D6A /* JWKaraokePlayerVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BE46D2C663B1600C48D6A /* JWKaraokePlayerVM.swift */; }; 9C9BEEC72BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */; }; 9CA7C6C02C1093E500D73742 /* ProfileVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CA7C6BF2C1093E500D73742 /* ProfileVC.swift */; }; @@ -372,6 +372,7 @@ 520346952C64E29A00D0BD20 /* MyListViewAllCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyListViewAllCell.xib; sourceTree = ""; }; 520B6E3E2C0751E90091C478 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Theme.strings; sourceTree = ""; }; 520B6E402C0751EF0091C478 /* hi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hi; path = hi.lproj/Theme.strings; sourceTree = ""; }; + 5210438D2C69E18F0005A4D1 /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; 5219C2C12C086D9B00A1DF4D /* DataTypeConversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTypeConversion.swift; sourceTree = ""; }; 522242632BFC74380085C632 /* MyListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyListVC.swift; sourceTree = ""; }; 522242652BFC74380085C632 /* TabBarVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarVC.swift; sourceTree = ""; }; @@ -662,7 +663,6 @@ 9C85A9EB2C5CD5CD0031C365 /* MyListDataTemp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListDataTemp.swift; sourceTree = ""; }; 9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewVC.swift; sourceTree = ""; }; 9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Disclaimer.rtf; sourceTree = ""; }; - 9C9BE46B2C65DF2A00C48D6A /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; 9C9BE46D2C663B1600C48D6A /* JWKaraokePlayerVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JWKaraokePlayerVM.swift; sourceTree = ""; }; 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCenteredFlowLayout.swift; sourceTree = ""; }; 9CA7C6BF2C1093E500D73742 /* ProfileVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileVC.swift; sourceTree = ""; }; @@ -888,7 +888,7 @@ 9C535DC82C00C34000DA6DCD /* Theme */, 52DAC6462C21761700E2F85B /* WebSeries */, 9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */, - 9C9BE46A2C65DF2A00C48D6A /* WOKA.xcdatamodeld */, + 5210438C2C69E18F0005A4D1 /* WOKA.xcdatamodeld */, 52ACC1292C610EC900791528 /* PersistentStorage.swift */, ); path = WOKA; @@ -2226,6 +2226,7 @@ 52A6DCA02C4E3AA600F63C51 /* ShopListingCell.swift in Sources */, 525954192BE8CC3400191286 /* ConstantString.swift in Sources */, 52D774EB2BDFC0BF001D87DE /* OTPVC.swift in Sources */, + 5210438E2C69E18F0005A4D1 /* WOKA.xcdatamodeld in Sources */, 9C8446872C40FC6E003E3E53 /* AVPlayerTesting.swift in Sources */, 52AF71F42C36C40B00BC5972 /* GamesWebViewVC.swift in Sources */, 9C007F202C255DF200F798C2 /* EpisodeListingDM.swift in Sources */, @@ -2379,7 +2380,6 @@ 52C8B05F2BDA5AFA003B51D0 /* SplashVM.swift in Sources */, 52C1A4E12C05B69F007BAA50 /* UIApplicationSwitchRoot.swift in Sources */, 527A2BCC2C577F8A0080DF9B /* AnalyticsEventKeys.swift in Sources */, - 9C9BE46C2C65DF2A00C48D6A /* WOKA.xcdatamodeld in Sources */, 52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */, 522D65602C1ACD8D0021E505 /* UserNotificationVC.swift in Sources */, 52AC2D252C295A7900337473 /* TeaserDM.swift in Sources */, @@ -2879,14 +2879,14 @@ /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ - 9C9BE46A2C65DF2A00C48D6A /* WOKA.xcdatamodeld */ = { + 5210438C2C69E18F0005A4D1 /* WOKA.xcdatamodeld */ = { isa = XCVersionGroup; children = ( - 9C9BE46B2C65DF2A00C48D6A /* WOKA.xcdatamodel */, + 5210438D2C69E18F0005A4D1 /* WOKA.xcdatamodel */, ); - currentVersion = 9C9BE46B2C65DF2A00C48D6A /* WOKA.xcdatamodel */; + currentVersion = 5210438D2C69E18F0005A4D1 /* WOKA.xcdatamodel */; name = WOKA.xcdatamodeld; - path = /Users/bilal/Desktop/woka_native_ios_swift/WOKA/WOKA.xcdatamodeld; + path = /Users/macbookpro/Desktop/WOKA/WOKA/WOKA.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; diff --git a/WOKA/Address/Controller/AddNewAddressVC.swift b/WOKA/Address/Controller/AddNewAddressVC.swift index fa8aa48..b33aaf4 100644 --- a/WOKA/Address/Controller/AddNewAddressVC.swift +++ b/WOKA/Address/Controller/AddNewAddressVC.swift @@ -38,6 +38,10 @@ class AddNewAddressVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } override func viewDidDisappear(_ animated: Bool) { @@ -47,7 +51,8 @@ class AddNewAddressVC: UIViewController { self.navigationController?.setColor(color: .black) } @IBAction func submitBtnTapped(_ sender: LocalisedElementsButton) { - + PersistentStorage.shared.addShopCount(postID: 0) + if enterAddressNAmeTF.text!.count < 2 { Utilities.alertWithBtn(title: "", msgBody: "Name should be minimum 2 Characters.", okBtnStr: "OK", vc: self) return diff --git a/WOKA/Address/Controller/AddressListVC.swift b/WOKA/Address/Controller/AddressListVC.swift index 4f4dba2..409689e 100644 --- a/WOKA/Address/Controller/AddressListVC.swift +++ b/WOKA/Address/Controller/AddressListVC.swift @@ -36,7 +36,6 @@ class AddressListVC: UIViewController { override func viewDidAppear(_ animated: Bool) { self.navigationController?.setColor(color: .white) - // handle data change self.tableView.reloadData() } @@ -44,6 +43,10 @@ class AddressListVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } override func viewDidDisappear(_ animated: Bool) { @@ -54,6 +57,8 @@ class AddressListVC: UIViewController { } @IBAction func btnTapped(_ sender: LocalisedElementsButton) { + PersistentStorage.shared.addShopCount(postID: 0) + switch sender{ case useSelectedAddBtn: if let addressID = CartDataCache.addressData.filter({$0.isDefault == true}).first?.id{ @@ -89,6 +94,8 @@ extension AddressListVC : TableViewSRC{ CartDataCache.addressData[index].isDefault = false } + PersistentStorage.shared.addShopCount(postID: 0) + // if CartDataCache.addressData[indexPath.row].eddDate == nil || CartDataCache.addressData[indexPath.row].eddDate == ""{ if let pincode = CartDataCache.addressData[indexPath.row].pincode, let id = CartDataCache.addressData[indexPath.row].id{ diff --git a/WOKA/Address/Controller/PaymentWebViewVC.swift b/WOKA/Address/Controller/PaymentWebViewVC.swift index 3f06d7f..c8e8f42 100644 --- a/WOKA/Address/Controller/PaymentWebViewVC.swift +++ b/WOKA/Address/Controller/PaymentWebViewVC.swift @@ -29,6 +29,16 @@ class PaymentWebViewVC: UIViewController,WKNavigationDelegate { webView.addObserver(self, forKeyPath: "URL", options: .new, context: nil) } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(true, animated: animated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + } func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { Utilities.dismissProgressHUD() @@ -46,9 +56,15 @@ class PaymentWebViewVC: UIViewController,WKNavigationDelegate { domain = finalURL.host ?? "" } - if domain == "secure.ccavenue.com" && endpoint.lowercased() == "canceltransaction"{ + if domain == "secure.ccavenue.com" && endpoint.lowercased() == "canceltransaction"{ // failure Timer.scheduledTimer(withTimeInterval: 2.5, repeats: false) { _ in - self.dismiss(animated: true) + self.navigationController?.popViewController(animated: true) + } + }else if domain == "secure.ccavenue.com" && endpoint.lowercased() == "redirectToMerchant"{ // success + // nav to home. & delete my cart + CartDataCache.shareInstance.removeAll() + Timer.scheduledTimer(withTimeInterval: 2.5, repeats: false) { _ in + self.navigationController?.popToRootViewController(animated: true) } } } else { @@ -57,25 +73,5 @@ class PaymentWebViewVC: UIViewController,WKNavigationDelegate { } } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - navigationController?.setNavigationBarHidden(false, animated: animated) - } - - override func viewDidAppear(_ animated: Bool) { - self.navigationController?.setColor(color: .white) - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - self.navigationController?.setNavigationBarHidden(true, animated: animated) - } - - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - - // Customize the navigation bar's appearance - self.navigationController?.setColor(color: .black) - } } diff --git a/WOKA/Address/Controller/VerifyAddressPincodeVC.swift b/WOKA/Address/Controller/VerifyAddressPincodeVC.swift index 4844fb7..15ae8f5 100644 --- a/WOKA/Address/Controller/VerifyAddressPincodeVC.swift +++ b/WOKA/Address/Controller/VerifyAddressPincodeVC.swift @@ -36,6 +36,10 @@ class VerifyAddressPincodeVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } override func viewDidDisappear(_ animated: Bool) { @@ -46,6 +50,7 @@ class VerifyAddressPincodeVC: UIViewController { } @IBAction func proceedBtnTapped(_ sender: LocalisedElementsButton) { + PersistentStorage.shared.addShopCount(postID: 0) guard let tf = pinCodeTF.text else{return} if sender.titleLabel?.text == "CHECK NOW"{ if tf.count < 6{ diff --git a/WOKA/Address/ViewModel/AddressListVM.swift b/WOKA/Address/ViewModel/AddressListVM.swift index 5e1c07c..b8bd843 100644 --- a/WOKA/Address/ViewModel/AddressListVM.swift +++ b/WOKA/Address/ViewModel/AddressListVM.swift @@ -171,7 +171,7 @@ class AddressListVM{ vcPush.url = data.url vcPush.modalTransitionStyle = .crossDissolve vcPush.modalPresentationStyle = .fullScreen - self.vc.present(vcPush, animated: true) + self.vc.navigationController?.pushViewController(vcPush, animated: true) default: Utilities.dismissProgressHUD() break diff --git a/WOKA/Audio Books/AudioBookDetailsVC.swift b/WOKA/Audio Books/AudioBookDetailsVC.swift index 19b4639..684f5f2 100644 --- a/WOKA/Audio Books/AudioBookDetailsVC.swift +++ b/WOKA/Audio Books/AudioBookDetailsVC.swift @@ -47,6 +47,9 @@ class AudioBookDetailsVC : UIViewController{ @objc func handleTap(_ gesture: UITapGestureRecognizer) { let location = gesture.location(in: outerView) if !contentView.frame.contains(location) { + if let postID = audioData?.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } self.dismiss(animated: true) } } @@ -57,6 +60,9 @@ class AudioBookDetailsVC : UIViewController{ addView.addTapGesture { [weak self] in guard let self else{return} + if let postID = audioData?.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } if AuthFunc.shareInstance.guestUserLoginPopUp() { return} if let audioData{ @@ -66,10 +72,12 @@ class AudioBookDetailsVC : UIViewController{ LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in self.audioData?.markAsFavourite = false - if let index = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == showID}){ - MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: index) - K.GVar.myListSoftReload = true - } +// if let index = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == showID}){ +// MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: index) +// K.GVar.myListSoftReload = true +// } + + K.GVar.reloadMyListAudioBooks = true self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: false, isLike: nil, id: showID) self.initView() @@ -78,10 +86,12 @@ class AudioBookDetailsVC : UIViewController{ LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in self.audioData?.markAsFavourite = true - if let audioData = self.audioData{ - MyListDataTemp.shareInstance.favListingData?.audioData?.append(audioData) - K.GVar.myListSoftReload = true - } +// if let audioData = self.audioData{ +// MyListDataTemp.shareInstance.favListingData?.audioData?.append(audioData) +// K.GVar.myListSoftReload = true +// } + + K.GVar.reloadMyListAudioBooks = true self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: true, isLike: nil, id: showID) self.initView() @@ -121,6 +131,9 @@ class AudioBookDetailsVC : UIViewController{ likeView.addTapGesture { [weak self] in guard let self else{return} + if let postID = audioData?.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } if AuthFunc.shareInstance.guestUserLoginPopUp() { return} if let audioData{ @@ -196,7 +209,12 @@ class AudioBookDetailsVC : UIViewController{ } - shareView.addTapGesture { + shareView.addTapGesture { [weak self] in + guard let self else{return} + if let postID = audioData?.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } + if let name = URL(string: "https://apps.apple.com/in/app/woka/id6465305185"), !name.absoluteString.isEmpty { let objectsToShare = [name] let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil) @@ -335,9 +353,9 @@ class AudioBookDetailsVC : UIViewController{ } @IBAction func closeBtnTapped(_ sender: UIButton) { - self.dismiss(animated: true) { - + if let postID = audioData?.id{ + PersistentStorage.shared.addAudioCount(postID: postID) } + self.dismiss(animated: true) } - } diff --git a/WOKA/Audio Books/AudioBookHomeVC.swift b/WOKA/Audio Books/AudioBookHomeVC.swift index b031bc6..c417bb4 100644 --- a/WOKA/Audio Books/AudioBookHomeVC.swift +++ b/WOKA/Audio Books/AudioBookHomeVC.swift @@ -59,6 +59,11 @@ class AudioBookHomeVC: UIViewController { // Customize the navigation bar's appearance self.navigationController?.setColor(color: .black) + + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } override func viewDidLayoutSubviews() { @@ -74,6 +79,9 @@ class AudioBookHomeVC: UIViewController { @IBAction func listenAudioBtnTapped(_ sender: LocalisedElementsButton) { guard let data = vm.headerData else{return} + if let postID = data.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } var playerItems = [JwPlayerItemCreate]() if AuthFunc.shareInstance.getDefaultLanguage() == .english{ if let englishData = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first, let url = englishData.url{ @@ -157,7 +165,7 @@ extension AudioBookHomeVC : TableViewSRC{ guard let postID = data.id ,let postType = data.contentMoreDetails?.first?.postType else{return} let isFav = data.markAsFavourite let isLiked = data.isLiked - + PersistentStorage.shared.addAudioCount(postID: postID) vm.updateFavLikes(type: type, isFav: isFav, isLiked: isLiked, postID: postID, postType: postType) } @@ -171,6 +179,11 @@ extension AudioBookHomeVC : TableViewSRC{ Updated the top header data */ vm.headerData = data + + if let postID = data.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } + vm.setHeaderData() let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil) @@ -200,7 +213,7 @@ extension AudioBookHomeVC : CollectionViewSRC{ guard let postID = data.id ,let postType = data.contentMoreDetails?.first?.postType else{return} let isFav = data.markAsFavourite let isLiked = data.isLiked - + PersistentStorage.shared.addAudioCount(postID: postID) vm.updateFavLikes(type: type, isFav: isFav, isLiked: isLiked, postID: postID, postType: postType) } return cell @@ -209,6 +222,10 @@ extension AudioBookHomeVC : CollectionViewSRC{ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let data = vm.continueWatchingData[indexPath.row] vm.headerData = data + if let postID = data.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } + vm.setHeaderData() let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil) diff --git a/WOKA/Audio Books/AudioBookHomeVM.swift b/WOKA/Audio Books/AudioBookHomeVM.swift index dfd73a1..724b17a 100644 --- a/WOKA/Audio Books/AudioBookHomeVM.swift +++ b/WOKA/Audio Books/AudioBookHomeVM.swift @@ -195,7 +195,7 @@ class AudioBookHomeVM{ audioListData[showListIndex].markAsFavourite = false vc.audioListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none) - K.GVar.reloadMyList = true + K.GVar.reloadMyListAudioBooks = true // // MyList Update // if MyListDataTemp.shareInstance.isDatafetched{ // if let indexRemove = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){ @@ -211,7 +211,7 @@ class AudioBookHomeVM{ if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){ continueWatchingData[continueWatchingIndex].markAsFavourite = false vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)]) - K.GVar.reloadMyList = true + K.GVar.reloadMyListAudioBooks = true // MyList Update // if MyListDataTemp.shareInstance.isDatafetched{ // if let indexRemove = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){ @@ -228,7 +228,7 @@ class AudioBookHomeVM{ if let showListIndex = audioListData.firstIndex(where: { $0.id == postID }){ audioListData[showListIndex].markAsFavourite = true vc.audioListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none) - K.GVar.reloadMyList = true + K.GVar.reloadMyListAudioBooks = true // MyList Update // if MyListDataTemp.shareInstance.isDatafetched{ // let audioData = audioListData[showListIndex] @@ -243,7 +243,7 @@ class AudioBookHomeVM{ if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){ continueWatchingData[continueWatchingIndex].markAsFavourite = true vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)]) - K.GVar.reloadMyList = true + K.GVar.reloadMyListAudioBooks = true // MyList Update // if MyListDataTemp.shareInstance.isDatafetched{ // if MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}) == nil{ diff --git a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard index f153f91..ba1bea6 100644 --- a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard +++ b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard @@ -1113,7 +1113,7 @@ Sent to Your Parent’s Email -