- finalised theme 2 collection clicks
- worked on homelive tv observers - addd fav remove fav for audio books will now locally update my list instead reloading - addd fav remove fav for karaoke will now locally update my list instead reloading - addd fav remove fav for games will now locally update my list instead reloading
This commit is contained in:
@@ -85,8 +85,6 @@
|
||||
526A43752C36AA4A00AE148F /* GamesListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A43742C36AA4A00AE148F /* GamesListVC.swift */; };
|
||||
5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */; };
|
||||
5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */; };
|
||||
527A2BC22C576E980080DF9B /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 527A2BC12C576E980080DF9B /* FirebaseAnalytics */; };
|
||||
527A2BC42C576E980080DF9B /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 527A2BC32C576E980080DF9B /* FirebaseCrashlytics */; };
|
||||
527A2BC62C576EAF0080DF9B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527A2BC52C576EAF0080DF9B /* GoogleService-Info.plist */; };
|
||||
527A2BC82C5777360080DF9B /* VerifyAddressPincodeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 527A2BC72C5777360080DF9B /* VerifyAddressPincodeVC.swift */; };
|
||||
527A2BCA2C57776A0080DF9B /* AddNewAddressVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 527A2BC92C57776A0080DF9B /* AddNewAddressVC.swift */; };
|
||||
@@ -207,7 +205,6 @@
|
||||
52CA28FC2BE11A0400708B49 /* UserIntrestVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */; };
|
||||
52CC38C32BDF812F00B74C3E /* LocalisedElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CC38C22BDF812F00B74C3E /* LocalisedElements.swift */; };
|
||||
52CC85542C5BABD40084030E /* WokaFMVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CC85532C5BABD40084030E /* WokaFMVM.swift */; };
|
||||
52CCD7B02C1AF0F80078BD65 /* RadioVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */; };
|
||||
52D23F112C465E6F003E743A /* LogoutPopupVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D23F102C465E6F003E743A /* LogoutPopupVC.swift */; };
|
||||
52D2F3D82C24043D009E52FF /* ShimmerEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D2F3D72C24043D009E52FF /* ShimmerEffectView.swift */; };
|
||||
52D6A2462C21A29800145908 /* ContinueWatchingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A2452C21A29800145908 /* ContinueWatchingDM.swift */; };
|
||||
@@ -288,6 +285,10 @@
|
||||
9C834ED82C1C1F9200B29A9C /* Exo2-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8312BDBC3EF00E4CA14 /* Exo2-Thin.ttf */; };
|
||||
9C834EDC2C1C26CD00B29A9C /* HtmlText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */; };
|
||||
9C8446872C40FC6E003E3E53 /* AVPlayerTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8446862C40FC6E003E3E53 /* AVPlayerTesting.swift */; };
|
||||
9C85A9EC2C5CD5CD0031C365 /* MyListDataTemp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C85A9EB2C5CD5CD0031C365 /* MyListDataTemp.swift */; };
|
||||
9C85A9EF2C5CE1060031C365 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */; };
|
||||
9C85A9F12C5CE1060031C365 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */; };
|
||||
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 */; };
|
||||
9C9BEEC72BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */; };
|
||||
@@ -552,7 +553,6 @@
|
||||
52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIntrestVM.swift; sourceTree = "<group>"; };
|
||||
52CC38C22BDF812F00B74C3E /* LocalisedElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalisedElements.swift; sourceTree = "<group>"; };
|
||||
52CC85532C5BABD40084030E /* WokaFMVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WokaFMVM.swift; sourceTree = "<group>"; };
|
||||
52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioVC.swift; sourceTree = "<group>"; };
|
||||
52D23F102C465E6F003E743A /* LogoutPopupVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutPopupVC.swift; sourceTree = "<group>"; };
|
||||
52D2F3D72C24043D009E52FF /* ShimmerEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShimmerEffectView.swift; sourceTree = "<group>"; };
|
||||
52D6A2452C21A29800145908 /* ContinueWatchingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContinueWatchingDM.swift; sourceTree = "<group>"; };
|
||||
@@ -625,6 +625,7 @@
|
||||
9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WOKA.entitlements; sourceTree = "<group>"; };
|
||||
9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HtmlText.swift; sourceTree = "<group>"; };
|
||||
9C8446862C40FC6E003E3E53 /* AVPlayerTesting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVPlayerTesting.swift; sourceTree = "<group>"; };
|
||||
9C85A9EB2C5CD5CD0031C365 /* MyListDataTemp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListDataTemp.swift; sourceTree = "<group>"; };
|
||||
9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewVC.swift; sourceTree = "<group>"; };
|
||||
9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Disclaimer.rtf; sourceTree = "<group>"; };
|
||||
9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCenteredFlowLayout.swift; sourceTree = "<group>"; };
|
||||
@@ -675,8 +676,9 @@
|
||||
files = (
|
||||
4469E533EC95AC428FE50FB2 /* Pods_WOKA.framework in Frameworks */,
|
||||
52C83E3F2C493FD700F27563 /* RSKPlaceholderTextView in Frameworks */,
|
||||
527A2BC42C576E980080DF9B /* FirebaseCrashlytics in Frameworks */,
|
||||
527A2BC22C576E980080DF9B /* FirebaseAnalytics in Frameworks */,
|
||||
9C85A9F32C5CE1060031C365 /* FirebasePerformance in Frameworks */,
|
||||
9C85A9F12C5CE1060031C365 /* FirebaseCrashlytics in Frameworks */,
|
||||
9C85A9EF2C5CE1060031C365 /* FirebaseAnalytics in Frameworks */,
|
||||
521CB1002C493DB80085BDF8 /* JWPlayerKit in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1612,7 +1614,6 @@
|
||||
52AECA7F2C08BCB6004A7579 /* PlayerVC.swift */,
|
||||
52BC3BED2C16FBDB002FACA6 /* MoreVC.swift */,
|
||||
522D655F2C1ACD8C0021E505 /* UserNotificationVC.swift */,
|
||||
52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */,
|
||||
9C834EC52C1C1D9500B29A9C /* BlogDetailsVC.swift */,
|
||||
52BFB0642C5B5B4F0038D750 /* BlogsVC.swift */,
|
||||
);
|
||||
@@ -1780,6 +1781,7 @@
|
||||
525327D32BFCC1C900F64283 /* ViewModel */,
|
||||
525327D42BFCC1CF00F64283 /* Controller */,
|
||||
9CBCB2A72BE5105A007D7934 /* Home.storyboard */,
|
||||
9C85A9EB2C5CD5CD0031C365 /* MyListDataTemp.swift */,
|
||||
);
|
||||
path = Home;
|
||||
sourceTree = "<group>";
|
||||
@@ -1863,8 +1865,9 @@
|
||||
packageProductDependencies = (
|
||||
521CB0FF2C493DB80085BDF8 /* JWPlayerKit */,
|
||||
52C83E3E2C493FD700F27563 /* RSKPlaceholderTextView */,
|
||||
527A2BC12C576E980080DF9B /* FirebaseAnalytics */,
|
||||
527A2BC32C576E980080DF9B /* FirebaseCrashlytics */,
|
||||
9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */,
|
||||
9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */,
|
||||
9C85A9F22C5CE1060031C365 /* FirebasePerformance */,
|
||||
);
|
||||
productName = WOKA;
|
||||
productReference = 523ED25A2BDA2BC700CFED02 /* WOKA.app */;
|
||||
@@ -1942,7 +1945,7 @@
|
||||
packageReferences = (
|
||||
521CB0FE2C493DB80085BDF8 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */,
|
||||
52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */,
|
||||
527A2BC02C576E980080DF9B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
|
||||
9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
|
||||
);
|
||||
productRefGroup = 523ED25B2BDA2BC700CFED02 /* Products */;
|
||||
projectDirPath = "";
|
||||
@@ -2147,7 +2150,6 @@
|
||||
5259542B2BEA292800191286 /* UserRegPostModel.swift in Sources */,
|
||||
52BFB5352C33DF8A00BAAE15 /* ListenAudioListingDM.swift in Sources */,
|
||||
52C8B0572BDA57DB003B51D0 /* Constant.swift in Sources */,
|
||||
52CCD7B02C1AF0F80078BD65 /* RadioVC.swift in Sources */,
|
||||
52AECA802C08BCB6004A7579 /* PlayerVC.swift in Sources */,
|
||||
5202AB012BDFA7900043B7BD /* EmailValidation.swift in Sources */,
|
||||
52D6A24E2C22B3AB00145908 /* WebSeriesShowListDM.swift in Sources */,
|
||||
@@ -2236,6 +2238,7 @@
|
||||
52AF71F22C36B77B00BC5972 /* GamesDetailVC.swift in Sources */,
|
||||
525861D42C4FCCB500C33C79 /* CartPaymentOptionsVM.swift in Sources */,
|
||||
52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */,
|
||||
9C85A9EC2C5CD5CD0031C365 /* MyListDataTemp.swift in Sources */,
|
||||
52A6DCB02C4E621800F63C51 /* BadgedBarButtonItem.swift in Sources */,
|
||||
52C8EC7D2C3536E5002DC35C /* ContinueAudioCell.swift in Sources */,
|
||||
525954252BE8F01600191286 /* ValueWrapper.swift in Sources */,
|
||||
@@ -2749,14 +2752,6 @@
|
||||
version = 4.19.1;
|
||||
};
|
||||
};
|
||||
527A2BC02C576E980080DF9B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 10.29.0;
|
||||
};
|
||||
};
|
||||
52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ruslanskorb/RSKPlaceholderTextView.git";
|
||||
@@ -2765,6 +2760,14 @@
|
||||
minimumVersion = 8.0.0;
|
||||
};
|
||||
};
|
||||
9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 11.0.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
@@ -2773,21 +2776,26 @@
|
||||
package = 521CB0FE2C493DB80085BDF8 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */;
|
||||
productName = JWPlayerKit;
|
||||
};
|
||||
527A2BC12C576E980080DF9B /* FirebaseAnalytics */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 527A2BC02C576E980080DF9B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseAnalytics;
|
||||
};
|
||||
527A2BC32C576E980080DF9B /* FirebaseCrashlytics */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 527A2BC02C576E980080DF9B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseCrashlytics;
|
||||
};
|
||||
52C83E3E2C493FD700F27563 /* RSKPlaceholderTextView */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */;
|
||||
productName = RSKPlaceholderTextView;
|
||||
};
|
||||
9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseAnalytics;
|
||||
};
|
||||
9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseCrashlytics;
|
||||
};
|
||||
9C85A9F22C5CE1060031C365 /* FirebasePerformance */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebasePerformance;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 523ED2522BDA2BC700CFED02 /* Project object */;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol ReloadAudioBooksFavLike{
|
||||
func updateAudioRows(id : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool? )
|
||||
}
|
||||
//protocol ReloadAudioBooksFavLike{
|
||||
// func updateAudioRows(id : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool? )
|
||||
//}
|
||||
|
||||
class AudioBookDetailsVC : UIViewController{
|
||||
|
||||
@@ -30,11 +30,12 @@ class AudioBookDetailsVC : UIViewController{
|
||||
@IBOutlet weak var outerView: UIView!
|
||||
@IBOutlet weak var contentView: UIView!
|
||||
|
||||
var delegate : ReloadAudioBooksFavLike?
|
||||
var delegate : ReloadSeriesFavLike?
|
||||
|
||||
var audioData : ListenAudioListingDM.AudioDatum?
|
||||
|
||||
var continueAudioData : ListenAudioListingDM.AudioDatum?
|
||||
var audioIndex = 0
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -69,14 +70,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.audioData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: false, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.audioData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: true, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -89,14 +90,14 @@ class AudioBookDetailsVC : UIViewController{
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.continueAudioData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: false, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.continueAudioData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .favourite, isFav: true, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -119,7 +120,7 @@ class AudioBookDetailsVC : UIViewController{
|
||||
self.audioData?.likesCount! -= 1
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .liked, isFav: nil, isLike: false, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
@@ -129,7 +130,7 @@ class AudioBookDetailsVC : UIViewController{
|
||||
self.audioData?.likesCount! += 1
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .liked, isFav: nil, isLike: true, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -145,7 +146,7 @@ class AudioBookDetailsVC : UIViewController{
|
||||
self.audioData?.likesCount! -= 1
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .liked, isFav: nil, isLike: false, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
@@ -155,7 +156,7 @@ class AudioBookDetailsVC : UIViewController{
|
||||
self.audioData?.likesCount! += 1
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateRows(index: self.audioIndex, type: .liked, isFav: nil, isLike: true, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,10 @@ class AudioBookHomeVC: UIViewController {
|
||||
|
||||
// MARK: - Delegate for reload
|
||||
|
||||
extension AudioBookHomeVC : ReloadAudioBooksFavLike{
|
||||
extension AudioBookHomeVC : ReloadSeriesFavLike{
|
||||
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) {
|
||||
|
||||
if let isFav{
|
||||
if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
vm.continueWatchingData[continueDataIndex].markAsFavourite = isFav
|
||||
@@ -127,8 +128,10 @@ extension AudioBookHomeVC : ReloadAudioBooksFavLike{
|
||||
audioListingTableView.reloadRows(at: [IndexPath(row: audioListDataIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - TableView DataSource , Delegates
|
||||
|
||||
@@ -188,12 +188,20 @@ class AudioBookHomeVM{
|
||||
case .favourite:
|
||||
guard let isFav else{return}
|
||||
if isFav == true {
|
||||
// if is fav then remove it
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: postID, postType: postType, categoryID: 0, vc: self.vc) { [unowned self] isDone in
|
||||
if isDone{
|
||||
if let showListIndex = audioListData.firstIndex(where: { $0.id == postID }){
|
||||
audioListData[showListIndex].markAsFavourite = false
|
||||
vc.audioListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if let indexRemove = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: indexRemove)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -202,6 +210,14 @@ class AudioBookHomeVM{
|
||||
if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){
|
||||
continueWatchingData[continueWatchingIndex].markAsFavourite = false
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if let indexRemove = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: indexRemove)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +227,13 @@ 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
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
let audioData = audioListData[showListIndex]
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?.append(audioData)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -220,7 +242,17 @@ class AudioBookHomeVM{
|
||||
if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){
|
||||
continueWatchingData[continueWatchingIndex].markAsFavourite = true
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}) == nil{
|
||||
let audioData = continueWatchingData[continueWatchingIndex]
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?.append(audioData)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,13 +260,13 @@ class AudioBookHomeVM{
|
||||
case .liked:
|
||||
guard let isLiked else{return}
|
||||
if isLiked{
|
||||
// Unlike
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: postID, postType: postType, vc: self.vc) { [unowned self] isDone in
|
||||
if isDone{
|
||||
if let showListIndex = audioListData.firstIndex(where: { $0.id == postID }){
|
||||
audioListData[showListIndex].isLiked = false
|
||||
audioListData[showListIndex].likesCount! -= 1
|
||||
vc.audioListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -245,16 +277,26 @@ class AudioBookHomeVM{
|
||||
continueWatchingData[continueWatchingIndex].likesCount! -= 1
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the data is in continue watching
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! -= 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//Like
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: postID, postType: postType, vc: self.vc){ [unowned self] isDone in
|
||||
if isDone{
|
||||
if let showListIndex = audioListData.firstIndex(where: { $0.id == postID }){
|
||||
audioListData[showListIndex].isLiked = true
|
||||
audioListData[showListIndex].likesCount! += 1
|
||||
vc.audioListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -265,6 +307,16 @@ class AudioBookHomeVM{
|
||||
continueWatchingData[continueWatchingIndex].likesCount! += 1
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the data is in continue watching
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! += 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,20 +39,20 @@
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="fillProportionally" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="iZA-rX-eSc" userLabel="TitleLikeFav">
|
||||
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" alignment="center" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="iZA-rX-eSc" userLabel="TitleLikeFav">
|
||||
<rect key="frame" x="10" y="166" width="345" height="35"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="asdasdasdsadsadsadsadsadsadsadsad" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tuK-jV-nee">
|
||||
<rect key="frame" x="0.0" y="7.9999999999999982" width="259.66666666666669" height="19.333333333333329"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="dsfsdfsdfsdfsdfsdfdsfdsfsdfsdfsdfsdfsdfsdfsdf" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tuK-jV-nee">
|
||||
<rect key="frame" x="0.0" y="8" width="257.66666666666669" height="19"/>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
|
||||
<color key="textColor" name="ImageDarkBlue"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="KgU-Gz-jLc">
|
||||
<rect key="frame" x="261.66666666666669" y="0.0" width="83.333333333333314" height="35"/>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="KgU-Gz-jLc">
|
||||
<rect key="frame" x="260.66666666666669" y="0.0" width="84.333333333333314" height="35"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ewL-vm-Zuj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="44.333333333333336" height="35"/>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ewL-vm-Zuj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="45.333333333333336" height="35"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jbW-4o-QTH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="35" height="35"/>
|
||||
@@ -66,16 +66,16 @@
|
||||
<action selector="btnTapped:" destination="gTV-IL-0wX" eventType="touchUpInside" id="doy-sW-YXM"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1TM-ln-NlS">
|
||||
<rect key="frame" x="35" y="0.0" width="9.3333333333333357" height="35"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1TM-ln-NlS">
|
||||
<rect key="frame" x="35" y="0.0" width="10.333333333333336" height="35"/>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
|
||||
<color key="textColor" name="ImageDarkBlue"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxM-qE-KNp">
|
||||
<rect key="frame" x="48.333333333333314" y="0.0" width="35" height="35"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxM-qE-KNp">
|
||||
<rect key="frame" x="49.333333333333314" y="0.0" width="35" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="qxM-qE-KNp" secondAttribute="height" multiplier="1:1" id="W2A-yZ-Fxg"/>
|
||||
</constraints>
|
||||
@@ -93,6 +93,7 @@
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="5FE-5M-L5v"/>
|
||||
<constraint firstItem="tuK-jV-nee" firstAttribute="top" secondItem="iZA-rX-eSc" secondAttribute="top" constant="8" id="Zim-hj-dId"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
</subviews>
|
||||
|
||||
@@ -1329,17 +1329,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"/>
|
||||
@@ -1367,10 +1367,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>
|
||||
@@ -1418,10 +1418,12 @@ Sent to Your Parent’s Email</string>
|
||||
<!--Login NavVC-->
|
||||
<scene sceneID="CN3-gS-caP">
|
||||
<objects>
|
||||
<navigationController storyboardIdentifier="LoginNavVC" automaticallyAdjustsScrollViewInsets="NO" navigationBarHidden="YES" id="bHr-RA-yCX" customClass="LoginNavVC" customModule="WOKA" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<navigationController storyboardIdentifier="LoginNavVC" automaticallyAdjustsScrollViewInsets="NO" id="bHr-RA-yCX" customClass="LoginNavVC" customModule="WOKA" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="h7h-Q6-GoK">
|
||||
<rect key="frame" x="0.0" y="59" width="430" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
@@ -1438,40 +1440,40 @@ Sent to Your Parent’s Email</string>
|
||||
<size key="intrinsicContentSize" width="8.3333333333333339" height="23.333333333333332"/>
|
||||
</designable>
|
||||
<designable name="4gw-z0-s4a">
|
||||
<size key="intrinsicContentSize" width="200.66666666666666" height="20"/>
|
||||
<size key="intrinsicContentSize" width="150.66666666666666" height="20"/>
|
||||
</designable>
|
||||
<designable name="68c-1b-KSI">
|
||||
<size key="intrinsicContentSize" width="201.66666666666666" height="21"/>
|
||||
<size key="intrinsicContentSize" width="151.66666666666666" height="21"/>
|
||||
</designable>
|
||||
<designable name="81S-Fa-CiD">
|
||||
<size key="intrinsicContentSize" width="8.3333333333333339" height="23.333333333333332"/>
|
||||
</designable>
|
||||
<designable name="DSB-Ge-wNO">
|
||||
<size key="intrinsicContentSize" width="169" height="21"/>
|
||||
<size key="intrinsicContentSize" width="118.66666666666667" height="21"/>
|
||||
</designable>
|
||||
<designable name="Hcd-Mm-IxW">
|
||||
<size key="intrinsicContentSize" width="8.3333333333333339" height="23.333333333333332"/>
|
||||
</designable>
|
||||
<designable name="JRR-Bk-5UP">
|
||||
<size key="intrinsicContentSize" width="217.66666666666666" height="20"/>
|
||||
<size key="intrinsicContentSize" width="167.66666666666666" height="20"/>
|
||||
</designable>
|
||||
<designable name="MpT-bm-drv">
|
||||
<size key="intrinsicContentSize" width="8.3333333333333339" height="23.333333333333332"/>
|
||||
</designable>
|
||||
<designable name="Skx-Ig-91N">
|
||||
<size key="intrinsicContentSize" width="199" height="20"/>
|
||||
<size key="intrinsicContentSize" width="149" height="20"/>
|
||||
</designable>
|
||||
<designable name="iJE-dm-qal">
|
||||
<size key="intrinsicContentSize" width="200.66666666666666" height="20"/>
|
||||
<size key="intrinsicContentSize" width="150.66666666666666" height="20"/>
|
||||
</designable>
|
||||
<designable name="m50-FZ-yVO">
|
||||
<size key="intrinsicContentSize" width="201.66666666666666" height="21"/>
|
||||
<size key="intrinsicContentSize" width="151.66666666666666" height="21"/>
|
||||
</designable>
|
||||
<designable name="tgW-LH-XfR">
|
||||
<size key="intrinsicContentSize" width="169.33333333333334" height="21"/>
|
||||
<size key="intrinsicContentSize" width="119.33333333333333" height="21"/>
|
||||
</designable>
|
||||
<designable name="wy2-0C-rxG">
|
||||
<size key="intrinsicContentSize" width="201.66666666666666" height="21"/>
|
||||
<size key="intrinsicContentSize" width="151.66666666666666" height="21"/>
|
||||
</designable>
|
||||
</designables>
|
||||
<resources>
|
||||
|
||||
@@ -13,6 +13,7 @@ class LoginVM{
|
||||
weak var vc : LoginVC!
|
||||
|
||||
func initView(){
|
||||
self.vc.title = ""
|
||||
vc.passwordTF.delegate = self.vc
|
||||
vc.userNameTF.delegate = self.vc
|
||||
vc.passwordTF.placeholder = "Enter your password".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
||||
|
||||
@@ -13,5 +13,7 @@ extension K{
|
||||
// static var localized = K.LocalizedEnum.english
|
||||
static var reloadMyList = false
|
||||
static var topView = TopViewEnum.theme1
|
||||
|
||||
static var myListSoftReload = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ extension K{
|
||||
static let themeOneVC = "ThemeOneVC"
|
||||
static let themeTwoVC = "ThemeTwoVC"
|
||||
static let moreVC = "MoreVC"
|
||||
static let radioVC = "RadioVC"
|
||||
static let blogDetailsVC = "BlogDetailsVC"
|
||||
static let playerVC = "PlayerVC"
|
||||
static let blogsVC = "BlogsVC"
|
||||
|
||||
@@ -23,3 +23,9 @@ enum TopViewPush{
|
||||
case blogs
|
||||
case radio
|
||||
}
|
||||
|
||||
enum Modules{
|
||||
case webSeries
|
||||
case games
|
||||
case none
|
||||
}
|
||||
|
||||
@@ -111,17 +111,25 @@ class GamesDetailVC: UIViewController {
|
||||
guard let showID = gameData.id, let isFav = gameData.markAsFavourite, let postType = gameData.contentMoreDetails?.first?.postType else{return}
|
||||
|
||||
if isFav {
|
||||
//remove
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.gameData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .favourite, isFav: false, isLike: nil)
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?.remove(at: index)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .favourite, isFav: false, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
//add
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.gameData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .favourite, isFav: true, isLike: nil)
|
||||
if let gameData = self.gameData{
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?.append(gameData)
|
||||
}
|
||||
K.GVar.myListSoftReload = true
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .favourite, isFav: true, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -137,22 +145,31 @@ class GamesDetailVC: UIViewController {
|
||||
guard let showID = gameData.id, let isLiked = gameData.isLiked, let postType = gameData.contentMoreDetails?.first?.postType else{return}
|
||||
|
||||
if isLiked{
|
||||
//unlike
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.gameData?.isLiked = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .liked, isFav: nil, isLike: false)
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1
|
||||
}
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .liked, isFav: nil, isLike: false, id: showID)
|
||||
K.GVar.myListSoftReload = true
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
//like
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.gameData?.isLiked = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .liked, isFav: nil, isLike: true)
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1
|
||||
}
|
||||
self.delegate?.updateRows(index: self.gameIndex, type: .liked, isFav: nil, isLike: true, id: showID)
|
||||
K.GVar.myListSoftReload = true
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
shareView.addTapGesture {
|
||||
|
||||
@@ -124,7 +124,7 @@ extension GamesListVC : TableViewSRC{
|
||||
|
||||
extension GamesListVC : ReloadSeriesFavLike{
|
||||
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) {
|
||||
if let isFav{
|
||||
switch isFav{
|
||||
case true:
|
||||
@@ -134,7 +134,6 @@ extension GamesListVC : ReloadSeriesFavLike{
|
||||
vm.gameData[index].markAsFavourite = false
|
||||
gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
if let isLike{
|
||||
@@ -148,7 +147,6 @@ extension GamesListVC : ReloadSeriesFavLike{
|
||||
vm.gameData[index].likesCount! -= 1
|
||||
gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,14 @@ class GamesListVM{
|
||||
if isDone{
|
||||
gameData[index].markAsFavourite = false
|
||||
vc.gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if let indexRemove = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?.remove(at: indexRemove)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -152,7 +159,13 @@ class GamesListVM{
|
||||
if isDone{
|
||||
gameData[index].markAsFavourite = true
|
||||
vc.gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
let gameData = gameData[index]
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?.append(gameData)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +178,16 @@ class GamesListVM{
|
||||
gameData[index].isLiked = false
|
||||
gameData[index].likesCount! -= 1
|
||||
vc.gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
/*
|
||||
Check if the data is in continue watching
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -174,7 +196,16 @@ class GamesListVM{
|
||||
gameData[index].isLiked = true
|
||||
gameData[index].likesCount! += 1
|
||||
vc.gamesListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
/*
|
||||
Check if the data is in continue watching
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.gameData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,14 @@ class ExploreWokaVC: UIViewController {
|
||||
}
|
||||
case liveTvBtn:
|
||||
self.dismiss(animated: true) {
|
||||
NotificationCenter.default.post(name: NSNotification.Name(K.NotificationCenterReloads.themeOnePush), object: nil, userInfo: ["action": TopViewPush.liveTV])
|
||||
switch K.GVar.topView{
|
||||
case .theme1:
|
||||
NotificationCenter.default.post(name: NSNotification.Name(K.NotificationCenterReloads.themeOnePush), object: nil, userInfo: ["action": TopViewPush.liveTV])
|
||||
case .theme2:
|
||||
NotificationCenter.default.post(name: NSNotification.Name(K.NotificationCenterReloads.themeTwoPush), object: nil, userInfo: ["action": TopViewPush.liveTV])
|
||||
case .myList:
|
||||
NotificationCenter.default.post(name: NSNotification.Name(K.NotificationCenterReloads.myListPush), object: nil, userInfo: ["action": TopViewPush.liveTV])
|
||||
}
|
||||
}
|
||||
case blogBtn:
|
||||
self.dismiss(animated: true) {
|
||||
|
||||
@@ -68,6 +68,17 @@ class MyListVC: UIViewController{
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
K.GVar.topView = .myList
|
||||
|
||||
if K.GVar.myListSoftReload{
|
||||
self.webSeriesCV.reloadData()
|
||||
self.webSeriesHindiCV.reloadData()
|
||||
self.audioBooksCV.reloadData()
|
||||
self.karaokeCV.reloadData()
|
||||
self.gamesCV.reloadData()
|
||||
self.vm.checkNil()
|
||||
K.GVar.myListSoftReload = false
|
||||
}
|
||||
|
||||
if K.GVar.reloadMyList{
|
||||
K.GVar.reloadMyList = false
|
||||
Utilities.startProgressHUD()
|
||||
@@ -95,40 +106,40 @@ extension MyListVC : CollectionViewSRC{
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
switch collectionView{
|
||||
case webSeriesCV:
|
||||
if vm.favListingData?.showData?.count == 0 || vm.favListingData == nil{
|
||||
if MyListDataTemp.shareInstance.favListingData?.showData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{
|
||||
webSeriesEnglishStack.isHidden = true
|
||||
}else{
|
||||
webSeriesEnglishStack.isHidden = false
|
||||
}
|
||||
return vm.favListingData?.showData?.count ?? 0
|
||||
return MyListDataTemp.shareInstance.favListingData?.showData?.count ?? 0
|
||||
case audioBooksCV:
|
||||
if vm.favListingData?.audioData?.count == 0 || vm.favListingData == nil{
|
||||
if MyListDataTemp.shareInstance.favListingData?.audioData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{
|
||||
audioBooksStack.isHidden = true
|
||||
}else{
|
||||
audioBooksStack.isHidden = false
|
||||
}
|
||||
return vm.favListingData?.audioData?.count ?? 0
|
||||
return MyListDataTemp.shareInstance.favListingData?.audioData?.count ?? 0
|
||||
case karaokeCV:
|
||||
if vm.favListingData?.singKaraokeData?.count == 0 || vm.favListingData == nil{
|
||||
if MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{
|
||||
karaokeStack.isHidden = true
|
||||
}else{
|
||||
karaokeStack.isHidden = false
|
||||
}
|
||||
return vm.favListingData?.singKaraokeData?.count ?? 0
|
||||
return MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.count ?? 0
|
||||
case gamesCV:
|
||||
if vm.favListingData?.gameData?.count == 0 || vm.favListingData == nil{
|
||||
if MyListDataTemp.shareInstance.favListingData?.gameData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{
|
||||
gamesStack.isHidden = true
|
||||
}else{
|
||||
gamesStack.isHidden = false
|
||||
}
|
||||
return vm.favListingData?.gameData?.count ?? 0
|
||||
return MyListDataTemp.shareInstance.favListingData?.gameData?.count ?? 0
|
||||
case webSeriesHindiCV:
|
||||
if vm.webSeriesHindi.count == 0 || vm.favListingData == nil{
|
||||
if MyListDataTemp.shareInstance.webSeriesHindi.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{
|
||||
webSeriesHindiStack.isHidden = true
|
||||
}else{
|
||||
webSeriesHindiStack.isHidden = false
|
||||
}
|
||||
return vm.webSeriesHindi.count
|
||||
return MyListDataTemp.shareInstance.webSeriesHindi.count
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
@@ -139,26 +150,26 @@ extension MyListVC : CollectionViewSRC{
|
||||
|
||||
switch collectionView{
|
||||
case webSeriesCV:
|
||||
if let data = vm.favListingData?.showData?[indexPath.row]{
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row]{
|
||||
cell.setData(data: data)
|
||||
}
|
||||
case webSeriesHindiCV:
|
||||
let data = vm.webSeriesHindi[indexPath.row]
|
||||
let data = MyListDataTemp.shareInstance.webSeriesHindi[indexPath.row]
|
||||
cell.setData(data: data)
|
||||
case audioBooksCV:
|
||||
if let data = vm.favListingData?.audioData?[indexPath.row]{
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.audioData?[indexPath.row]{
|
||||
cell.setAudioData(data: data)
|
||||
}
|
||||
case karaokeCV:
|
||||
if let data = vm.favListingData?.singKaraokeData?[indexPath.row]{
|
||||
cell.setOtherData(data: data)
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[indexPath.row]{
|
||||
cell.setKaraokeData(data: data)
|
||||
}
|
||||
case gamesCV:
|
||||
if let data = vm.favListingData?.gameData?[indexPath.row]{
|
||||
cell.setOtherData(data: data)
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.gameData?[indexPath.row]{
|
||||
cell.setGameData(data: data)
|
||||
}
|
||||
default:
|
||||
if let data = vm.favListingData?.showData?[indexPath.row]{
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row]{
|
||||
cell.setData(data: data)
|
||||
}
|
||||
}
|
||||
@@ -170,17 +181,18 @@ extension MyListVC : CollectionViewSRC{
|
||||
return cell
|
||||
}
|
||||
|
||||
// Updates from Cell Clicks
|
||||
func updateFavLikes(cv : UICollectionView , type : FavCellCLick, index : Int){
|
||||
switch cv{
|
||||
case webSeriesCV:
|
||||
guard let data = vm.favListingData?.showData?[index] else{return}
|
||||
guard let data = MyListDataTemp.shareInstance.favListingData?.showData?[index] else{return}
|
||||
switch type {
|
||||
case .favourite:
|
||||
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.bookmarkCategoryIDS else{return}
|
||||
if isFav{
|
||||
vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.showData?.remove(at: index)
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?.remove(at: index)
|
||||
webSeriesCV.reloadData()
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -191,14 +203,14 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isLiked{
|
||||
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.showData?[index].isLiked = false
|
||||
vm.favListingData?.showData?[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
|
||||
for (i,element) in vm.webSeriesHindi.enumerated(){
|
||||
if element.id == vm.favListingData?.showData?[index].id{
|
||||
vm.webSeriesHindi[i].isLiked = false
|
||||
vm.webSeriesHindi[i].likesCount! -= 1
|
||||
for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){
|
||||
if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
@@ -207,14 +219,14 @@ extension MyListVC : CollectionViewSRC{
|
||||
}else{
|
||||
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.showData?[index].isLiked = true
|
||||
vm.favListingData?.showData?[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
|
||||
for (i,element) in vm.webSeriesHindi.enumerated(){
|
||||
if element.id == vm.favListingData?.showData?[index].id{
|
||||
vm.webSeriesHindi[i].isLiked = true
|
||||
vm.webSeriesHindi[i].likesCount! += 1
|
||||
for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){
|
||||
if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
@@ -223,14 +235,14 @@ extension MyListVC : CollectionViewSRC{
|
||||
}
|
||||
}
|
||||
case webSeriesHindiCV:
|
||||
let data = vm.webSeriesHindi[index]
|
||||
let data = MyListDataTemp.shareInstance.webSeriesHindi[index]
|
||||
switch type {
|
||||
case .favourite:
|
||||
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.bookmarkCategoryIDS else{return}
|
||||
if isFav{
|
||||
vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.webSeriesHindi.remove(at: index)
|
||||
MyListDataTemp.shareInstance.webSeriesHindi.remove(at: index)
|
||||
webSeriesHindiCV.reloadData()
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -241,17 +253,17 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isLiked{
|
||||
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.webSeriesHindi[index].isLiked = false
|
||||
vm.webSeriesHindi[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
|
||||
guard let showData = vm.favListingData?.showData else{return}
|
||||
guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return}
|
||||
|
||||
for (i,element) in showData.enumerated(){
|
||||
if element.id == vm.webSeriesHindi[index].id{
|
||||
vm.favListingData?.showData?[i].isLiked = false
|
||||
vm.favListingData?.showData?[i].likesCount! -= 1
|
||||
if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
@@ -261,17 +273,17 @@ extension MyListVC : CollectionViewSRC{
|
||||
}else{
|
||||
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.webSeriesHindi[index].isLiked = true
|
||||
vm.webSeriesHindi[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
|
||||
guard let showData = vm.favListingData?.showData else{return}
|
||||
guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return}
|
||||
|
||||
for (i,element) in showData.enumerated(){
|
||||
if element.id == vm.webSeriesHindi[index].id{
|
||||
vm.favListingData?.showData?[i].isLiked = true
|
||||
vm.favListingData?.showData?[i].likesCount! += 1
|
||||
if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
@@ -280,14 +292,14 @@ extension MyListVC : CollectionViewSRC{
|
||||
}
|
||||
}
|
||||
case audioBooksCV:
|
||||
guard let data = vm.favListingData?.audioData?[index] else{return}
|
||||
guard let data = MyListDataTemp.shareInstance.favListingData?.audioData?[index] else{return}
|
||||
switch type {
|
||||
case .favourite:
|
||||
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
|
||||
if isFav{
|
||||
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.audioData?.remove(at: index)
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: index)
|
||||
audioBooksCV.reloadData()
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -298,8 +310,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isLiked{
|
||||
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.audioData?[index].isLiked = false
|
||||
vm.favListingData?.audioData?[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! -= 1
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -307,8 +319,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
}else{
|
||||
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.audioData?[index].isLiked = true
|
||||
vm.favListingData?.audioData?[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! += 1
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -316,7 +328,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
}
|
||||
}
|
||||
case karaokeCV:
|
||||
guard let data = vm.favListingData?.singKaraokeData?[index] else{return}
|
||||
guard let data = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index] else{return}
|
||||
|
||||
switch type {
|
||||
case .favourite:
|
||||
@@ -324,7 +336,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isFav{
|
||||
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.singKaraokeData?.remove(at: index)
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: index)
|
||||
karaokeCV.reloadData()
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -335,8 +347,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isLiked{
|
||||
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.singKaraokeData?[index].isLiked = false
|
||||
vm.favListingData?.singKaraokeData?[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1
|
||||
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -344,8 +356,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
}else{
|
||||
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.singKaraokeData?[index].isLiked = true
|
||||
vm.favListingData?.singKaraokeData?[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1
|
||||
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -353,7 +365,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
}
|
||||
}
|
||||
case gamesCV:
|
||||
guard let data = vm.favListingData?.gameData?[index] else{return}
|
||||
guard let data = MyListDataTemp.shareInstance.favListingData?.gameData?[index] else{return}
|
||||
|
||||
switch type {
|
||||
case .favourite:
|
||||
@@ -361,7 +373,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isFav{
|
||||
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.gameData?.remove(at: index)
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?.remove(at: index)
|
||||
gamesCV.reloadData()
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -372,8 +384,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
if isLiked{
|
||||
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.gameData?[index].isLiked = false
|
||||
vm.favListingData?.gameData?[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1
|
||||
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -381,8 +393,8 @@ extension MyListVC : CollectionViewSRC{
|
||||
}else{
|
||||
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.gameData?[index].isLiked = true
|
||||
vm.favListingData?.gameData?[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1
|
||||
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
}
|
||||
@@ -392,13 +404,12 @@ extension MyListVC : CollectionViewSRC{
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
switch collectionView{
|
||||
case webSeriesCV:
|
||||
guard let showData = vm.favListingData?.showData?[indexPath.row] else{return}
|
||||
guard let showData = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row] else{return}
|
||||
let showDataModified = WebSeriesShowListDM.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: nil, ageRangeMasterID: nil, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, seasonData: nil, categoryData: nil, ageRangeData: nil, genderData: nil, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likedCategoryIDS: nil, favouriteCategoryIDS: ValueWrapper.stringValue(showData.bookmarkCategoryIDS ?? "1") , likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount)
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
@@ -410,7 +421,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
self.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.vm.selectedCollection = .webSeriesCV
|
||||
case webSeriesHindiCV:
|
||||
let showData = vm.webSeriesHindi[indexPath.row]
|
||||
let showData = MyListDataTemp.shareInstance.webSeriesHindi[indexPath.row]
|
||||
let showDataModified = WebSeriesShowListDM.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: nil, ageRangeMasterID: nil, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, seasonData: nil, categoryData: nil, ageRangeData: nil, genderData: nil, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likedCategoryIDS: nil, favouriteCategoryIDS: ValueWrapper.stringValue(showData.bookmarkCategoryIDS ?? "1") , likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount)
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
@@ -422,7 +433,7 @@ extension MyListVC : CollectionViewSRC{
|
||||
self.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.vm.selectedCollection = .webSeriesHindiCV
|
||||
case audioBooksCV:
|
||||
guard let audioData = vm.favListingData?.audioData?[indexPath.row] else{return}
|
||||
guard let audioData = MyListDataTemp.shareInstance.favListingData?.audioData?[indexPath.row] else{return}
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC
|
||||
@@ -430,6 +441,31 @@ extension MyListVC : CollectionViewSRC{
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vcPush.audioData = audioData
|
||||
vcPush.delegate = self
|
||||
self.vm.selectedCollection = .audioBooksCV
|
||||
self.present(vcPush, animated: true)
|
||||
case karaokeCV:
|
||||
guard let karaokeData = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[indexPath.row] else{return}
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeDetailsVC) as! KaraokeDetailsVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vcPush.karaokeData = karaokeData
|
||||
vcPush.karaokeIndex = indexPath.row
|
||||
vcPush.delegate = self
|
||||
self.vm.selectedCollection = .karaokeCV
|
||||
self.present(vcPush, animated: true)
|
||||
case gamesCV:
|
||||
guard let gameData = MyListDataTemp.shareInstance.favListingData?.gameData?[indexPath.row] else{return}
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesDetailVC) as! GamesDetailVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vcPush.gameData = gameData
|
||||
vcPush.gameIndex = indexPath.row
|
||||
vcPush.delegate = self
|
||||
self.vm.selectedCollection = .gamesCV
|
||||
self.present(vcPush, animated: true)
|
||||
default:
|
||||
print(indexPath.row)
|
||||
@@ -439,72 +475,65 @@ extension MyListVC : CollectionViewSRC{
|
||||
}
|
||||
// MARK: - Delegate for reload
|
||||
|
||||
extension MyListVC : ReloadAudioBooksFavLike{
|
||||
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
if let isFav{
|
||||
|
||||
if let audioListDataIndex = vm.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
vm.favListingData?.audioData?[audioListDataIndex].markAsFavourite = isFav
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
|
||||
if let isLike{
|
||||
|
||||
if let audioListDataIndex = vm.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
vm.favListingData?.audioData?[audioListDataIndex].isLiked = isLike
|
||||
audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//extension MyListVC : ReloadAudioBooksFavLike{
|
||||
//
|
||||
// func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
//
|
||||
// switch vm.selectedCollection {
|
||||
// case .karaokeCV:
|
||||
// break
|
||||
// default:
|
||||
// if let isFav{
|
||||
//
|
||||
// if let audioListDataIndex = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
// MyListDataTemp.shareInstance.favListingData?.audioData?[audioListDataIndex].markAsFavourite = isFav
|
||||
// audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
// K.GVar.reloadMyList = true
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if let isLike{
|
||||
//
|
||||
// if let audioListDataIndex = MyListDataTemp.shareInstance.favListingData?.audioData?.firstIndex(where:{$0.id == id}) {
|
||||
// MyListDataTemp.shareInstance.favListingData?.audioData?[audioListDataIndex].isLiked = isLike
|
||||
// audioBooksCV.reloadItems(at: [IndexPath(row: audioListDataIndex, section: 0)])
|
||||
// K.GVar.reloadMyList = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
extension MyListVC : ReloadSeriesFavLike{
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
|
||||
//Updates from details
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) {
|
||||
switch vm.selectedCollection {
|
||||
case .webSeriesCV:
|
||||
// if let isFav{
|
||||
// let categoryID = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id ?? 0
|
||||
// switch isFav{
|
||||
// case true:
|
||||
// vm.showData[index].markAsFavourite = true
|
||||
// vm.showData[index].favouriteCategoryIDS = ValueWrapper.stringValue(categoryID.toString())
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// case false:
|
||||
// vm.showData[index].markAsFavourite = false
|
||||
// vm.showData[index].favouriteCategoryIDS = ValueWrapper.stringValue("")
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// }
|
||||
// K.GVar.reloadMyList = true
|
||||
// }
|
||||
|
||||
if let isLike{
|
||||
switch isLike{
|
||||
case true:
|
||||
vm.favListingData?.showData?[index].isLiked = true
|
||||
vm.favListingData?.showData?[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
|
||||
for (i,element) in vm.webSeriesHindi.enumerated(){
|
||||
if element.id == vm.favListingData?.showData?[index].id{
|
||||
vm.webSeriesHindi[i].isLiked = true
|
||||
vm.webSeriesHindi[i].likesCount! += 1
|
||||
for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){
|
||||
if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
case false:
|
||||
vm.favListingData?.showData?[index].isLiked = false
|
||||
vm.favListingData?.showData?[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
|
||||
for (i,element) in vm.webSeriesHindi.enumerated(){
|
||||
if element.id == vm.favListingData?.showData?[index].id{
|
||||
vm.webSeriesHindi[i].isLiked = false
|
||||
vm.webSeriesHindi[i].likesCount! -= 1
|
||||
for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){
|
||||
if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
@@ -514,149 +543,92 @@ extension MyListVC : ReloadSeriesFavLike{
|
||||
if let isLike{
|
||||
switch isLike{
|
||||
case true:
|
||||
vm.webSeriesHindi[index].isLiked = true
|
||||
vm.webSeriesHindi[index].likesCount! += 1
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
|
||||
guard let showData = vm.favListingData?.showData else{return}
|
||||
guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return}
|
||||
|
||||
for (i,element) in showData.enumerated(){
|
||||
if element.id == vm.webSeriesHindi[index].id{
|
||||
vm.favListingData?.showData?[i].isLiked = true
|
||||
vm.favListingData?.showData?[i].likesCount! += 1
|
||||
if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
case false:
|
||||
vm.webSeriesHindi[index].isLiked = false
|
||||
vm.webSeriesHindi[index].likesCount! -= 1
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
vm.checkNil()
|
||||
|
||||
guard let showData = vm.favListingData?.showData else{return}
|
||||
guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return}
|
||||
|
||||
for (i,element) in showData.enumerated(){
|
||||
if element.id == vm.webSeriesHindi[index].id{
|
||||
vm.favListingData?.showData?[i].isLiked = false
|
||||
vm.favListingData?.showData?[i].likesCount! -= 1
|
||||
if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)])
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
case .gamesCV:
|
||||
if let isLike{
|
||||
switch isLike{
|
||||
case true:
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1
|
||||
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
case false:
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1
|
||||
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
}
|
||||
}
|
||||
|
||||
if let isFav{
|
||||
switch isFav{
|
||||
case true:
|
||||
self.gamesCV.reloadData()
|
||||
self.vm.checkNil()
|
||||
case false:
|
||||
self.gamesCV.reloadData()
|
||||
self.vm.checkNil()
|
||||
}
|
||||
}
|
||||
|
||||
case .karaokeCV:
|
||||
if let isLike{
|
||||
switch isLike{
|
||||
case true:
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1
|
||||
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
case false:
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1
|
||||
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
}
|
||||
}
|
||||
|
||||
if let isFav{
|
||||
switch isFav{
|
||||
case true:
|
||||
self.karaokeCV.reloadData()
|
||||
self.vm.checkNil()
|
||||
case false:
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: index)
|
||||
self.karaokeCV.reloadData()
|
||||
self.vm.checkNil()
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
// print(index , type , isFav, isLike)
|
||||
}
|
||||
|
||||
|
||||
|
||||
func updateFavLikes(type : FavCellCLick, index : Int){
|
||||
switch vm.selectedCollection {
|
||||
case .webSeriesCV:
|
||||
guard let data = vm.favListingData?.showData?[index] else{return}
|
||||
let categoryID = 1
|
||||
switch type {
|
||||
case .favourite:
|
||||
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
|
||||
if let categoryIds = data.bookmarkCategoryIDS {
|
||||
let components = categoryIds.components(separatedBy: ",")
|
||||
if isFav == true && (components.first == categoryID.toString() || components.last == categoryID.toString()){
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, vc: self) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.favListingData?.showData?.remove(at: index)
|
||||
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
case .liked:
|
||||
break
|
||||
// guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
|
||||
// if isLiked{
|
||||
// LikeFavCommonFunc.shareInstance.unlikePost(postID: postID, postType: postType, index: index, vc: self) { [unowned self] isDone in
|
||||
// if isDone{
|
||||
// vm.showData[index].isLiked = false
|
||||
// vm.showData[index].likesCount! -= 1
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// LikeFavCommonFunc.shareInstance.likePost(postID: postID, postType: postType, index: index, vc: self){ [unowned self] isDone in
|
||||
// if isDone{
|
||||
// vm.showData[index].isLiked = true
|
||||
// vm.showData[index].likesCount! += 1
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
case .webSeriesHindiCV:
|
||||
let data = vm.webSeriesHindi[index]
|
||||
let categoryID = 18
|
||||
switch type {
|
||||
case .favourite:
|
||||
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
|
||||
if let categoryIds = data.bookmarkCategoryIDS {
|
||||
let components = categoryIds.components(separatedBy: ",")
|
||||
if isFav == true && (components.first == categoryID.toString() || components.last == categoryID.toString()){
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, vc: self) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.webSeriesHindi.remove(at: index)
|
||||
// vm.webSeriesHindi[index].markAsFavourite = false
|
||||
// vm.webSeriesHindi[index].bookmarkCategoryIDS = ""
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
}
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: postID, postType: postType, categoryID: categoryID, vc: self) { [unowned self] isDone in
|
||||
if isDone{
|
||||
vm.webSeriesHindi[index].markAsFavourite = false
|
||||
vm.webSeriesHindi[index].bookmarkCategoryIDS = categoryID.toString()
|
||||
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
case .liked:
|
||||
break
|
||||
// guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
|
||||
// if isLiked{
|
||||
// LikeFavCommonFunc.shareInstance.unlikePost(postID: postID, postType: postType, index: index, vc: self) { [unowned self] isDone in
|
||||
// if isDone{
|
||||
// vm.showData[index].isLiked = false
|
||||
// vm.showData[index].likesCount! -= 1
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// LikeFavCommonFunc.shareInstance.likePost(postID: postID, postType: postType, index: index, vc: self){ [unowned self] isDone in
|
||||
// if isDone{
|
||||
// vm.showData[index].isLiked = true
|
||||
// vm.showData[index].likesCount! += 1
|
||||
// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
case .audioBooksCV:
|
||||
break
|
||||
case .karaokeCV:
|
||||
break
|
||||
case .gamesCV:
|
||||
break
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ struct FavouriteListingDM: Codable {
|
||||
struct ResultData: Codable {
|
||||
var showData: [ShowDatum]?
|
||||
var videoData: [Datum]?
|
||||
var gameData, singKaraokeData: [Datum]?
|
||||
var gameData: [GamesListDM.GameDatum]?
|
||||
var singKaraokeData : [KaraokeListingDM.KaraokeDatum]?
|
||||
var audioData : [ListenAudioListingDM.AudioDatum]?
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case showData = "show_data"
|
||||
|
||||
19
WOKA/Home/MyListDataTemp.swift
Normal file
19
WOKA/Home/MyListDataTemp.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MyListDataTemp.swift
|
||||
// WOKA
|
||||
//
|
||||
// Created by Bilal on 02/08/2024.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class MyListDataTemp{
|
||||
|
||||
static let shareInstance = MyListDataTemp()
|
||||
|
||||
var favListingData : FavouriteListingDM.ResultData?
|
||||
|
||||
var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]()
|
||||
|
||||
var isDatafetched = false
|
||||
}
|
||||
@@ -103,6 +103,68 @@ class FavouriteCell: UICollectionViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
func setGameData(data : GamesListDM.GameDatum){
|
||||
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
|
||||
}else{
|
||||
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
|
||||
}
|
||||
totalLikes.text = data.likesCount?.toString() ?? "0"
|
||||
if let url = data.thumbnailPath{
|
||||
cellImage.imageURL(url)
|
||||
}
|
||||
|
||||
if let favourite = data.markAsFavourite{
|
||||
switch favourite{
|
||||
case true:
|
||||
favBtnn.setImage(UIImage(named: "FavouriteAdd"), for: .normal)
|
||||
case false:
|
||||
favBtnn.setImage(UIImage(named: "FavouriteRemove"), for: .normal)
|
||||
}
|
||||
}
|
||||
|
||||
if let like = data.isLiked{
|
||||
switch like{
|
||||
case true:
|
||||
likeBtn.setImage(UIImage(named: "LikeAdd"), for: .normal)
|
||||
case false:
|
||||
likeBtn.setImage(UIImage(named: "LikeRemove"), for: .normal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setKaraokeData(data : KaraokeListingDM.KaraokeDatum){
|
||||
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
|
||||
}else{
|
||||
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
|
||||
}
|
||||
totalLikes.text = data.likesCount?.toString() ?? "0"
|
||||
if let url = data.thumbnailPath{
|
||||
cellImage.imageURL(url)
|
||||
}
|
||||
|
||||
if let favourite = data.markAsFavourite{
|
||||
switch favourite{
|
||||
case true:
|
||||
favBtnn.setImage(UIImage(named: "FavouriteAdd"), for: .normal)
|
||||
case false:
|
||||
favBtnn.setImage(UIImage(named: "FavouriteRemove"), for: .normal)
|
||||
}
|
||||
}
|
||||
|
||||
if let like = data.isLiked{
|
||||
switch like{
|
||||
case true:
|
||||
likeBtn.setImage(UIImage(named: "LikeAdd"), for: .normal)
|
||||
case false:
|
||||
likeBtn.setImage(UIImage(named: "LikeRemove"), for: .normal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setAudioData(data : ListenAudioListingDM.AudioDatum){
|
||||
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
|
||||
@@ -18,10 +18,7 @@ enum CollectionSelectionMyList{
|
||||
|
||||
class MyListVM{
|
||||
weak var vc : MyListVC!
|
||||
var favListingData : FavouriteListingDM.ResultData?
|
||||
|
||||
var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]()
|
||||
|
||||
|
||||
let refreshControl = UIRefreshControl()
|
||||
let feedbackGenerator = UIImpactFeedbackGenerator(style: .light)
|
||||
|
||||
@@ -131,26 +128,26 @@ class MyListVM{
|
||||
self.refreshControl.endRefreshing()
|
||||
Utilities.dismissProgressHUD()
|
||||
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
||||
webSeriesHindi.removeAll()
|
||||
favListingData = nil
|
||||
MyListDataTemp.shareInstance.webSeriesHindi.removeAll()
|
||||
MyListDataTemp.shareInstance.favListingData = nil
|
||||
reloadCollections()
|
||||
checkNil()
|
||||
case 1:
|
||||
self.refreshControl.endRefreshing()
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.result else{return}
|
||||
favListingData = nil
|
||||
webSeriesHindi.removeAll()
|
||||
MyListDataTemp.shareInstance.favListingData = nil
|
||||
MyListDataTemp.shareInstance.webSeriesHindi.removeAll()
|
||||
|
||||
favListingData = data
|
||||
MyListDataTemp.shareInstance.favListingData = data
|
||||
|
||||
if var hindiData = favListingData?.showData{
|
||||
if var hindiData = MyListDataTemp.shareInstance.favListingData?.showData{
|
||||
|
||||
/*
|
||||
Taking out the hindi series , 1-> English , 18-> Hindi
|
||||
And the saving it to hindi series, also modify the bookmark category ids
|
||||
*/
|
||||
webSeriesHindi = hindiData.compactMap { $0 }.filter {
|
||||
MyListDataTemp.shareInstance.webSeriesHindi = hindiData.compactMap { $0 }.filter {
|
||||
($0.bookmarkCategoryIDS?.components(separatedBy: ",").first == "18" || $0.bookmarkCategoryIDS?.components(separatedBy: ",").last == "18")
|
||||
}.map { element -> FavouriteListingDM.ResultData.ShowDatum in
|
||||
var modifiedElement = element
|
||||
@@ -158,7 +155,7 @@ class MyListVM{
|
||||
return modifiedElement
|
||||
}
|
||||
|
||||
if let data = favListingData?.showData{
|
||||
if let data = MyListDataTemp.shareInstance.favListingData?.showData{
|
||||
var indicesToRemove = [Int]()
|
||||
|
||||
// Deleting the hindi series from main (those with category ID "18")
|
||||
@@ -185,7 +182,10 @@ class MyListVM{
|
||||
|
||||
|
||||
// Updating the showData with the filtered list
|
||||
favListingData?.showData = hindiData
|
||||
MyListDataTemp.shareInstance.favListingData?.showData = hindiData
|
||||
|
||||
// make this true if mylist is loaded once
|
||||
MyListDataTemp.shareInstance.isDatafetched = true
|
||||
}
|
||||
reloadCollections()
|
||||
feedbackGenerator.impactOccurred()
|
||||
@@ -307,11 +307,11 @@ class MyListVM{
|
||||
}
|
||||
|
||||
func checkNil(){
|
||||
guard let data = favListingData else{
|
||||
guard let data = MyListDataTemp.shareInstance.favListingData else{
|
||||
self.vc.noDataStack.isHidden = false
|
||||
return
|
||||
}
|
||||
if data.showData?.count == 0 && data.singKaraokeData?.count == 0 && data.gameData?.count == 0 && data.audioData?.count == 0 && webSeriesHindi.count == 0{
|
||||
if data.showData?.count == 0 && data.singKaraokeData?.count == 0 && data.gameData?.count == 0 && data.audioData?.count == 0 && MyListDataTemp.shareInstance.webSeriesHindi.count == 0{
|
||||
self.vc.noDataStack.isHidden = false
|
||||
}else{
|
||||
self.vc.noDataStack.isHidden = true
|
||||
|
||||
@@ -31,7 +31,11 @@ class KaraokeDetailsVC: UIViewController {
|
||||
@IBOutlet weak var contentView: UIView!
|
||||
|
||||
var karaokeData : KaraokeListingDM.KaraokeDatum?
|
||||
var delegate : ReloadAudioBooksFavLike?
|
||||
// var delegate : ReloadAudioBooksFavLike?
|
||||
|
||||
var delegate : ReloadSeriesFavLike?
|
||||
|
||||
var karaokeIndex = 0
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -125,15 +129,32 @@ class KaraokeDetailsVC: UIViewController {
|
||||
if isFav {
|
||||
LikeFavCommonFunc.shareInstance.removeFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.karaokeData?.markAsFavourite = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: index)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
|
||||
//if coming from audio list
|
||||
// self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: false, isLike: nil)
|
||||
|
||||
//if coming from mylist
|
||||
self.delegate?.updateRows(index: self.karaokeIndex, type: .favourite, isFav: false, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.addFavourite(postID: showID, postType: postType, categoryID: 0, vc: self) { isDone in
|
||||
self.karaokeData?.markAsFavourite = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
|
||||
if let karaokeData = self.karaokeData{
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.append(karaokeData)
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
//if coming from audio list
|
||||
// self.delegate?.updateAudioRows(id: showID, type: .favourite, isFav: true, isLike: nil)
|
||||
|
||||
//if coming from mylist
|
||||
self.delegate?.updateRows(index: self.karaokeIndex, type: .favourite, isFav: true, isLike: nil, id: showID)
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
@@ -151,15 +172,30 @@ class KaraokeDetailsVC: UIViewController {
|
||||
if isLiked{
|
||||
LikeFavCommonFunc.shareInstance.unlikePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.karaokeData?.isLiked = false
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
|
||||
// self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: false)
|
||||
self.delegate?.updateRows(index: self.karaokeIndex, type: .favourite, isFav: nil, isLike: false, id: showID)
|
||||
|
||||
self.initView()
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self) { isDone in
|
||||
self.karaokeData?.isLiked = true
|
||||
K.GVar.reloadMyList = true
|
||||
self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == showID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1
|
||||
K.GVar.myListSoftReload = true
|
||||
}
|
||||
|
||||
// self.delegate?.updateAudioRows(id: showID, type: .liked, isFav: nil, isLike: true)
|
||||
self.delegate?.updateRows(index: self.karaokeIndex, type: .favourite, isFav: nil, isLike: true, id: showID)
|
||||
|
||||
self.initView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,8 +187,10 @@ extension KaraokeListingVC : TableViewSRC{
|
||||
}
|
||||
}
|
||||
|
||||
extension KaraokeListingVC : ReloadAudioBooksFavLike{
|
||||
func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
extension KaraokeListingVC : ReloadSeriesFavLike{
|
||||
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool? , id : Int?) {
|
||||
guard let id else{return}
|
||||
if let isFav{
|
||||
if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
vm.continueWatchingData[continueDataIndex].markAsFavourite = isFav
|
||||
@@ -198,7 +200,6 @@ extension KaraokeListingVC : ReloadAudioBooksFavLike{
|
||||
if let audioListDataIndex = vm.karaokeListData.firstIndex(where:{$0.id == id}) {
|
||||
vm.karaokeListData[audioListDataIndex].markAsFavourite = isFav
|
||||
karaokeListingTableView.reloadRows(at: [IndexPath(row: audioListDataIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,11 +212,36 @@ extension KaraokeListingVC : ReloadAudioBooksFavLike{
|
||||
if let audioListDataIndex = vm.karaokeListData.firstIndex(where:{$0.id == id}) {
|
||||
vm.karaokeListData[audioListDataIndex].isLiked = isLike
|
||||
karaokeListingTableView.reloadRows(at: [IndexPath(row: audioListDataIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// func updateAudioRows(id: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
// if let isFav{
|
||||
// if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
// vm.continueWatchingData[continueDataIndex].markAsFavourite = isFav
|
||||
// continueWatchingCV.reloadItems(at: [IndexPath(row: continueDataIndex, section: 0)])
|
||||
// }
|
||||
//
|
||||
// if let audioListDataIndex = vm.karaokeListData.firstIndex(where:{$0.id == id}) {
|
||||
// vm.karaokeListData[audioListDataIndex].markAsFavourite = isFav
|
||||
// karaokeListingTableView.reloadRows(at: [IndexPath(row: audioListDataIndex, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if let isLike{
|
||||
// if let continueDataIndex = vm.continueWatchingData.firstIndex(where:{$0.id == id}) {
|
||||
// vm.continueWatchingData[continueDataIndex].isLiked = isLike
|
||||
// continueWatchingCV.reloadItems(at: [IndexPath(row: continueDataIndex, section: 0)])
|
||||
// }
|
||||
//
|
||||
// if let audioListDataIndex = vm.karaokeListData.firstIndex(where:{$0.id == id}) {
|
||||
// vm.karaokeListData[audioListDataIndex].isLiked = isLike
|
||||
// karaokeListingTableView.reloadRows(at: [IndexPath(row: audioListDataIndex, section: 0)],with: .none)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// MARK: - Animating scrollView
|
||||
|
||||
@@ -190,7 +190,15 @@ class KaraokeListingVM{
|
||||
if let showListIndex = karaokeListData.firstIndex(where: { $0.id == postID }){
|
||||
karaokeListData[showListIndex].markAsFavourite = false
|
||||
vc.karaokeListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if let indexRemove = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: indexRemove)
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -199,6 +207,15 @@ class KaraokeListingVM{
|
||||
if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){
|
||||
continueWatchingData[continueWatchingIndex].markAsFavourite = false
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
if let indexRemove = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: indexRemove)
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +225,13 @@ class KaraokeListingVM{
|
||||
if let showListIndex = karaokeListData.firstIndex(where: { $0.id == postID }){
|
||||
karaokeListData[showListIndex].markAsFavourite = true
|
||||
vc.karaokeListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
let karaokeData = karaokeListData[showListIndex]
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.append(karaokeData)
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -217,6 +240,17 @@ class KaraokeListingVM{
|
||||
if let continueWatchingIndex = continueWatchingData.firstIndex(where: { $0.id == postID }){
|
||||
continueWatchingData[continueWatchingIndex].markAsFavourite = true
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
|
||||
// MyList Update
|
||||
if MyListDataTemp.shareInstance.isDatafetched{
|
||||
// if data is updated for main list this ill not work
|
||||
if MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == postID}) == nil{
|
||||
let audioData = continueWatchingData[continueWatchingIndex]
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.append(audioData)
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +265,6 @@ class KaraokeListingVM{
|
||||
karaokeListData[showListIndex].isLiked = false
|
||||
karaokeListData[showListIndex].likesCount! -= 1
|
||||
vc.karaokeListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -242,6 +275,17 @@ class KaraokeListingVM{
|
||||
continueWatchingData[continueWatchingIndex].likesCount! -= 1
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the data is in karaoke
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -251,7 +295,6 @@ class KaraokeListingVM{
|
||||
karaokeListData[showListIndex].isLiked = true
|
||||
karaokeListData[showListIndex].likesCount! += 1
|
||||
vc.karaokeListingTableView.reloadRows(at: [IndexPath(row: showListIndex, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -262,6 +305,17 @@ class KaraokeListingVM{
|
||||
continueWatchingData[continueWatchingIndex].likesCount! += 1
|
||||
vc.continueWatchingCV.reloadItems(at: [IndexPath(row: continueWatchingIndex, section: 0)])
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the data is in karaoke
|
||||
*/
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,12 @@ class NetworkReachibility{
|
||||
static let shared = NetworkReachibility()
|
||||
private init(){}
|
||||
let manager = NetworkReachabilityManager(host: "www.apple.com")
|
||||
var isMonitoring = false
|
||||
fileprivate var isInternetReachable = false
|
||||
|
||||
func startMonitoring(onCompletion : @escaping (Bool) -> Void) {
|
||||
manager?.startListening(onQueue: DispatchQueue.main, onUpdatePerforming: { (status) in
|
||||
self.isMonitoring = true
|
||||
switch status {
|
||||
case .notReachable:
|
||||
print("network connection status - lost")
|
||||
@@ -38,6 +40,7 @@ class NetworkReachibility{
|
||||
}
|
||||
|
||||
func stopMonitoring(){
|
||||
self.isMonitoring = false
|
||||
manager?.stopListening()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Image references" minToolsVersion="12.0"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
@@ -155,11 +154,15 @@
|
||||
</imageView>
|
||||
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="edI-4n-4AY">
|
||||
<rect key="frame" x="14.333333333333329" y="58.333333333333336" width="167" height="114.33333333333331"/>
|
||||
<color key="backgroundColor" systemColor="systemGreenColor"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LiveTVBorder" translatesAutoresizingMaskIntoConstraints="NO" id="FTD-lO-6ko">
|
||||
<rect key="frame" x="0.0" y="20" width="195.66666666666666" height="160.66666666666666"/>
|
||||
</imageView>
|
||||
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="large" translatesAutoresizingMaskIntoConstraints="NO" id="hei-Wl-o3h">
|
||||
<rect key="frame" x="79.333333333333329" y="97" width="37" height="37"/>
|
||||
<color key="color" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
@@ -173,7 +176,9 @@
|
||||
<constraint firstItem="edI-4n-4AY" firstAttribute="centerX" secondItem="kzE-UE-7KK" secondAttribute="centerX" id="elb-rG-Jom"/>
|
||||
<constraint firstAttribute="bottom" secondItem="FTD-lO-6ko" secondAttribute="bottom" id="hxq-jC-EkJ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="edI-4n-4AY" secondAttribute="bottom" constant="8" id="qG7-HL-AwT"/>
|
||||
<constraint firstItem="hei-Wl-o3h" firstAttribute="centerY" secondItem="edI-4n-4AY" secondAttribute="centerY" id="qzb-6T-4CZ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="FTD-lO-6ko" secondAttribute="trailing" id="seE-xo-G4v"/>
|
||||
<constraint firstItem="hei-Wl-o3h" firstAttribute="centerX" secondItem="edI-4n-4AY" secondAttribute="centerX" id="u4p-dI-uwe"/>
|
||||
<constraint firstAttribute="trailing" secondItem="edI-4n-4AY" secondAttribute="trailing" constant="14.33" id="vqi-fs-cpS"/>
|
||||
<constraint firstItem="edI-4n-4AY" firstAttribute="leading" secondItem="kzE-UE-7KK" secondAttribute="leading" constant="14.33" id="yBa-gn-rzX"/>
|
||||
</constraints>
|
||||
@@ -491,6 +496,7 @@
|
||||
<outlet property="gradientView" destination="jdZ-WQ-xcr" id="EPt-cC-wNC"/>
|
||||
<outlet property="homeGrass" destination="bNd-CB-wx1" id="Rhs-zT-ChZ"/>
|
||||
<outlet property="karaokeView" destination="gk8-xm-Hh5" id="ewe-SE-uSJ"/>
|
||||
<outlet property="liveTVActivityIndicator" destination="hei-Wl-o3h" id="FHH-9l-LTO"/>
|
||||
<outlet property="liveTVIcon" destination="feU-AA-gLO" id="Hlu-Yc-cIp"/>
|
||||
<outlet property="liveTVView" destination="kzE-UE-7KK" id="wh1-1v-X4B"/>
|
||||
<outlet property="liveTvPlayer" destination="edI-4n-4AY" id="Ofv-d0-YP4"/>
|
||||
@@ -1119,65 +1125,6 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="4352" y="-1602"/>
|
||||
</scene>
|
||||
<!--RadioVC-->
|
||||
<scene sceneID="dii-N7-875">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="RadioVC" id="fGC-fP-40a" customClass="RadioVC" customModule="WOKA" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="S0N-Oh-Xhi">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view alpha="0.59999999999999998" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4aH-k1-gGq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="izq-sA-AUu">
|
||||
<rect key="frame" x="348" y="487" width="40" height="40"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="40" id="1tD-Tm-JF9"/>
|
||||
<constraint firstAttribute="height" constant="40" id="uVI-tC-lZG"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal">
|
||||
<imageReference key="image" image="xmark.circle" catalog="system" symbolScale="large"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="closeBtnTapped:" destination="fGC-fP-40a" eventType="touchUpInside" id="TF3-Uh-JVW"/>
|
||||
</connections>
|
||||
</button>
|
||||
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5Tw-fv-8la">
|
||||
<rect key="frame" x="0.0" y="532" width="393" height="320"/>
|
||||
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<wkWebViewConfiguration key="configuration">
|
||||
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
|
||||
<wkPreferences key="preferences"/>
|
||||
</wkWebViewConfiguration>
|
||||
</wkWebView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="E00-Ja-yNG"/>
|
||||
<constraints>
|
||||
<constraint firstItem="5Tw-fv-8la" firstAttribute="height" secondItem="S0N-Oh-Xhi" secondAttribute="height" multiplier="0.375587" id="4J3-yZ-Re3"/>
|
||||
<constraint firstItem="4aH-k1-gGq" firstAttribute="top" secondItem="S0N-Oh-Xhi" secondAttribute="top" id="HHS-YU-YlI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4aH-k1-gGq" secondAttribute="bottom" id="MtA-JI-lfu"/>
|
||||
<constraint firstItem="E00-Ja-yNG" firstAttribute="trailing" secondItem="5Tw-fv-8la" secondAttribute="trailing" id="SGi-yS-Cli"/>
|
||||
<constraint firstItem="5Tw-fv-8la" firstAttribute="top" secondItem="izq-sA-AUu" secondAttribute="bottom" constant="5" id="T1q-pM-06S"/>
|
||||
<constraint firstItem="4aH-k1-gGq" firstAttribute="leading" secondItem="E00-Ja-yNG" secondAttribute="leading" id="UA3-sZ-a2e"/>
|
||||
<constraint firstItem="E00-Ja-yNG" firstAttribute="trailing" secondItem="izq-sA-AUu" secondAttribute="trailing" constant="5" id="dRx-0c-75T"/>
|
||||
<constraint firstAttribute="bottom" secondItem="5Tw-fv-8la" secondAttribute="bottom" id="rso-Ao-8h1"/>
|
||||
<constraint firstItem="4aH-k1-gGq" firstAttribute="trailing" secondItem="E00-Ja-yNG" secondAttribute="trailing" id="wVA-Zv-vtn"/>
|
||||
<constraint firstItem="5Tw-fv-8la" firstAttribute="leading" secondItem="E00-Ja-yNG" secondAttribute="leading" id="zEA-14-fa9"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="backView" destination="4aH-k1-gGq" id="A7Q-3J-MgE"/>
|
||||
<outlet property="webView" destination="5Tw-fv-8la" id="9uS-Wn-Y4p"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="fpK-Ec-nbT" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="3598" y="-873"/>
|
||||
</scene>
|
||||
<!--Blog DetailsVC-->
|
||||
<scene sceneID="lKv-gz-78f">
|
||||
<objects>
|
||||
@@ -1301,7 +1248,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dyo-bM-Qn7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="4353" y="-873"/>
|
||||
<point key="canvasLocation" x="3598" y="-873"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
@@ -1333,7 +1280,6 @@
|
||||
<image name="SupportGirlImage" width="166" height="166"/>
|
||||
<image name="UpArrowMore" width="25" height="25"/>
|
||||
<image name="WebSeries" width="164" height="118.66666412353516"/>
|
||||
<image name="xmark.circle" catalog="system" width="128" height="123"/>
|
||||
<namedColor name="TextDarkBlue">
|
||||
<color red="0.10599999874830246" green="0.050999999046325684" blue="0.60399997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
//
|
||||
// RadioVC.swift
|
||||
// WOKA
|
||||
//
|
||||
// Created by MacBook Pro on 13/06/24.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import WebKit
|
||||
|
||||
class RadioVC: UIViewController, WKNavigationDelegate {
|
||||
|
||||
@IBOutlet var webView: WKWebView!
|
||||
var url = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/woka_fm"
|
||||
// var url = "https://s4.voscast.com:9161/stream" provide on 18th july
|
||||
// var url = "https://planetcast.radiowalla.in/radio.mp3" //url from 24th july
|
||||
|
||||
// Radio Server Address (Direct)
|
||||
// http://live3.rcast.net:9080 - This will not load as iOS directly rejects http
|
||||
// SSL Stream Address (Proxy)
|
||||
// https://stream.rcast.net/71643 - Playing in iOS and loading fine
|
||||
// non-SSL Stream Address (Direct)
|
||||
// http://live3.rcast.net:9080/;stream - This will not work as it is http
|
||||
// Listening Page
|
||||
// https://dir.rcast.net/radio/71643 - This is loading fine. but its showing unknown track
|
||||
|
||||
@IBOutlet weak var backView: UIView!
|
||||
|
||||
deinit {
|
||||
unloadWebView()
|
||||
}
|
||||
|
||||
// WKNavigationDelegate methods
|
||||
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
||||
print("Failed to load: \(error.localizedDescription)")
|
||||
}
|
||||
|
||||
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
||||
print("Failed to start loading: \(error.localizedDescription)")
|
||||
}
|
||||
|
||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||
print("Finished loading")
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
if #available(iOS 14.0, *) {
|
||||
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
webView.configuration.preferences.javaScriptEnabled = true
|
||||
}
|
||||
|
||||
let radioURL = URL(string: url)!
|
||||
let request = URLRequest(url: radioURL)
|
||||
webView.load(request)
|
||||
webView.navigationDelegate = self
|
||||
|
||||
backView.addTapGesture {
|
||||
self.dismiss(animated: true) {
|
||||
self.unloadWebView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
webView.stopLoading()
|
||||
}
|
||||
|
||||
@IBAction func closeBtnTapped(_ sender: UIButton) {
|
||||
self.dismiss(animated: true) {
|
||||
self.unloadWebView()
|
||||
}
|
||||
}
|
||||
|
||||
func unloadWebView() {
|
||||
// Cancel any ongoing navigation
|
||||
webView.stopLoading()
|
||||
|
||||
// Set delegates to nil
|
||||
webView.navigationDelegate = nil
|
||||
webView.uiDelegate = nil
|
||||
|
||||
// Remove from superview
|
||||
webView.removeFromSuperview()
|
||||
|
||||
// Release the web view
|
||||
webView = nil
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Alamofire
|
||||
|
||||
class ThemeOneVC: UIViewController {
|
||||
|
||||
@@ -33,6 +34,8 @@ class ThemeOneVC: UIViewController {
|
||||
@IBOutlet weak var karaokeView: UIView!
|
||||
@IBOutlet weak var shopView: UIView!
|
||||
|
||||
@IBOutlet weak var liveTVActivityIndicator: UIActivityIndicatorView!
|
||||
|
||||
var timer: Timer?
|
||||
|
||||
var vm = ThemeOneVM()
|
||||
@@ -47,6 +50,16 @@ 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)
|
||||
|
||||
vm.playerItem.removeObserver(self, forKeyPath: "status")
|
||||
vm.avPlayer.removeObserver(self, forKeyPath: "timeControlStatus")
|
||||
vm.playerItem.removeObserver(self, forKeyPath: "isPlaybackBufferEmpty")
|
||||
vm.playerItem.removeObserver(self, forKeyPath: "isPlaybackLikelyToKeepUp")
|
||||
vm.avPlayer.pause()
|
||||
}
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
.darkContent
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -56,6 +69,11 @@ class ThemeOneVC: UIViewController {
|
||||
// connectedToNetwork()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
vm.shouldAnimate = false
|
||||
if let player = vm.avPlayer{
|
||||
@@ -74,6 +92,7 @@ class ThemeOneVC: UIViewController {
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
vm.setupAvPlayer()
|
||||
self.addObservers()
|
||||
}
|
||||
|
||||
// Define a function to customize tab bar item icon size
|
||||
@@ -104,12 +123,6 @@ class ThemeOneVC: UIViewController {
|
||||
}
|
||||
|
||||
@IBAction func radioBtnTapped(_ sender: UIButton) {
|
||||
// let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.radioVC) as! RadioVC
|
||||
// vcPush.modalPresentationStyle = .overCurrentContext
|
||||
// vcPush.modalTransitionStyle = .crossDissolve
|
||||
// self.present(vcPush, animated: true)
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
@@ -118,6 +131,81 @@ class ThemeOneVC: UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Handle Live TV Observer
|
||||
|
||||
extension ThemeOneVC{
|
||||
func startMonitoring(){
|
||||
NetworkReachibility.shared.startMonitoring { [weak self] isConnected in
|
||||
guard let self else{return}
|
||||
switch isConnected{
|
||||
case true: // if network is connected than stop
|
||||
// when internet is back we have to setup player again
|
||||
NetworkReachibility.shared.stopMonitoring()
|
||||
// vm.avPlayer.play()
|
||||
print("network connection is back")
|
||||
case false:
|
||||
// if there is no internet connection prompt user and show reload icon
|
||||
self.toast(msg: "Lost Connection.", time: 1.4)
|
||||
liveTVActivityIndicator.stopAnimating()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addObservers() {
|
||||
// Observe the player's status
|
||||
vm.playerItem.addObserver(self, forKeyPath: "status", options: [.new, .old], context: nil)
|
||||
|
||||
// Observe the player's time control status
|
||||
vm.avPlayer.addObserver(self, forKeyPath: "timeControlStatus", options: [.new, .old], context: nil)
|
||||
|
||||
// Observe buffering status
|
||||
vm.playerItem.addObserver(self, forKeyPath: "isPlaybackBufferEmpty", options: [.new, .old], context: nil)
|
||||
vm.playerItem.addObserver(self, forKeyPath: "isPlaybackLikelyToKeepUp", options: [.new, .old], context: nil)
|
||||
}
|
||||
|
||||
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
||||
if keyPath == "status" {
|
||||
if vm.playerItem.status == .readyToPlay {
|
||||
print("Player is ready to play")
|
||||
vm.avPlayer.play()
|
||||
} else if vm.playerItem.status == .failed {
|
||||
print("Player failed to load")
|
||||
if !liveTVActivityIndicator.isAnimating{
|
||||
liveTVActivityIndicator.startAnimating()
|
||||
}
|
||||
}
|
||||
} else if keyPath == "timeControlStatus" {
|
||||
switch vm.avPlayer.timeControlStatus {
|
||||
case .playing:
|
||||
print("Player is playing")
|
||||
liveTVActivityIndicator.stopAnimating()
|
||||
case .paused:
|
||||
print("Player is paused")
|
||||
vm.avPlayer.play()
|
||||
liveTVActivityIndicator.stopAnimating()
|
||||
case .waitingToPlayAtSpecifiedRate:
|
||||
print("Player is Buffering 1")
|
||||
if !(NetworkReachabilityManager()?.isReachable ?? false){
|
||||
if !NetworkReachibility.shared.isMonitoring{
|
||||
startMonitoring()
|
||||
}
|
||||
}
|
||||
@unknown default:
|
||||
break
|
||||
}
|
||||
} else if keyPath == "isPlaybackBufferEmpty" {
|
||||
if vm.playerItem.isPlaybackBufferEmpty {
|
||||
print("Player is buffering 2")
|
||||
liveTVActivityIndicator.startAnimating()
|
||||
startMonitoring()
|
||||
}
|
||||
} else if keyPath == "isPlaybackLikelyToKeepUp" {
|
||||
if vm.playerItem.isPlaybackLikelyToKeepUp {
|
||||
print("Player is likely to keep up with the playback")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NavigationController: UINavigationController {
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ class ThemeTwoVC: UIViewController {
|
||||
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeTwoPush), object: nil)
|
||||
}
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
.lightContent
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
vm.vc = self
|
||||
@@ -33,6 +37,11 @@ class ThemeTwoVC: UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
K.GVar.topView = .theme2
|
||||
}
|
||||
@@ -76,18 +85,21 @@ extension ThemeTwoVC : CollectionViewSRC{
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
print(indexPath.row)
|
||||
switch indexPath.row{
|
||||
case 0:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.radioVC) as! RadioVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
self.present(vcPush, animated: true)
|
||||
vm.checkType(action: .radio)
|
||||
case 1:
|
||||
vm.playLiveTV()
|
||||
vm.checkType(action: .liveTV)
|
||||
case 2:
|
||||
break
|
||||
vm.checkType(action: .webseries)
|
||||
case 3:
|
||||
vm.checkType(action: .games)
|
||||
case 4:
|
||||
vm.checkType(action: .audioBooks)
|
||||
case 5:
|
||||
vm.checkType(action: .karaoke)
|
||||
case 6:
|
||||
vm.checkType(action: .shop)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
import JWPlayerKit
|
||||
import Alamofire
|
||||
|
||||
class ThemeOneVM{
|
||||
|
||||
@@ -15,10 +16,14 @@ class ThemeOneVM{
|
||||
var cloudMovingRight = false // Flag to track the direction of movement
|
||||
var isMovingRight = false // Flag to track the direction of movement
|
||||
var liveStreamURL = "https://d3volyx7jx7oal.cloudfront.net/master.m3u8"
|
||||
|
||||
var avPlayer : AVPlayer!
|
||||
var playerItem: AVPlayerItem!
|
||||
var playerLayer: AVPlayerLayer!
|
||||
|
||||
var shouldAnimate = true
|
||||
let reachability = NetworkReachabilityManager()
|
||||
|
||||
// var jwPlayerViewController: JWPlayerViewController!
|
||||
|
||||
func initView(){
|
||||
@@ -49,46 +54,7 @@ class ThemeOneVM{
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.themeOnePush(notification:)), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeOnePush), object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.reloadTheme), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
|
||||
}
|
||||
|
||||
@objc func themeOnePush(notification: Notification){
|
||||
if let userInfo = notification.userInfo, let action = userInfo["action"] as? TopViewPush {
|
||||
switch action {
|
||||
case .webseries:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .audioBooks:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .games:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .karaoke:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .shop:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .liveTV:
|
||||
handleTap(UITapGestureRecognizer())
|
||||
case .blogs:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.blogsVC) as! BlogsVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .radio:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vc.present(vcPush, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func setupAvPlayer(){
|
||||
// Ensure the liveStreamURL is valid
|
||||
// guard let liveStreamURL = URL(string: self.liveStreamURL) else {
|
||||
@@ -146,10 +112,12 @@ class ThemeOneVM{
|
||||
/*
|
||||
Av Player Setup
|
||||
*/
|
||||
let streamURL = URL(string: liveStreamURL)
|
||||
guard let streamURL = URL(string: liveStreamURL) else{return}
|
||||
|
||||
playerItem = AVPlayerItem(url: streamURL)
|
||||
|
||||
// Create AVPlayer with the stream URL
|
||||
avPlayer = AVPlayer(url: streamURL!)
|
||||
avPlayer = AVPlayer(playerItem: playerItem)
|
||||
// avPlayer.isMuted = true
|
||||
|
||||
// Create AVPlayerLayer
|
||||
@@ -159,7 +127,6 @@ class ThemeOneVM{
|
||||
playerLayer.frame = self.vc.liveTvPlayer.bounds
|
||||
self.vc.liveTvPlayer.layer.addSublayer(playerLayer)
|
||||
|
||||
avPlayer.play()
|
||||
avPlayer.volume = 0
|
||||
}
|
||||
|
||||
@@ -219,59 +186,91 @@ class ThemeOneVM{
|
||||
vc.webSeriesView.addTapGesture {
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.webSeriesView) { [weak self] in
|
||||
guard let self else{return}
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.checkType(action: .webseries)
|
||||
}
|
||||
}
|
||||
|
||||
vc.audioBooksView.addTapGesture {
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.audioBooksView) { [weak self] in
|
||||
guard let self else{return}
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.checkType(action: .audioBooks)
|
||||
}
|
||||
}
|
||||
|
||||
vc.gamesView.addTapGesture {
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.gamesView) { [weak self] in
|
||||
guard let self else{return}
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
// let sb = UIStoryboard(name: K.StoryBoard.cart, bundle: nil)
|
||||
// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Cart.cartListVC) as! CartListVC
|
||||
// self.vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.checkType(action: .games)
|
||||
}
|
||||
}
|
||||
|
||||
vc.karaokeView.addTapGesture { [self] in
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.karaokeView) { [weak self] in
|
||||
guard let self else{return}
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.checkType(action: .karaoke)
|
||||
}
|
||||
}
|
||||
|
||||
vc.shopView.addTapGesture {
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.shopView) { [weak self] in
|
||||
guard let self else{return}
|
||||
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
self.checkType(action: .shop)
|
||||
}
|
||||
}
|
||||
|
||||
vc.liveTVIcon.addTapGesture {
|
||||
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.liveTVIcon) { [weak self] in
|
||||
guard let self else{return}
|
||||
handleTap(UITapGestureRecognizer())
|
||||
self.checkType(action: .liveTV)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Get the notification from observer
|
||||
@objc func themeOnePush(notification: Notification){
|
||||
if let userInfo = notification.userInfo, let action = userInfo["action"] as? TopViewPush {
|
||||
checkType(action: action)
|
||||
}
|
||||
}
|
||||
|
||||
// Made a common func to check which module to push
|
||||
func checkType(action : TopViewPush){
|
||||
switch action {
|
||||
case .webseries:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .audioBooks:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .games:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .karaoke:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .shop:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .liveTV:
|
||||
handleTap(UITapGestureRecognizer())
|
||||
case .blogs:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.blogsVC) as! BlogsVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .radio:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vc.present(vcPush, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Animate Clouds and LiveTV
|
||||
|
||||
func centerLiveTVViewHorizontally() {
|
||||
|
||||
@@ -19,6 +19,7 @@ class ThemeTwoVM{
|
||||
weak var vc : ThemeTwoVC!
|
||||
var liveStreamURL = "https://d3volyx7jx7oal.cloudfront.net/master.m3u8"
|
||||
var avPlayer : AVPlayer!
|
||||
var playerItem: AVPlayerItem!
|
||||
var playerLayer: AVPlayerLayer!
|
||||
|
||||
/*
|
||||
@@ -47,44 +48,53 @@ class ThemeTwoVM{
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.viewPush(notification:)), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeTwoPush), object: nil)
|
||||
}
|
||||
|
||||
// MARK: - This will handle all clicks for modules
|
||||
|
||||
// This comes from Explore WOKA CLicks
|
||||
@objc func viewPush(notification: Notification){
|
||||
if let userInfo = notification.userInfo, let action = userInfo["action"] as? TopViewPush {
|
||||
switch action {
|
||||
case .webseries:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .audioBooks:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .games:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .karaoke:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .shop:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .liveTV:
|
||||
playLiveTV()
|
||||
case .blogs:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.blogsVC) as! BlogsVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .radio:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vc.present(vcPush, animated: true)
|
||||
}
|
||||
checkType(action: action)
|
||||
}
|
||||
}
|
||||
|
||||
// Made a common func to check which module to push
|
||||
func checkType(action : TopViewPush){
|
||||
switch action {
|
||||
case .webseries:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .audioBooks:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookHomeVC) as! AudioBookHomeVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .games:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesListVC) as! GamesListVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .karaoke:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeListingVC) as! KaraokeListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .shop:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .liveTV:
|
||||
playLiveTV()
|
||||
case .blogs:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.blogsVC) as! BlogsVC
|
||||
vc.navigationController?.pushViewController(vcPush, animated: true)
|
||||
case .radio:
|
||||
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
|
||||
vcPush.modalPresentationStyle = .overCurrentContext
|
||||
vcPush.modalTransitionStyle = .crossDissolve
|
||||
vc.present(vcPush, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Notification Center Handlers
|
||||
|
||||
@objc func reloadTheme(){
|
||||
@@ -113,9 +123,9 @@ class ThemeTwoVM{
|
||||
DispatchQueue.main.async {
|
||||
do {
|
||||
// Create a JWMediaTrack with the thumbnails .vtt file
|
||||
// let thumbnailTrack = try JWThumbnailTrackBuilder()
|
||||
// .file(URL(string:"https://content.jwplatform.com/videos/Agy4RIje-Ysj2G4DQ.mp4")!)
|
||||
// .build()
|
||||
// let thumbnailTrack = try JWThumbnailTrackBuilder()
|
||||
// .file(URL(string:"https://content.jwplatform.com/videos/Agy4RIje-Ysj2G4DQ.mp4")!)
|
||||
// .build()
|
||||
|
||||
// Create a JWPlayerItem
|
||||
let item = try JWPlayerItemBuilder()
|
||||
@@ -201,10 +211,12 @@ class ThemeTwoVM{
|
||||
/*
|
||||
Av Player Setup
|
||||
*/
|
||||
let streamURL = URL(string: liveStreamURL)
|
||||
guard let streamURL = URL(string: liveStreamURL) else{return}
|
||||
|
||||
playerItem = AVPlayerItem(url: streamURL)
|
||||
|
||||
// Create AVPlayer with the stream URL
|
||||
avPlayer = AVPlayer(url: streamURL!)
|
||||
avPlayer = AVPlayer(playerItem: playerItem)
|
||||
// avPlayer.isMuted = true
|
||||
|
||||
// Create AVPlayerLayer
|
||||
@@ -221,7 +233,6 @@ class ThemeTwoVM{
|
||||
func setData(){
|
||||
|
||||
playerLayer.frame = self.vc.liveTvView.bounds
|
||||
|
||||
|
||||
guard let data = AuthFunc.shareInstance.userData else{return}
|
||||
//set the first name as the name
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
import AVFoundation
|
||||
import MediaPlayer
|
||||
import Alamofire
|
||||
|
||||
class WokaFMVC: UIViewController {
|
||||
|
||||
@@ -29,9 +29,12 @@ class WokaFMVC: UIViewController {
|
||||
@IBAction func playBtnTapped(_ sender: UIButton) {
|
||||
if sender == playBtn{
|
||||
if sender.image(for: .normal)?.pngData() == UIImage(named: "Reload")?.pngData(){
|
||||
// when user reloads check for internet connection
|
||||
if !(NetworkReachabilityManager()?.isReachable ?? false){
|
||||
return
|
||||
}
|
||||
vm.retryConnect()
|
||||
} else if sender.image(for: .normal)?.pngData() == UIImage(named: "PlayButton")?.pngData(){
|
||||
|
||||
vm.player.play()
|
||||
}else{
|
||||
vm.player.pause()
|
||||
@@ -67,6 +70,26 @@ class WokaFMVC: UIViewController {
|
||||
@IBAction func closeBtnTapped(_ sender: UIButton) {
|
||||
self.dismiss(animated: true)
|
||||
}
|
||||
|
||||
func startMonitoring(){
|
||||
NetworkReachibility.shared.startMonitoring { [weak self] isConnected in
|
||||
guard let self else{return}
|
||||
switch isConnected{
|
||||
case true: // if network is connected than stop
|
||||
// when internet is back we have to setup player again
|
||||
NetworkReachibility.shared.stopMonitoring()
|
||||
vm.setupPlayer()
|
||||
addObservers()
|
||||
vm.setupAudioSession()
|
||||
case false:
|
||||
// if there is no internet connection prompt user and show reload icon
|
||||
self.toast(msg: "Lost Connection.", time: 1.4)
|
||||
activityIndicator.stopAnimating()
|
||||
playBtn.setImage(UIImage(named: "Reload"), for: .normal)
|
||||
playBtn.isEnabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addObservers() {
|
||||
// Observe the player's status
|
||||
@@ -104,6 +127,10 @@ class WokaFMVC: UIViewController {
|
||||
case .waitingToPlayAtSpecifiedRate:
|
||||
activityIndicator.startAnimating()
|
||||
playBtn.isEnabled = false
|
||||
|
||||
if !(NetworkReachabilityManager()?.isReachable ?? false){
|
||||
startMonitoring()
|
||||
}
|
||||
print("Player is buffering 1 ")
|
||||
@unknown default:
|
||||
break
|
||||
@@ -111,7 +138,9 @@ class WokaFMVC: UIViewController {
|
||||
} else if keyPath == "isPlaybackBufferEmpty" {
|
||||
if vm.playerItem.isPlaybackBufferEmpty {
|
||||
print("Player is buffering 2")
|
||||
playBtn.isEnabled = false
|
||||
activityIndicator.startAnimating()
|
||||
startMonitoring()
|
||||
}
|
||||
} else if keyPath == "isPlaybackLikelyToKeepUp" {
|
||||
if vm.playerItem.isPlaybackLikelyToKeepUp {
|
||||
@@ -166,14 +195,14 @@ extension UIButton {
|
||||
}
|
||||
|
||||
|
||||
//Update system volume
|
||||
extension MPVolumeView {
|
||||
static func setVolume(_ volume: Float) {
|
||||
let volumeView = MPVolumeView()
|
||||
let slider = volumeView.subviews.first(where: { $0 is UISlider }) as? UISlider
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.01) {
|
||||
slider?.value = volume
|
||||
}
|
||||
}
|
||||
}
|
||||
////Update system volume
|
||||
//extension MPVolumeView {
|
||||
// static func setVolume(_ volume: Float) {
|
||||
// let volumeView = MPVolumeView()
|
||||
// let slider = volumeView.subviews.first(where: { $0 is UISlider }) as? UISlider
|
||||
//
|
||||
// DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.01) {
|
||||
// slider?.value = volume
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import UIKit
|
||||
|
||||
protocol ReloadSeriesFavLike{
|
||||
func updateRows(index : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool? )
|
||||
|
||||
func updateRows(index : Int, type : FavCellCLick, isFav : Bool? , isLike : Bool?, id : Int?)
|
||||
}
|
||||
|
||||
class WebSeriesVC: UIViewController {
|
||||
@@ -133,7 +132,22 @@ extension WebSeriesVC : TableViewSRC{
|
||||
vm.showData[index].markAsFavourite = false
|
||||
vm.showData[index].favouriteCategoryIDS = ValueWrapper.stringValue("")
|
||||
showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
// K.GVar.reloadMyList = true
|
||||
|
||||
// Update for mylist
|
||||
if let id = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id{
|
||||
if id == 1{ // english
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
|
||||
}else{ // hindi
|
||||
if let index = MyListDataTemp.shareInstance.webSeriesHindi.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.webSeriesHindi.remove(at: index)
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -142,7 +156,25 @@ extension WebSeriesVC : TableViewSRC{
|
||||
vm.showData[index].markAsFavourite = true
|
||||
vm.showData[index].favouriteCategoryIDS = ValueWrapper.stringValue(categoryID.toString())
|
||||
showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
K.GVar.reloadMyList = true
|
||||
// K.GVar.reloadMyList = true
|
||||
|
||||
// Update for mylist
|
||||
if let id = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id{
|
||||
if id == 1{ // english
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
|
||||
}else{ // hindi
|
||||
// return if the data is not fetched. IT means user has not loaded mylist yet
|
||||
if !MyListDataTemp.shareInstance.isDatafetched {return}
|
||||
let showData = vm.showData[index]
|
||||
|
||||
MyListDataTemp.shareInstance.webSeriesHindi.append(FavouriteListingDM.ResultData.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: showData.categoryMasterID, ageRangeMasterID: showData.ageRangeMasterID, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount, bookmarkCategoryIDS: "18"))
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,6 +188,18 @@ extension WebSeriesVC : TableViewSRC{
|
||||
vm.showData[index].isLiked = false
|
||||
vm.showData[index].likesCount! -= 1
|
||||
showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.showData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1
|
||||
}
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.webSeriesHindi.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -164,10 +208,23 @@ extension WebSeriesVC : TableViewSRC{
|
||||
vm.showData[index].isLiked = true
|
||||
vm.showData[index].likesCount! += 1
|
||||
showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none)
|
||||
|
||||
// Soft reload for webseries english
|
||||
K.GVar.myListSoftReload = true
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.favListingData?.showData?.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1
|
||||
}
|
||||
|
||||
if let index = MyListDataTemp.shareInstance.webSeriesHindi.firstIndex(where: {$0.id == postID}){
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true
|
||||
MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
K.GVar.reloadMyList = true
|
||||
// K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +248,7 @@ extension WebSeriesVC : TableViewSRC{
|
||||
extension WebSeriesVC : ReloadSeriesFavLike{
|
||||
|
||||
// if like or fav is done in webseriesseason vc, dont need to do api call in this screen.
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?) {
|
||||
func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) {
|
||||
if let isFav{
|
||||
let categoryID = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id ?? 0
|
||||
switch isFav{
|
||||
|
||||
@@ -49,7 +49,7 @@ class WebSeriesSeasonVM{
|
||||
self.showData?.markAsFavourite = false
|
||||
self.showData?.favouriteCategoryIDS = ValueWrapper.stringValue("")
|
||||
self.setShowData()
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .favourite, isFav: false, isLike: nil)
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .favourite, isFav: false, isLike: nil, id: showID)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}else{
|
||||
@@ -57,7 +57,7 @@ class WebSeriesSeasonVM{
|
||||
self.showData?.markAsFavourite = true
|
||||
self.showData?.favouriteCategoryIDS = ValueWrapper.stringValue(categoryID.toString())
|
||||
self.setShowData()
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .favourite, isFav: true, isLike: nil)
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .favourite, isFav: true, isLike: nil, id: showID)
|
||||
K.GVar.reloadMyList = true
|
||||
}
|
||||
}
|
||||
@@ -73,14 +73,14 @@ class WebSeriesSeasonVM{
|
||||
self.showData?.isLiked = false
|
||||
self.showData?.likesCount! -= 1
|
||||
self.setShowData()
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .liked, isFav: nil, isLike: false)
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .liked, isFav: nil, isLike: false, id: showID)
|
||||
}
|
||||
}else{
|
||||
LikeFavCommonFunc.shareInstance.likePost(postID: showID, postType: postType, vc: self.vc) { isDone in
|
||||
self.showData?.isLiked = true
|
||||
self.showData?.likesCount! += 1
|
||||
self.setShowData()
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .liked, isFav: nil, isLike: true)
|
||||
self.vc.likeFavDelegate?.updateRows(index: indexSelected, type: .liked, isFav: nil, isLike: true, id: showID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user