diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index d0a1d24..ad77a70 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -130,11 +130,21 @@ 52CA28FC2BE11A0400708B49 /* UserIntrestVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */; }; 52CC38C32BDF812F00B74C3E /* LocalisedElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CC38C22BDF812F00B74C3E /* LocalisedElements.swift */; }; 52CCD7B02C1AF0F80078BD65 /* RadioVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */; }; + 52D6A2462C21A29800145908 /* ContinueWatchingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A2452C21A29800145908 /* ContinueWatchingDM.swift */; }; + 52D6A2482C21A3A500145908 /* WebSeriesVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A2472C21A3A500145908 /* WebSeriesVM.swift */; }; + 52D6A24B2C21B43300145908 /* WebSeriesCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52D6A24A2C21B43300145908 /* WebSeriesCell.xib */; }; + 52D6A24C2C21B43300145908 /* WebSeriesCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A2492C21B43300145908 /* WebSeriesCell.swift */; }; + 52D6A24E2C22B3AB00145908 /* WebSeriesShowListDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A24D2C22B3AB00145908 /* WebSeriesShowListDM.swift */; }; + 52D6A2512C22B58200145908 /* WebSeriesShowListingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A24F2C22B58200145908 /* WebSeriesShowListingCell.swift */; }; + 52D6A2542C22B93F00145908 /* CategoryListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D6A2532C22B93F00145908 /* CategoryListingDM.swift */; }; + 52D6A2572C22C1E300145908 /* WebSeriesShowListingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52D6A2562C22C1E300145908 /* WebSeriesShowListingCell.xib */; }; 52D774E92BDFBDA4001D87DE /* AuthenticationStringConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D774E82BDFBDA4001D87DE /* AuthenticationStringConstant.swift */; }; 52D774EB2BDFC0BF001D87DE /* OTPVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D774EA2BDFC0BF001D87DE /* OTPVC.swift */; }; 52D774ED2BDFC13F001D87DE /* OTPVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D774EC2BDFC13F001D87DE /* OTPVM.swift */; }; 52D774EF2BDFC50D001D87DE /* StringValidations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D774EE2BDFC50D001D87DE /* StringValidations.swift */; }; 52D774F12BDFC53B001D87DE /* StringSubScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52D774F02BDFC53B001D87DE /* StringSubScript.swift */; }; + 52DAC6482C21762900E2F85B /* WebSeries.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52DAC6472C21762900E2F85B /* WebSeries.storyboard */; }; + 52DAC64E2C21775300E2F85B /* WebSeriesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */; }; 52FB2D8F2BDF898F0009B0C7 /* TextFieldPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */; }; 52FDBA782BFF23F4009D7AC7 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */; }; 52FDBA7B2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FDBA7A2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift */; }; @@ -364,11 +374,21 @@ 52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIntrestVM.swift; sourceTree = ""; }; 52CC38C22BDF812F00B74C3E /* LocalisedElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalisedElements.swift; sourceTree = ""; }; 52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioVC.swift; sourceTree = ""; }; + 52D6A2452C21A29800145908 /* ContinueWatchingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContinueWatchingDM.swift; sourceTree = ""; }; + 52D6A2472C21A3A500145908 /* WebSeriesVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesVM.swift; sourceTree = ""; }; + 52D6A2492C21B43300145908 /* WebSeriesCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesCell.swift; sourceTree = ""; }; + 52D6A24A2C21B43300145908 /* WebSeriesCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WebSeriesCell.xib; sourceTree = ""; }; + 52D6A24D2C22B3AB00145908 /* WebSeriesShowListDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesShowListDM.swift; sourceTree = ""; }; + 52D6A24F2C22B58200145908 /* WebSeriesShowListingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesShowListingCell.swift; sourceTree = ""; }; + 52D6A2532C22B93F00145908 /* CategoryListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryListingDM.swift; sourceTree = ""; }; + 52D6A2562C22C1E300145908 /* WebSeriesShowListingCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WebSeriesShowListingCell.xib; sourceTree = ""; }; 52D774E82BDFBDA4001D87DE /* AuthenticationStringConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStringConstant.swift; sourceTree = ""; }; 52D774EA2BDFC0BF001D87DE /* OTPVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTPVC.swift; sourceTree = ""; }; 52D774EC2BDFC13F001D87DE /* OTPVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTPVM.swift; sourceTree = ""; }; 52D774EE2BDFC50D001D87DE /* StringValidations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringValidations.swift; sourceTree = ""; }; 52D774F02BDFC53B001D87DE /* StringSubScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringSubScript.swift; sourceTree = ""; }; + 52DAC6472C21762900E2F85B /* WebSeries.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = WebSeries.storyboard; sourceTree = ""; }; + 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesVC.swift; sourceTree = ""; }; 52E7E0F62BDF7DD500C86E10 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/AuthenticationSB.strings; sourceTree = ""; }; 52E7E0F82BDF7DD900C86E10 /* hi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hi; path = hi.lproj/AuthenticationSB.strings; sourceTree = ""; }; 52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldPadding.swift; sourceTree = ""; }; @@ -584,6 +604,7 @@ 523ED25C2BDA2BC700CFED02 /* WOKA */ = { isa = PBXGroup; children = ( + 52DAC6462C21761700E2F85B /* WebSeries */, 9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */, 523ED26B2BDA2BC900CFED02 /* Info.plist */, 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */, @@ -917,6 +938,55 @@ path = GIF_JSON; sourceTree = ""; }; + 52DAC6462C21761700E2F85B /* WebSeries */ = { + isa = PBXGroup; + children = ( + 52DAC64C2C2176D600E2F85B /* Model */, + 52DAC64B2C2176CD00E2F85B /* View */, + 52DAC64A2C2176CB00E2F85B /* ViewModel */, + 52DAC6492C21767900E2F85B /* Controller */, + 52DAC6472C21762900E2F85B /* WebSeries.storyboard */, + ); + path = WebSeries; + sourceTree = ""; + }; + 52DAC6492C21767900E2F85B /* Controller */ = { + isa = PBXGroup; + children = ( + 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 52DAC64A2C2176CB00E2F85B /* ViewModel */ = { + isa = PBXGroup; + children = ( + 52D6A2472C21A3A500145908 /* WebSeriesVM.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 52DAC64B2C2176CD00E2F85B /* View */ = { + isa = PBXGroup; + children = ( + 52D6A2492C21B43300145908 /* WebSeriesCell.swift */, + 52D6A24A2C21B43300145908 /* WebSeriesCell.xib */, + 52D6A24F2C22B58200145908 /* WebSeriesShowListingCell.swift */, + 52D6A2562C22C1E300145908 /* WebSeriesShowListingCell.xib */, + ); + path = View; + sourceTree = ""; + }; + 52DAC64C2C2176D600E2F85B /* Model */ = { + isa = PBXGroup; + children = ( + 52D6A2452C21A29800145908 /* ContinueWatchingDM.swift */, + 52D6A24D2C22B3AB00145908 /* WebSeriesShowListDM.swift */, + 52D6A2532C22B93F00145908 /* CategoryListingDM.swift */, + ); + path = Model; + sourceTree = ""; + }; 52F12C802C04569100AF8139 /* Model */ = { isa = PBXGroup; children = ( @@ -1303,6 +1373,8 @@ 527AC6FE2C173A5100434FB7 /* SongListCell.xib in Resources */, 523ED26A2BDA2BC900CFED02 /* Base in Resources */, 52C8B05B2BDA5924003B51D0 /* WokaSplashSound.m4a in Resources */, + 52D6A24B2C21B43300145908 /* WebSeriesCell.xib in Resources */, + 52DAC6482C21762900E2F85B /* WebSeries.storyboard in Resources */, 527AC6F82C171C8F00434FB7 /* BlogsCell.xib in Resources */, 52A981D82C1B0E27000E0BEC /* FavouriteCell.xib in Resources */, 52C1A4E82C05C95D007BAA50 /* Theme.storyboard in Resources */, @@ -1311,6 +1383,7 @@ 9CBE1B422C0F37B300CA6E61 /* DropDownCell.xib in Resources */, 52A3F6A92BECBF2A0000BB0B /* LinkedChildCell.xib in Resources */, 523ED2652BDA2BC700CFED02 /* Base in Resources */, + 52D6A2572C22C1E300145908 /* WebSeriesShowListingCell.xib in Resources */, 52BC3BE62C0E0326002FACA6 /* FaqCell.xib in Resources */, 52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */, 9C834ED32C1C1F9200B29A9C /* Exo2-SemiBold.ttf in Resources */, @@ -1402,6 +1475,7 @@ files = ( 9C535DC62C00BF2400DA6DCD /* HomeExploreCell.swift in Sources */, 52D774EF2BDFC50D001D87DE /* StringValidations.swift in Sources */, + 52D6A2512C22B58200145908 /* WebSeriesShowListingCell.swift in Sources */, 5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */, 525954102BE8B72900191286 /* FontCustom.swift in Sources */, 5202AAFE2BDF90590043B7BD /* TextFieldImage.swift in Sources */, @@ -1419,6 +1493,7 @@ 52B8D4DB2C04A25E00ED65F3 /* TransitionContext.swift in Sources */, 9C27E1602BDB6ECA00EC1DA9 /* UserDefaultsStruct.swift in Sources */, 52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */, + 52D6A24C2C21B43300145908 /* WebSeriesCell.swift in Sources */, 524C422B2C04781B0016A11C /* ThemeTwoVM.swift in Sources */, 52B8D4DF2C04A25E00ED65F3 /* StatusBar.swift in Sources */, 5259541D2BE8D94400191286 /* QueueHelper.swift in Sources */, @@ -1430,11 +1505,13 @@ 525327D02BFCBC4A00F64283 /* ExploreWokaVC.swift in Sources */, 52C8B0542BDA4BD1003B51D0 /* RoundCorner.swift in Sources */, 522242662BFC74380085C632 /* MyListVC.swift in Sources */, + 52DAC64E2C21775300E2F85B /* WebSeriesVC.swift in Sources */, 5259542B2BEA292800191286 /* UserRegPostModel.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 */, 52B8D4E12C04A25E00ED65F3 /* BasicTransitionAnimator.swift in Sources */, 52BC3BF02C1701F8002FACA6 /* BlogDM.swift in Sources */, 525954192BE8CC3400191286 /* ConstantString.swift in Sources */, @@ -1483,6 +1560,7 @@ 5259541B2BE8D6F900191286 /* NetworkReachibility.swift in Sources */, 52A981CE2C1AFE66000E0BEC /* FavouriteListingDM.swift in Sources */, 527AC6FD2C173A5100434FB7 /* SongListCell.swift in Sources */, + 52D6A2542C22B93F00145908 /* CategoryListingDM.swift in Sources */, 9C27E1672BDB706700EC1DA9 /* StoryBoard.swift in Sources */, 52C8B0692BDA6E1E003B51D0 /* LocalizedEnum.swift in Sources */, 525954122BE8C84900191286 /* Toast.swift in Sources */, @@ -1502,6 +1580,7 @@ 52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */, 5219C2C22C086D9C00A1DF4D /* DataTypeConversion.swift in Sources */, 525953CF2BE8B28F00191286 /* Utilities.swift in Sources */, + 52D6A2462C21A29800145908 /* ContinueWatchingDM.swift in Sources */, 9CBCB2A12BE4E50A007D7934 /* TextFieldPassword.swift in Sources */, 52BC3BEC2C16DF9F002FACA6 /* MyOrdersVC.swift in Sources */, 9C56E8482BDBEFAB00E4CA14 /* AssetColor.swift in Sources */, @@ -1550,6 +1629,7 @@ 52B8D4E02C04A25E00ED65F3 /* UIView+Container.swift in Sources */, 9C56E8462BDBEE6400E4CA14 /* EmailVC.swift in Sources */, 522D65622C1ACDA40021E505 /* CommonNwCall.swift in Sources */, + 52D6A2482C21A3A500145908 /* WebSeriesVM.swift in Sources */, 525327D92BFCDDF700F64283 /* AuthFuncStartupSoundHandling.swift in Sources */, 52663FFB2BDFB1700001D8CE /* TextFieldShadow.swift in Sources */, 52C6E0212BE3ADE300E22D59 /* GenderEnum.swift in Sources */, diff --git a/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/Contents.json b/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/Contents.json new file mode 100644 index 0000000..664f837 --- /dev/null +++ b/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "liveaction.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/liveaction.png b/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/liveaction.png new file mode 100644 index 0000000..df2737a Binary files /dev/null and b/WOKA/Assets/Assets.xcassets/Home/Theme2/LiveHindi.imageset/liveaction.png differ diff --git a/WOKA/Assets/Assets.xcassets/WebSeries/Contents.json b/WOKA/Assets/Assets.xcassets/WebSeries/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/WOKA/Assets/Assets.xcassets/WebSeries/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/Contents.json b/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/Contents.json new file mode 100644 index 0000000..6e11b67 --- /dev/null +++ b/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "MasilaCover.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/MasilaCover.png b/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/MasilaCover.png new file mode 100644 index 0000000..dff1b0b Binary files /dev/null and b/WOKA/Assets/Assets.xcassets/WebSeries/MasilaComingSoon.imageset/MasilaCover.png differ diff --git a/WOKA/Constants K/CellIdentifier.swift b/WOKA/Constants K/CellIdentifier.swift index d724a71..42786dc 100644 --- a/WOKA/Constants K/CellIdentifier.swift +++ b/WOKA/Constants K/CellIdentifier.swift @@ -37,5 +37,10 @@ extension K{ static let userNotificationCell = "UserNotificationCell" static let favouriteCell = "FavouriteCell" } + + struct WebSeries{ + static let webSeriesCell = "WebSeriesCell" + static let webSeriesShowListingCell = "WebSeriesShowListingCell" + } } } diff --git a/WOKA/Constants K/StoryBoard.swift b/WOKA/Constants K/StoryBoard.swift index 42e3857..1332bce 100644 --- a/WOKA/Constants K/StoryBoard.swift +++ b/WOKA/Constants K/StoryBoard.swift @@ -16,5 +16,6 @@ extension K{ static let customAlerts = "CustomAlerts" static let theme = "Theme" static let sideBarNav = "SideBarNav" + static let webSeries = "WebSeries" } } diff --git a/WOKA/Constants K/StoryBoardID.swift b/WOKA/Constants K/StoryBoardID.swift index e3409a4..ddc4b6d 100644 --- a/WOKA/Constants K/StoryBoardID.swift +++ b/WOKA/Constants K/StoryBoardID.swift @@ -55,5 +55,13 @@ extension K{ static let webViewVC = "WebViewVC" static let myOrdersVC = "MyOrdersVC" } + + /* + Web Series + */ + + struct WebSeries{ + static let webSeriesVC = "WebSeriesVC" + } } } diff --git a/WOKA/Home/Controller/ExploreWokaVC.swift b/WOKA/Home/Controller/ExploreWokaVC.swift index 1fc4783..2d72f1a 100644 --- a/WOKA/Home/Controller/ExploreWokaVC.swift +++ b/WOKA/Home/Controller/ExploreWokaVC.swift @@ -12,6 +12,10 @@ class ExploreWokaVC: UIViewController { @IBOutlet weak var blurView: UIView! @IBOutlet weak var extraView: UIView! @IBOutlet weak var customView: UIView! + + @IBOutlet weak var wokaFmBtn: UIButton! + @IBOutlet weak var liveTvBtn: UIButton! + @IBOutlet weak var layerView: UIView! override func viewDidLoad() { @@ -38,6 +42,24 @@ class ExploreWokaVC: UIViewController { blurredView.contentView.addSubview(vibrancyView) } + @IBAction func btnTapped(_ sender: UIButton) { + switch sender{ + case wokaFmBtn: + self.dismiss(animated: true) { +// 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) + } + case liveTvBtn: + self.dismiss(animated: true) + default: + break + } + } + + @IBAction func closeTapped(_ sender: UIButton) { self.dismiss(animated: true) } diff --git a/WOKA/Home/Home.storyboard b/WOKA/Home/Home.storyboard index af7cdaa..6f50cbc 100644 --- a/WOKA/Home/Home.storyboard +++ b/WOKA/Home/Home.storyboard @@ -606,6 +606,9 @@ + + + @@ -628,6 +631,9 @@ + + + @@ -826,6 +832,8 @@ + + @@ -1214,7 +1222,7 @@ - + diff --git a/WOKA/Home/Model/FavouriteListingDM.swift b/WOKA/Home/Model/FavouriteListingDM.swift index d1f03f8..c07b492 100644 --- a/WOKA/Home/Model/FavouriteListingDM.swift +++ b/WOKA/Home/Model/FavouriteListingDM.swift @@ -98,7 +98,7 @@ struct FavouriteListingDM: Codable { var markAsFavourite, isLiked: Bool? var likesCount : Int? let viewsCount, bookmarkCount: Int? - let bookmarkCategoryIDS: String? + var bookmarkCategoryIDS: String? enum CodingKeys: String, CodingKey { case id, title, description diff --git a/WOKA/Home/ViewModel/MyListVM.swift b/WOKA/Home/ViewModel/MyListVM.swift index 49810fb..b719afe 100644 --- a/WOKA/Home/ViewModel/MyListVM.swift +++ b/WOKA/Home/ViewModel/MyListVM.swift @@ -81,10 +81,21 @@ class MyListVM{ Taking out the hindi series , 1-> English , 18-> Hindi And the saving it to hindi series */ - webSeriesHindi = hindiData.compactMap { $0 }.filter { $0.bookmarkCategoryIDS == "18" } + webSeriesHindi = hindiData.compactMap { $0 }.filter { ($0.bookmarkCategoryIDS?.components(separatedBy: ",").first == "18" || $0.bookmarkCategoryIDS?.components(separatedBy: ",").last == "18") } // Deleting the hindi series from main (those with category ID "18") - hindiData.removeAll { $0.bookmarkCategoryIDS == "18" } + for (index, element) in favListingData!.showData!.enumerated() { + let bookMarkCatID = element.bookmarkCategoryIDS?.components(separatedBy: ",") + + if bookMarkCatID?.count == 2{ + hindiData[index-1].bookmarkCategoryIDS = "1" + }else{ + + hindiData.remove(at: index-1) + } + } + +// hindiData.removeAll { $0.bookmarkCategoryIDS?.components(separatedBy: ",").count == 1 ? $0.bookmarkCategoryIDS? } // Updating the showData with the filtered list favListingData?.showData = hindiData diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift index 4b406b3..4ecd872 100644 --- a/WOKA/Network Adapter/APIEndPoints.swift +++ b/WOKA/Network Adapter/APIEndPoints.swift @@ -79,6 +79,12 @@ struct APIEndPoints { static let favourite_add = makeURL(path: "favourite_add") } + struct WebSeries{ + static let continue_watching = makeURL(path: "continue_watching") + static let watch_show_listing = makeURL(path: "watch_show_listing") + static let category_listing = makeURL(path: "category_listing") + } + // Other endpoint categories... struct Links { static let privacyPolicy = "https://www.wokaland.com/privacy-policy/" diff --git a/WOKA/Network Adapter/NetworkManager.swift b/WOKA/Network Adapter/NetworkManager.swift index db2f2a7..d52b8cd 100644 --- a/WOKA/Network Adapter/NetworkManager.swift +++ b/WOKA/Network Adapter/NetworkManager.swift @@ -58,7 +58,7 @@ class NetworkManager{ switch response.result { case .success(let value): /* - if Sucess == 4 menas user has logined in other device + if Sucess == 4 menas user has logined in other device, logout that user by saying session timeout */ if value.success == 4{ if let topController = UIApplication.topViewController() { @@ -161,7 +161,6 @@ final class AlamofireLogger: EventMonitor { } - extension UIApplication { class func topViewController(_ base: UIViewController? = UIApplication.shared.mainKeyWindow?.rootViewController) -> UIViewController? { if let nav = base as? UINavigationController { diff --git a/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift b/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift index 3a47bca..6c1dfa5 100644 --- a/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift +++ b/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift @@ -19,7 +19,7 @@ class TabBarVC: UITabBarController { self.delegate = self self.title = "" customizeTabBarItemFont() - + updateText() self.setupTabBarUI() self.addCustomTabBarView() NotificationCenter.default.addObserver(self, selector: #selector(languageDidChange), name: .languageDidChange, object: nil) diff --git a/WOKA/Theme/Base.lproj/Theme.storyboard b/WOKA/Theme/Base.lproj/Theme.storyboard index 5615bb5..897d9eb 100644 --- a/WOKA/Theme/Base.lproj/Theme.storyboard +++ b/WOKA/Theme/Base.lproj/Theme.storyboard @@ -254,26 +254,36 @@ - + - - - - + + + + + + + + + + - + + + + + - + @@ -338,17 +348,16 @@ - + + - - @@ -415,6 +424,7 @@ + @@ -432,7 +442,7 @@ - + @@ -589,7 +599,7 @@ - + @@ -599,7 +609,7 @@ - + @@ -625,23 +635,50 @@ - + + + + + + + + - + @@ -651,7 +688,7 @@ - + @@ -733,17 +770,20 @@ + + + - + + - @@ -751,6 +791,7 @@ + @@ -970,6 +1011,7 @@ + @@ -989,10 +1031,10 @@ - + - + diff --git a/WOKA/Theme/CommonNwCall.swift b/WOKA/Theme/CommonNwCall.swift index e0628fd..d0c537c 100644 --- a/WOKA/Theme/CommonNwCall.swift +++ b/WOKA/Theme/CommonNwCall.swift @@ -32,6 +32,7 @@ class CommonNwCall{ case 1: Utilities.dismissProgressHUD() guard let data = data.data else{return} + self.userNotification.removeAll() self.userNotification.append(contentsOf: data) //Fetched Blogs completion(true) diff --git a/WOKA/Theme/Controller/ThemeOneVC.swift b/WOKA/Theme/Controller/ThemeOneVC.swift index 7fe03e6..1901ea9 100644 --- a/WOKA/Theme/Controller/ThemeOneVC.swift +++ b/WOKA/Theme/Controller/ThemeOneVC.swift @@ -22,7 +22,7 @@ class ThemeOneVC: UIViewController { @IBOutlet weak var notificationBtnn: UIButton! @IBOutlet weak var avatarImage: UIImageView! - @IBOutlet weak var webSeriesView: UIStackView! + @IBOutlet weak var webSeriesView: UIView! @IBOutlet var star: [UIImageView]! @IBOutlet weak var moonImage: UIImageView! @IBOutlet weak var moreStack: UIStackView! diff --git a/WOKA/Theme/Controller/ThemeTwoVC.swift b/WOKA/Theme/Controller/ThemeTwoVC.swift index 8eaf1e2..7bc81d0 100644 --- a/WOKA/Theme/Controller/ThemeTwoVC.swift +++ b/WOKA/Theme/Controller/ThemeTwoVC.swift @@ -14,6 +14,7 @@ class ThemeTwoVC: UIViewController { @IBOutlet weak var liveTvView: UIView! @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var avatarImage: UIImageView! + @IBOutlet weak var notificationBtn: UIButton! var vm = ThemeTwoVM() @@ -27,11 +28,12 @@ class ThemeTwoVC: UIViewController { vm.initView() liveTvView.addTapGesture { [weak self] in guard let self else{return} - delegate?.didPressSwitchButton(from: self) + self.vm.playLiveTV() } } override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() vm.setData() } @@ -39,6 +41,15 @@ class ThemeTwoVC: UIViewController { self.sideMenuController?.revealMenu() } + @IBAction func notificationBtnTapped(_ sender: UIButton) { + CommonNwCall.shareInstance.getUserNotification(vc: self) { isDone in + if isDone{ + let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Home.userNotificationVC) as! UserNotificationVC + self.navigationController?.pushViewController(vcPush, animated: true) + } + } + } } // MARK: - CollectionView DataSource Delegate @@ -56,6 +67,20 @@ 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) + case 1: + vm.playLiveTV() + case 2: + break + default: + break + } } } diff --git a/WOKA/Theme/Controller/UserNotificationVC.swift b/WOKA/Theme/Controller/UserNotificationVC.swift index 118d966..9ef4f10 100644 --- a/WOKA/Theme/Controller/UserNotificationVC.swift +++ b/WOKA/Theme/Controller/UserNotificationVC.swift @@ -24,8 +24,6 @@ class UserNotificationVC: UIViewController { navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() - self.navigationController?.setColor(color: .white) - //Adding pull to Refresh refreshControl.attributedTitle = NSAttributedString(string: "Refreshing...",attributes: [.foregroundColor: UIColor.white]) refreshControl.tintColor = .white @@ -47,11 +45,15 @@ class UserNotificationVC: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.setNavigationBarHidden(false, animated: animated) + self.navigationController?.setColor(color: .white) } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - navigationController?.setNavigationBarHidden(true, animated: animated) + + self.navigationController?.setNavigationBarHidden(true, animated: animated) + + // Customize the navigation bar's appearance self.navigationController?.setColor(color: .black) } diff --git a/WOKA/Theme/View/HomeExploreCell.swift b/WOKA/Theme/View/HomeExploreCell.swift index a2865aa..49639bb 100644 --- a/WOKA/Theme/View/HomeExploreCell.swift +++ b/WOKA/Theme/View/HomeExploreCell.swift @@ -15,10 +15,10 @@ class HomeExploreCell: UICollectionViewCell { override func awakeFromNib() { super.awakeFromNib() - self.addTapGesture { [weak self] in - guard let self else{return} - btnTap() - } +// self.addTapGesture { [weak self] in +// guard let self else{return} +// btnTap() +// } } diff --git a/WOKA/Theme/ViewModel/ThemeOneVM.swift b/WOKA/Theme/ViewModel/ThemeOneVM.swift index f38a3ac..64cc101 100644 --- a/WOKA/Theme/ViewModel/ThemeOneVM.swift +++ b/WOKA/Theme/ViewModel/ThemeOneVM.swift @@ -117,8 +117,9 @@ class ThemeOneVM{ //WebSeries vc.webSeriesView.addTapGesture { ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.webSeriesView) { - - // self.vc.delegate?.didPressSwitchButton(from: self.vc) + let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesVC) as! WebSeriesVC + self.vc.navigationController?.pushViewController(vcPush, animated: true) } } diff --git a/WOKA/Theme/ViewModel/ThemeTwoVM.swift b/WOKA/Theme/ViewModel/ThemeTwoVM.swift index 039e119..af9209a 100644 --- a/WOKA/Theme/ViewModel/ThemeTwoVM.swift +++ b/WOKA/Theme/ViewModel/ThemeTwoVM.swift @@ -6,16 +6,21 @@ // import UIKit +import AVFoundation +import JWPlayerKit struct Theme2Struct{ let imageName : String let text : String } + class ThemeTwoVM{ weak var vc : ThemeTwoVC! + var liveStreamURL = "https://d3volyx7jx7oal.cloudfront.net/master.m3u8" + var avPlayer : AVPlayer! + var playerLayer: AVPlayerLayer! -// var cellData = ["WokaFMT2", "LiveTVT2", "WebSeriesT2", "GamesT2", "AudioBooksT2", "KaraokeT2", "ShopT2"] var cellData = [Theme2Struct(imageName: "WokaFMT2", text: "WOKA FM"), Theme2Struct(imageName: "LiveTVT2", text: "LIVE TV"), Theme2Struct(imageName: "WebSeriesT2", text: "WEB SERIES"), @@ -27,9 +32,131 @@ class ThemeTwoVM{ func initView(){ setupCell() NotificationCenter.default.addObserver(self, selector: #selector(self.reloadTheme), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil) + setupAvPlayer() + setUserData() + } + + func playLiveTV(){ + Utilities.startProgressHUD(msg: "Loading...") + print("tapped") + let vc = self.vc.storyboard?.instantiateViewController(identifier: "PlayerVC") as! PlayerVC + + 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() + + // Create a JWPlayerItem + let item = try JWPlayerItemBuilder() + .file(URL(string: self.liveStreamURL)!) + .title("Testing Title") +// .posterImage(URL(string: "https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg")!) + // .mediaTracks([thumbnailTrack]) + .build() + + // Create a config, and give it the item as a playlist. + let config = try JWPlayerConfigurationBuilder() + .playlist(items: [item]) + .autostart(true) +// .preload(.auto) +// .repeatContent(true) + .build() + + vc.config = config + vc.dismissTapped = self.tapped + + vc.modalPresentationStyle = .overFullScreen + Utilities.dismissProgressHUD() + self.vc.present(vc, animated: false) { + self.stopLiveStream() + vc.transitionToFullScreen(animated: true) { + print("FullScreen") + } + // vc.setDeviceOrientation(orientation: .landscapeRight) + } +// Utilities.dismissProgressHUD() +// self.vc.navigationController?.pushViewController(vc, animated: true) +// self.stopLiveStream() + } + catch { + // Handle Error + } + } + } + + func tapped(){ + Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { _ in + self.startLiveStream() + self.vc.liveTvView.layoutIfNeeded() + } + print("Sadasd") + } + + func startLiveStream(){ + avPlayer.play() + avPlayer.volume = 0 + } + + func stopLiveStream(){ + avPlayer.pause() + } + + func setUserData(){ + guard let data = AuthFunc.shareInstance.userData else{return} + //set the first name as the name + /* + Check User Type, + Dont show username if the user type is guest + */ + switch data.userType{ + case "1": // child + vc.nameLabel.text = data.fullname?.components(separatedBy: " ").first + vc.notificationBtn.isHidden = false + case "2" : // adult + vc.nameLabel.text = data.fullname?.components(separatedBy: " ").first + vc.notificationBtn.isHidden = false + case "3": // Guest + vc.nameLabel.text = "" + vc.notificationBtn.isHidden = true + break + default: + break + } + + if let avatar = data.avtar{ + //https://wokaland.com/admin/storage/app/public/uploads/avtar/avatar2.png?d=1716889852 + vc.avatarImage.imageURL("https://wokaland.com/admin/storage/app/public/uploads/avtar/avatar6.png") + } + } + + func setupAvPlayer(){ + /* + Av Player Setup + */ + let streamURL = URL(string: liveStreamURL) + + // Create AVPlayer with the stream URL + avPlayer = AVPlayer(url: streamURL!) + // avPlayer.isMuted = true + + // Create AVPlayerLayer + playerLayer = AVPlayerLayer(player: avPlayer) + playerLayer.videoGravity = .resizeAspectFill // You can set different videoGravity as per your need + + playerLayer.frame = self.vc.liveTvView.bounds + self.vc.liveTvView.layer.addSublayer(playerLayer) + + avPlayer.play() + avPlayer.volume = 0 } func setData(){ + + playerLayer.frame = self.vc.liveTvView.bounds + + guard let data = AuthFunc.shareInstance.userData else{return} //set the first name as the name /* @@ -48,11 +175,6 @@ class ThemeTwoVM{ break } - if let avatar = data.avtar{ - //https://wokaland.com/admin/storage/app/public/uploads/avtar/avatar2.png?d=1716889852 - vc.avatarImage.imageURL("https://i.pinimg.com/280x280_RS/da/0b/bd/da0bbdb22d191272f32fa2c7c7c8e5c2.jpg", color: .white) - } - } // MARK: - Notification Center Handlers diff --git a/WOKA/WebSeries/Controller/WebSeriesVC.swift b/WOKA/WebSeries/Controller/WebSeriesVC.swift new file mode 100644 index 0000000..178a323 --- /dev/null +++ b/WOKA/WebSeries/Controller/WebSeriesVC.swift @@ -0,0 +1,263 @@ +// +// WebSeriesVC.swift +// WOKA +// +// Created by MacBook Pro on 18/06/24. +// + +import UIKit + +class WebSeriesVC: UIViewController { + + @IBOutlet weak var headerView: UIView! + @IBOutlet weak var topLabel: UILabel! + @IBOutlet weak var scrollView: UIScrollView! + @IBOutlet weak var headerViewTopConstraint: NSLayoutConstraint! + + @IBOutlet weak var languageLabel: UILabel! + @IBOutlet weak var languageStack: UIStackView! + @IBOutlet weak var expandBtn: UIButton! + + @IBOutlet weak var headerHeight: NSLayoutConstraint! + @IBOutlet weak var continueWatchingCV: UICollectionView! + @IBOutlet weak var showListingTableView: UITableView! + @IBOutlet weak var tableHeight: NSLayoutConstraint! + + var vm = WebSeriesVM() + + override func viewDidLoad() { + super.viewDidLoad() + vm.vc = self + scrollView.delegate = self + vm.initView() + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationController?.navigationBar.shadowImage = UIImage() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(false, animated: animated) + self.navigationController?.setColor(color: .white) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + // Customize the navigation bar's appearance + self.navigationController?.setColor(color: .black) + } + + // MARK: - Tap Handler + + @IBAction func expandLanguageTapped(_ sender: UIButton) { + vm.dropDownModule.show() + self.expandBtn.setImage(UIImage(named: "SupportUpArrow"), for: .normal) + } + +} + +// MARK: - TableView DataSource , Delegates + +extension WebSeriesVC : TableViewSRC{ + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return vm.showData.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.WebSeries.webSeriesShowListingCell) as! WebSeriesShowListingCell + let data = vm.showData[indexPath.row] + let categoryID = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id ?? 0 + + cell.setData(data: data,selectedCategory: categoryID) + + cell.btnTapped = { [self] (type) -> Void in + updateFavLikes(type: type, index: indexPath.row) + } + + return cell + } + + func updateFavLikes(type : FavCellCLick, index : Int){ + let data = vm.showData[index] + let categoryID = vm.categoryListingData[vm.dropDownModule.indexForSelectedRow ?? 0].id ?? 0 + 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.favouriteCategoryIDS?.rawValue { + let components = categoryIds.components(separatedBy: ",") + if isFav == true && (components.first == categoryID.toString() || components.last == categoryID.toString()){ + vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in + if isDone{ + 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 + } + } + }else{ + vm.addFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in + if isDone{ + 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 + } + } + } + return + } + +// if isFav == true && data.favouriteCategoryIDS?.intValue == 0{ // means this is fav +// vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// vm.showData[index].markAsFavourite = false +// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none) +// K.GVar.reloadMyList = true +// } +// } +// }else if isFav == true && data.favouriteCategoryIDS?.intValue == categoryID{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// vm.showData[index].markAsFavourite = false +// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none) +// K.GVar.reloadMyList = true +// } +// } +// }else{ +// vm.addFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// vm.showData[index].markAsFavourite = true +// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none) +// K.GVar.reloadMyList = true +// } +// } +// } + +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// vm.showData[index].markAsFavourite = false +// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none) +// K.GVar.reloadMyList = true +// } +// } +// }else{ +// vm.addFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// vm.showData[index].markAsFavourite = true +// showListingTableView.reloadRows(at: [IndexPath(row: index, section: 0)],with: .none) +// K.GVar.reloadMyList = true +// } +// } +// } + case .liked: + guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} + if isLiked{ + vm.unlikePost(postID: postID, postType: postType, index: index) { [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{ + vm.likePost(postID: postID, postType: postType, index: index){ [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) + } + } + } + } + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + print(indexPath.row) + } +} + +// MARK: - CollectionView Delegate and Data Source + +extension WebSeriesVC : CollectionViewSRC{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return vm.continueWatchingData.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.WebSeries.webSeriesCell, for: indexPath) as! WebSeriesCell + let data = vm.continueWatchingData[indexPath.row] + cell.setData(data: data) + return cell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + print(indexPath.row) + } + +} + +// MARK: - Collection Flow Layout + +extension WebSeriesVC : UICollectionViewDelegateFlowLayout{ + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 5 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + let inset: CGFloat = 10 + return UIEdgeInsets(top: 0, left: inset, bottom: 0, right: inset) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 // Space between cells + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let widthPerItem = collectionView.frame.width - 30 // Adjust to your desired width + return CGSize(width: widthPerItem, height: 230) + } +} + + +// MARK: - Animating scrollView + +extension WebSeriesVC: UIScrollViewDelegate { + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + + // Get the current vertical offset of the scroll view + let y = scrollView.contentOffset.y + + // Define the height range for the header view + let minHeaderHeight: CGFloat = 0.0 // Height at which the header becomes invisible + let maxHeaderHeight: CGFloat = 200.0 // Maximum height when fully visible + + // Calculate the new height for the header view based on the scroll position + let newHeaderHeight: CGFloat + if y < 0 { + // When scrolling up beyond the top, ensure the header view is fully expanded + newHeaderHeight = maxHeaderHeight + } else { + // Calculate the new height for the header view, ensuring it doesn't go below the minimum height + newHeaderHeight = max(minHeaderHeight, maxHeaderHeight - y) + } + + // Update the header view's height constraint with the new height + headerHeight.constant = newHeaderHeight + + // Animate the layout changes to smoothly transition the header height + UIView.animate(withDuration: 0.3) { + self.view.layoutIfNeeded() + } + } +} + diff --git a/WOKA/WebSeries/Model/CategoryListingDM.swift b/WOKA/WebSeries/Model/CategoryListingDM.swift new file mode 100644 index 0000000..5cd2d57 --- /dev/null +++ b/WOKA/WebSeries/Model/CategoryListingDM.swift @@ -0,0 +1,33 @@ +// +// CategoryListingDM.swift +// WOKA +// +// Created by MacBook Pro on 19/06/24. +// + +import Foundation + +// MARK: - CategoryListingDM +struct CategoryListingDM: Codable { + let result: [ResultData]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case result + case totalRecords = "total_records" + } + + // MARK: - Result + struct ResultData: Codable { + let id: Int? + let categoryName: String? + let categoryThumbnail: String? + + enum CodingKeys: String, CodingKey { + case id + case categoryName = "category_name" + case categoryThumbnail = "category_thumbnail" + } + } + +} diff --git a/WOKA/WebSeries/Model/ContinueWatchingDM.swift b/WOKA/WebSeries/Model/ContinueWatchingDM.swift new file mode 100644 index 0000000..3139331 --- /dev/null +++ b/WOKA/WebSeries/Model/ContinueWatchingDM.swift @@ -0,0 +1,109 @@ +// +// ContinueWatchingDM.swift +// WOKA +// +// Created by MacBook Pro on 18/06/24. +// + +import Foundation + +// MARK: - ContinueWatchingDM +struct ContinueWatchingDM: Codable { + let result: [ResultData]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case result + case totalRecords = "total_records" + } + + // MARK: - Result + struct ResultData: Codable { + let id, watchShowsMasterID, seasonMasterID, episodeNumber: Int? + let episodeTitle, episodeDescription: String? + let thumbnailPath: String? + let thumbnailImgURL: String? + let episodeURL: String? + let languageMasterID: Int? + let tagsKeyword, episodeDuration, releaseDate: String? + let contentMoreDetails: [ContentMoreDetail]? + let showDataCount: ShowDataCount? + let userVideoView: [UserVideoView]? + let seasonNumber: String? + let markAsFavourite, isLiked: Bool? + let viewsCount, likesCount, bookmarkCount: Int? + + enum CodingKeys: String, CodingKey { + case id + case watchShowsMasterID = "watch_shows_master_id" + case seasonMasterID = "season_master_id" + case episodeNumber = "episode_number" + case episodeTitle = "episode_title" + case episodeDescription = "episode_description" + case thumbnailPath = "thumbnail_path" + case thumbnailImgURL = "thumbnail_img_url" + case episodeURL = "episode_url" + case languageMasterID = "language_master_id" + case tagsKeyword = "tags_keyword" + case episodeDuration = "episode_duration" + case releaseDate = "release_date" + case contentMoreDetails = "content_more_details" + case showDataCount = "show_data_count" + case userVideoView = "user_video_view" + case seasonNumber = "season_number" + case markAsFavourite = "mark_as_favourite" + case isLiked = "is_liked" + case viewsCount = "views_count" + case likesCount = "likes_count" + case bookmarkCount = "bookmark_count" + } + } + + // MARK: - ContentMoreDetail + struct ContentMoreDetail: Codable { + let id, contentID, postType, languageMasterID: Int? + let title, description, tagsKeywords: String? + let contentHDURL, contentSDURL: String? + + enum CodingKeys: String, CodingKey { + case id + case contentID = "content_id" + case postType = "post_type" + case languageMasterID = "language_master_id" + case title, description + case tagsKeywords = "tags_keywords" + case contentHDURL = "content_hd_url" + case contentSDURL = "content_sd_url" + } + } + + // MARK: - ShowDataCount + struct ShowDataCount: Codable { + let id, totalSeasons, totalEpisodes: Int? + + enum CodingKeys: String, CodingKey { + case id + case totalSeasons = "total_seasons" + case totalEpisodes = "total_episodes" + } + } + + // MARK: - UserVideoView + struct UserVideoView: Codable { + let id, userID, postID, postType: Int? + let totalWatchedDuration: String? + let lastWatchedLeft: String? + let categoryID: Int? + + enum CodingKeys: String, CodingKey { + case id + case userID = "user_id" + case postID = "post_id" + case postType = "post_type" + case totalWatchedDuration = "total_watched_duration" + case lastWatchedLeft = "last_watched_left" + case categoryID = "category_id" + } + } + +} diff --git a/WOKA/WebSeries/Model/WebSeriesShowListDM.swift b/WOKA/WebSeries/Model/WebSeriesShowListDM.swift new file mode 100644 index 0000000..24129db --- /dev/null +++ b/WOKA/WebSeries/Model/WebSeriesShowListDM.swift @@ -0,0 +1,192 @@ +// +// WebSeriesShowListDM.swift +// WOKA +// +// Created by MacBook Pro on 19/06/24. +// + +import Foundation + + +// MARK: - WebSeriesShowListDM +struct WebSeriesShowListDM: Codable { + let showData: [ShowDatum]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case showData = "show_data" + case totalRecords = "total_records" + } + + // MARK: - ShowDatum + struct ShowDatum: Codable { + let id: Int? + let title, description: String? + let thumbnailPath: String? + let showType: String? + let totalSeasons, totalEpisodes: Int? + let categoryMasterID: String? + let ageRangeMasterID, genderMasterID: String? + let contentMoreDetails: [MoreDetail]? + let seasonData: [SeasonDatum]? + let categoryData: [CategoryDatum]? + let ageRangeData: [AgeRangeDatum]? + let genderData: [GenderDatum]? + var markAsFavourite, isLiked: Bool? + let likedCategoryIDS: LikedCategoryIDS? + var favouriteCategoryIDS: ValueWrapper? + var likesCount : Int? + let viewsCount, bookmarkCount: Int? + + enum CodingKeys: String, CodingKey { + case id, title, description + case thumbnailPath = "thumbnail_path" + case showType = "show_type" + case totalSeasons = "total_seasons" + case totalEpisodes = "total_episodes" + case categoryMasterID = "category_master_id" + case ageRangeMasterID = "age_range_master_id" + case genderMasterID = "gender_master_id" + case contentMoreDetails = "content_more_details" + case seasonData = "season_data" + case categoryData = "category_data" + case ageRangeData = "age_range_data" + case genderData = "gender_data" + case markAsFavourite = "mark_as_favourite" + case isLiked = "is_liked" + case likedCategoryIDS = "liked_category_ids" + case favouriteCategoryIDS = "favourite_category_ids" + case viewsCount = "views_count" + case likesCount = "likes_count" + case bookmarkCount = "bookmark_count" + } + } + + // MARK: - AgeRangeDatum + struct AgeRangeDatum: Codable { + let id: Int? + let ageRange: String? + + enum CodingKeys: String, CodingKey { + case id + case ageRange = "age_range" + } + } + + // MARK: - CategoryDatum + struct CategoryDatum: Codable { + let id: Int? + let categoryName: CategoryName? + + enum CodingKeys: String, CodingKey { + case id + case categoryName = "category_name" + } + } + + enum CategoryName: String, Codable { + case english = "English" + case hindi = "Hindi" + } + +// enum CategoryMasterID: String, Codable { +// case the118 = "1,18" +// } + + // MARK: - MoreDetail + struct MoreDetail: Codable { + let id, contentID, postType, languageMasterID: Int? + let title, description, tagsKeywords: String? + let trailerHDURL, trailerSDURL: String? + + enum CodingKeys: String, CodingKey { + case id + case contentID = "content_id" + case postType = "post_type" + case languageMasterID = "language_master_id" + case title, description + case tagsKeywords = "tags_keywords" + case trailerHDURL = "trailer_hd_url" + case trailerSDURL = "trailer_sd_url" + } + } + + // MARK: - GenderDatum + struct GenderDatum: Codable { + let id: Int? + let genderName: String? + + enum CodingKeys: String, CodingKey { + case id + case genderName = "gender_name" + } + } + + enum LikedCategoryIDS: Codable { + case integer(Int) + case string(String) + case null + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let x = try? container.decode(Int.self) { + self = .integer(x) + return + } + if let x = try? container.decode(String.self) { + self = .string(x) + return + } + if container.decodeNil() { + self = .null + return + } + throw DecodingError.typeMismatch(LikedCategoryIDS.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Wrong type for LikedCategoryIDS")) + } + + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case .integer(let x): + try container.encode(x) + case .string(let x): + try container.encode(x) + case .null: + try container.encodeNil() + } + } + } + + // MARK: - SeasonDatum + struct SeasonDatum: Codable { + let id, watchShowsMasterID: Int? + let seasonNumber: String? + let noOfEpisodes: Int? + let seasonDescription: String? + let releaseYear: Int? + let seasonTitle: String? + let trailerURL: String? + let thumbnailPath: String? + let thumbnailImgURL: String? + let tagsKeyword, releaseDate: String? + let seasonMoreDetails: [MoreDetail]? + + enum CodingKeys: String, CodingKey { + case id + case watchShowsMasterID = "watch_shows_master_id" + case seasonNumber = "season_number" + case noOfEpisodes = "no_of_episodes" + case seasonDescription = "season_description" + case releaseYear = "release_year" + case seasonTitle = "season_title" + case trailerURL = "trailer_url" + case thumbnailPath = "thumbnail_path" + case thumbnailImgURL = "thumbnail_img_url" + case tagsKeyword = "tags_keyword" + case releaseDate = "release_date" + case seasonMoreDetails = "season_more_details" + } + } + +} + diff --git a/WOKA/WebSeries/View/WebSeriesCell.swift b/WOKA/WebSeries/View/WebSeriesCell.swift new file mode 100644 index 0000000..93adff6 --- /dev/null +++ b/WOKA/WebSeries/View/WebSeriesCell.swift @@ -0,0 +1,40 @@ +// +// WebSeriesCell.swift +// WOKA +// +// Created by MacBook Pro on 18/06/24. +// + +import UIKit + +class WebSeriesCell: UICollectionViewCell { + + @IBOutlet weak var cellImage: UIImageView! + @IBOutlet weak var cellTitle: UILabel! + @IBOutlet weak var episodeSeason: UILabel! + @IBOutlet weak var outerStack: UIStackView! + + override func awakeFromNib() { + super.awakeFromNib() + + // Initialization code + } + + override func layoutSubviews() { + super.layoutSubviews() + outerStack.roundCorner(radius: 10) + cellImage.addBorderView(width: 0.5, color: .white) + } + + func setData(data : ContinueWatchingDM.ResultData){ + self.cellTitle.text = data.episodeTitle + let seasonNumer = "S" + (data.seasonNumber ?? "0") + let episodeNumer = "E" + (data.episodeNumber?.toString() ?? "0") + self.episodeSeason.text = seasonNumer + "-" + episodeNumer + + if let url = data.thumbnailPath{ + cellImage.imageURL(url , color: .black) + } + } + +} diff --git a/WOKA/WebSeries/View/WebSeriesCell.xib b/WOKA/WebSeries/View/WebSeriesCell.xib new file mode 100644 index 0000000..a98ceab --- /dev/null +++ b/WOKA/WebSeries/View/WebSeriesCell.xib @@ -0,0 +1,92 @@ + + + + + + + + + + + + Exo2-Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/WebSeries/View/WebSeriesShowListingCell.swift b/WOKA/WebSeries/View/WebSeriesShowListingCell.swift new file mode 100644 index 0000000..3cf6cf8 --- /dev/null +++ b/WOKA/WebSeries/View/WebSeriesShowListingCell.swift @@ -0,0 +1,90 @@ +// +// WebSeriesShowListingCell.swift +// WOKA +// +// Created by MacBook Pro on 19/06/24. +// + +import UIKit + +class WebSeriesShowListingCell: UITableViewCell { + + @IBOutlet weak var showThumbnail: UIImageView! + @IBOutlet weak var showTitle: UILabel! + @IBOutlet weak var totalLikes: UILabel! + @IBOutlet weak var likeBtn: UIButton! + @IBOutlet weak var favBtn: UIButton! + + typealias btnTappedBlock = ( _ from : FavCellCLick) -> Void // 0 - plus 1 - minus + var btnTapped : btnTappedBlock! + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + func setData(data : WebSeriesShowListDM.ShowDatum, selectedCategory : Int){ + //heart.fill , heart , hand.thumbsup.fill , hand.thumbsup + if AuthFunc.shareInstance.getDefaultLanguage() == .english{ + showTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title + }else{ + showTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title + } + totalLikes.text = data.likesCount?.toString() ?? "0" + + if let url = data.thumbnailPath{ + showThumbnail.imageURL(url) + } + + if let like = data.isLiked{ + switch like{ + case true: + likeBtn.setImage(UIImage(systemName: "hand.thumbsup.fill"), for: .normal) + case false: + likeBtn.setImage(UIImage(systemName: "hand.thumbsup"), for: .normal) + } + } + + if let favourite = data.markAsFavourite{ + if let categoryIds = data.favouriteCategoryIDS?.rawValue { // if string, it means category is selected for multiple language + let components = categoryIds.components(separatedBy: ",") + if favourite == true && (components.first == selectedCategory.toString() || components.last == selectedCategory.toString()){ + favBtn.setImage(UIImage(systemName: "heart.fill"), for: .normal) + }else{ + favBtn.setImage(UIImage(systemName: "heart"), for: .normal) + } + return + } + + if favourite == true && data.favouriteCategoryIDS?.intValue == selectedCategory{ + favBtn.setImage(UIImage(systemName: "heart.fill"), for: .normal) + }else{ + favBtn.setImage(UIImage(systemName: "heart"), for: .normal) + } +// switch favourite{ +// case true: +// favBtn.setImage(UIImage(systemName: "heart.fill"), for: .normal) +// case false: +// favBtn.setImage(UIImage(systemName: "heart"), for: .normal) +// +// } + } + + + } + + @IBAction func btnTapped(_ sender: UIButton) { + switch sender{ + case likeBtn: + if btnTapped != nil { + btnTapped( .liked) + } + case favBtn: + if btnTapped != nil { + btnTapped( .favourite) + } + default: + break + } + } +} diff --git a/WOKA/WebSeries/View/WebSeriesShowListingCell.xib b/WOKA/WebSeries/View/WebSeriesShowListingCell.xib new file mode 100644 index 0000000..d72afa0 --- /dev/null +++ b/WOKA/WebSeries/View/WebSeriesShowListingCell.xib @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + Exo2-Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/WebSeries/ViewModel/WebSeriesVM.swift b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift new file mode 100644 index 0000000..3a85dbf --- /dev/null +++ b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift @@ -0,0 +1,337 @@ +// +// WebSeriesVM.swift +// WOKA +// +// Created by MacBook Pro on 18/06/24. +// + +import Foundation +import Alamofire + +class WebSeriesVM{ + + weak var vc : WebSeriesVC! + var continueWatchingData = [ContinueWatchingDM.ResultData]() + var categoryListingData = [CategoryListingDM.ResultData]() + var showData = [WebSeriesShowListDM.ShowDatum]() + + let dropDownModule = DropDown() + var dataSource = [String]() + + func initView(){ + vc.scrollView.indicatorStyle = .white // or .white + + let color1 = #colorLiteral(red: 0.5921568627, green: 0.2588235294, blue: 0.8941176471, alpha: 1) + let color2 = #colorLiteral(red: 0.368627451, green: 0.1215686275, blue: 0.768627451, alpha: 1) + + vc.title = "WEB SERIES".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + vc.view.applyGradient(colors: [color2, color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) + + getContinueWatching() + getCategoryListing() + + // for the first load always send hindi as it is default category + getShowListing(categoryID: 18) + + vc.languageStack.addTapGesture { [weak self] in + guard let self else {return} + dropDownModule.show() + self.vc.expandBtn.setImage(UIImage(named: "SupportUpArrow"), for: .normal) + } + setupCell() + } + + func setupCell(){ + vc.continueWatchingCV.register(UINib(nibName: K.CellIdentifier.WebSeries.webSeriesCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.WebSeries.webSeriesCell) + vc.continueWatchingCV.delegate = vc.self + vc.continueWatchingCV.dataSource = vc.self + + vc.showListingTableView.register(UINib(nibName: K.CellIdentifier.WebSeries.webSeriesShowListingCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.WebSeries.webSeriesShowListingCell) + vc.showListingTableView.delegate = vc.self + vc.showListingTableView.dataSource = vc.self + } + + // MARK: - DropDown + + func initDropDown(){ + dropDownModule.anchorView = vc.languageStack + dropDownModule.dataSource = dataSource + dropDownModule.cornerRadius = 10 + dropDownModule.bottomOffset = CGPoint(x: 0, y:(dropDownModule.anchorView?.plainView.bounds.height)!) + dropDownModule.topOffset = CGPoint(x: 0, y:-(dropDownModule.anchorView?.plainView.bounds.height)!) + dropDownModule.direction = .bottom + dropDownModule.textFont = FontCustom.shareInstance.customFont(fontName: .Exo2_Bold, size: 14) + dropDownModule.shadowColor = UIColor.appColor(.TextDarkBlue)! + dropDownModule.backgroundColor = .white + dropDownModule.shadowOffset = CGSize(width: 0, height: 1) + dropDownModule.separatorColor = UIColor.lightGray + dropDownModule.width = vc.languageStack.frame.width + dropDownModule.selectionBackgroundColor = UIColor.appColor(.TextDarkBlue)! + dropDownModule.selectedTextColor = .white + dropDownModule.selectRow(at: 0) + dropDownModule.selectionAction = { [weak self] (index: Int, item: String) in + guard let self else{return} + vc.languageLabel.text = item + vc.expandBtn.setImage(UIImage(named: "SupportBottomArrow"), for: .normal) + + //if the language is changed call the showlisting api + if let id = categoryListingData[index].id { + getShowListing(categoryID: id) + } + + } + } + // MARK: - Api Calls + + func getContinueWatching(){ + Utilities.startProgressHUD() +// let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let headers : HTTPHeaders = ["access-token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3dva2FsYW5kLmNvbS9hZG1pbi9hcGkvbG9naW5fcHJvY2VlZCIsImlhdCI6MTcxODcxNTk4OSwiZXhwIjoxNzUwMjUxOTg5LCJuYmYiOjE3MTg3MTU5ODksImp0aSI6Ilh1QzVIdjY1RkcwQ1hqUkYiLCJzdWIiOiIyMTYiLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.w8AfPv_6WUoDiBRcJzHz036qhaxfw_R9Gcb2C2wGLvs"] + let params : Parameters = ["post_type" : 3] // 3- webseries + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.WebSeries.continue_watching, method: .post,parameters: params,headers : headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + self.continueWatchingData = data + self.vc.continueWatchingCV.reloadData() + default: + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + vc.toast(msg: error.localizedDescription , time: 2) + } + } + } + + func getShowListing(categoryID : Int){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["category_id" : categoryID] // from category listing api , default will be 1 + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.WebSeries.watch_show_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.showData else{return} + self.showData.removeAll() + self.showData = data + self.vc.showListingTableView.reloadData() + self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height + 100 + self.vc.showListingTableView.layoutIfNeeded() + self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height + default: + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + vc.toast(msg: error.localizedDescription , time: 2) + } + } + } + + func getCategoryListing(){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["module_id" : 7] // 7 - webseries + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.WebSeries.category_listing, method: .post,parameters: params,headers : headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + self.categoryListingData = data + dataSource = categoryListingData.map({$0.categoryName ?? "Unknown"}) + initDropDown() + default: + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + vc.toast(msg: error.localizedDescription , time: 2) + } + } + } + + // MARK: - Like , unlike + + func likePost(postID : Int, postType : Int, index : Int , onCompletion : @escaping (Bool) -> Void){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi", + "access-token": AuthFunc.shareInstance.getAccessToken()] + + let params : Parameters = ["post_id" : postID, + "post_type" : postType] + + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.post_like, method: .post, parameters: params, headers: headers) { [weak self](result : Result) in + switch result{ + case .success(let data): + guard let self else{return} + switch data.success{ + case 0: + Utilities.dismissProgressHUD() + self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + onCompletion(false) + case 1: + Utilities.dismissProgressHUD() + onCompletion(true) + default: + Utilities.dismissProgressHUD() + onCompletion(false) + } + case .failure(let error): + guard let self else{return} + Utilities.dismissProgressHUD() + self.vc.toast(msg: error.localizedDescription , time: 2) + onCompletion(false) + } + } + } + + func unlikePost(postID : Int, postType : Int , index : Int, onCompletion : @escaping (Bool) -> Void){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi", + "access-token": AuthFunc.shareInstance.getAccessToken()] + + let params : Parameters = ["post_id" : postID, + "post_type" : postType] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.post_unlike, method: .post, parameters: params, headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{return} + switch data.success{ + case 0: + Utilities.dismissProgressHUD() + self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + onCompletion(false) + case 1: + Utilities.dismissProgressHUD() + onCompletion(true) + default: + Utilities.dismissProgressHUD() + onCompletion(false) + } + case .failure(let error): + guard let self else{return} + Utilities.dismissProgressHUD() + self.vc.toast(msg: error.localizedDescription , time: 2) + onCompletion(false) + } + } + } + + // MARK: - Remove Favourite + + func removeFavourite(postID : Int, postType : Int, categoryID : Int, index : Int , onCompletion : @escaping (Bool) -> Void){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi", + "access-token": AuthFunc.shareInstance.getAccessToken()] + + let params : Parameters = ["id" : postID, + "post_type" : postType, + "category_id" : categoryID] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.favourite_remove, method: .post, parameters: params, headers: headers) { [weak self](result : Result) in + switch result{ + case .success(let data): + guard let self else{return} + switch data.success{ + case 0: + Utilities.dismissProgressHUD() + self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + onCompletion(false) + case 1: + Utilities.dismissProgressHUD() + onCompletion(true) + default: + Utilities.dismissProgressHUD() + onCompletion(false) + } + case .failure(let error): + guard let self else{return} + Utilities.dismissProgressHUD() + self.vc.toast(msg: error.localizedDescription , time: 2) + onCompletion(false) + } + } + } + + func addFavourite(postID : Int, postType : Int, categoryID : Int, index : Int , onCompletion : @escaping (Bool) -> Void){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi", + "access-token": AuthFunc.shareInstance.getAccessToken()] + + let params : Parameters = ["post_id" : postID, + "post_type" : postType, + "category_id" : categoryID] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.favourite_add, method: .post, parameters: params, headers: headers) { [weak self](result : Result) in + switch result{ + case .success(let data): + guard let self else{return} + switch data.success{ + case 0: + Utilities.dismissProgressHUD() + self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + onCompletion(false) + case 1: + Utilities.dismissProgressHUD() + onCompletion(true) + default: + Utilities.dismissProgressHUD() + onCompletion(false) + } + case .failure(let error): + guard let self else{return} + Utilities.dismissProgressHUD() + self.vc.toast(msg: error.localizedDescription , time: 2) + onCompletion(false) + } + } + } +} diff --git a/WOKA/WebSeries/WebSeries.storyboard b/WOKA/WebSeries/WebSeries.storyboard new file mode 100644 index 0000000..16891c0 --- /dev/null +++ b/WOKA/WebSeries/WebSeries.storyboard @@ -0,0 +1,248 @@ + + + + + + + + + + + + + Exo2-Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +