From 3754a7f75b1a7a6ef89516506eaaa6bad5993e35 Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Thu, 13 Jun 2024 19:54:44 +0530 Subject: [PATCH] - Fixed the blog image issue for fit. - Finalised more module. - Made UI for notifications - Made notification cells - Added pull to refresh - Worked on logic for Favourites. - Getting the logic data, then separating the hindi web series - Added collection for Webseries hindi , English , Audio book, karaoke, games - MAde the data model for favourites --- WOKA.xcodeproj/project.pbxproj | 40 ++++ .../Home/BackArrow.imageset/Contents.json | 24 ++ .../Home/BackArrow.imageset/back.png | Bin 0 -> 392 bytes WOKA/Constants K/CellIdentifier.swift | 2 + WOKA/Constants K/StoryBoardID.swift | 2 + WOKA/Helpers/DateFormatterLib.swift | 3 +- WOKA/Home/Controller/MyListVC.swift | 127 ++++++++++- WOKA/Home/Home.storyboard | 213 +++++++++++++++++- WOKA/Home/Model/FavouriteListingDM.swift | 123 ++++++++++ WOKA/Home/View/FavouriteCell.swift | 78 +++++++ WOKA/Home/View/FavouriteCell.xib | 134 +++++++++++ WOKA/Home/ViewModel/MyListVM.swift | 92 ++++++++ WOKA/Main/Delegate/AppDelegate.swift | 13 -- WOKA/Network Adapter/APIEndPoints.swift | 2 + WOKA/Theme/Base.lproj/Theme.storyboard | 114 +++++++++- WOKA/Theme/CommonNwCall.swift | 48 ++++ WOKA/Theme/Controller/MoreVC.swift | 6 +- WOKA/Theme/Controller/RadioVC.swift | 60 +++++ WOKA/Theme/Controller/ThemeOneVC.swift | 17 ++ .../Theme/Controller/UserNotificationVC.swift | 79 +++++++ WOKA/Theme/Model/UserNotificationDM.swift | 27 +++ WOKA/Theme/View/BlogsCell.xib | 37 +-- WOKA/Theme/View/UserNotificationCell.swift | 51 +++++ WOKA/Theme/View/UserNotificationCell.xib | 75 ++++++ WOKA/Theme/ViewModel/MoreVM.swift | 12 + WOKA/Theme/ViewModel/ThemeOneVM.swift | 2 - 26 files changed, 1333 insertions(+), 48 deletions(-) create mode 100644 WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/Contents.json create mode 100644 WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/back.png create mode 100644 WOKA/Home/Model/FavouriteListingDM.swift create mode 100644 WOKA/Home/View/FavouriteCell.swift create mode 100644 WOKA/Home/View/FavouriteCell.xib create mode 100644 WOKA/Home/ViewModel/MyListVM.swift create mode 100644 WOKA/Theme/CommonNwCall.swift create mode 100644 WOKA/Theme/Controller/RadioVC.swift create mode 100644 WOKA/Theme/Controller/UserNotificationVC.swift create mode 100644 WOKA/Theme/Model/UserNotificationDM.swift create mode 100644 WOKA/Theme/View/UserNotificationCell.swift create mode 100644 WOKA/Theme/View/UserNotificationCell.xib diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 41d9ffb..47bd7ca 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -16,6 +16,11 @@ 522A93132C0DB5D50098FE49 /* JWPlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 522A93122C0DB5D50098FE49 /* JWPlayerKit */; }; 522A931A2C0DE8CC0098FE49 /* SideBarNav.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 522A93192C0DE8CC0098FE49 /* SideBarNav.storyboard */; }; 522A931C2C0DE9150098FE49 /* AboutUsVc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522A931B2C0DE9150098FE49 /* AboutUsVc.swift */; }; + 522D655E2C1ACCF40021E505 /* UserNotificationDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522D655D2C1ACCF40021E505 /* UserNotificationDM.swift */; }; + 522D65602C1ACD8D0021E505 /* UserNotificationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522D655F2C1ACD8C0021E505 /* UserNotificationVC.swift */; }; + 522D65622C1ACDA40021E505 /* CommonNwCall.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522D65612C1ACDA40021E505 /* CommonNwCall.swift */; }; + 522D65652C1ACE9C0021E505 /* UserNotificationCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 522D65642C1ACE9C0021E505 /* UserNotificationCell.xib */; }; + 522D65662C1ACE9C0021E505 /* UserNotificationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522D65632C1ACE9C0021E505 /* UserNotificationCell.swift */; }; 523ED25E2BDA2BC700CFED02 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 523ED25D2BDA2BC700CFED02 /* AppDelegate.swift */; }; 523ED2602BDA2BC700CFED02 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 523ED25F2BDA2BC700CFED02 /* SceneDelegate.swift */; }; 523ED2622BDA2BC700CFED02 /* SplashVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 523ED2612BDA2BC700CFED02 /* SplashVC.swift */; }; @@ -82,6 +87,10 @@ 52A3F6AB2BECBF550000BB0B /* LinkedChildVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */; }; 52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */; }; 52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */; }; + 52A981CE2C1AFE66000E0BEC /* FavouriteListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981CD2C1AFE66000E0BEC /* FavouriteListingDM.swift */; }; + 52A981D02C1AFEE8000E0BEC /* MyListVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981CF2C1AFEE8000E0BEC /* MyListVM.swift */; }; + 52A981D72C1B0E27000E0BEC /* FavouriteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981D52C1B0E27000E0BEC /* FavouriteCell.swift */; }; + 52A981D82C1B0E27000E0BEC /* FavouriteCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52A981D62C1B0E27000E0BEC /* FavouriteCell.xib */; }; 52AECA802C08BCB6004A7579 /* PlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52AECA7F2C08BCB6004A7579 /* PlayerVC.swift */; }; 52B8D4D92C04A25E00ED65F3 /* UIViewController+Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B8D4CE2C04A25D00ED65F3 /* UIViewController+Container.swift */; }; 52B8D4DA2C04A25E00ED65F3 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B8D4CF2C04A25D00ED65F3 /* Preferences.swift */; }; @@ -126,6 +135,7 @@ 52CA28FA2BE119F500708B49 /* UserIntrestVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52CA28F92BE119F500708B49 /* UserIntrestVC.swift */; }; 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 */; }; 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 */; }; @@ -220,6 +230,11 @@ 522242692BFC7AFC0085C632 /* SideMenuVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenuVC.swift; sourceTree = ""; }; 522A93192C0DE8CC0098FE49 /* SideBarNav.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SideBarNav.storyboard; sourceTree = ""; }; 522A931B2C0DE9150098FE49 /* AboutUsVc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutUsVc.swift; sourceTree = ""; }; + 522D655D2C1ACCF40021E505 /* UserNotificationDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNotificationDM.swift; sourceTree = ""; }; + 522D655F2C1ACD8C0021E505 /* UserNotificationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNotificationVC.swift; sourceTree = ""; }; + 522D65612C1ACDA40021E505 /* CommonNwCall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonNwCall.swift; sourceTree = ""; }; + 522D65632C1ACE9C0021E505 /* UserNotificationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNotificationCell.swift; sourceTree = ""; }; + 522D65642C1ACE9C0021E505 /* UserNotificationCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UserNotificationCell.xib; sourceTree = ""; }; 523ED25A2BDA2BC700CFED02 /* WOKA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WOKA.app; sourceTree = BUILT_PRODUCTS_DIR; }; 523ED25D2BDA2BC700CFED02 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 523ED25F2BDA2BC700CFED02 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -284,6 +299,10 @@ 52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVC.swift; sourceTree = ""; }; 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = ""; }; 52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVM.swift; sourceTree = ""; }; + 52A981CD2C1AFE66000E0BEC /* FavouriteListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouriteListingDM.swift; sourceTree = ""; }; + 52A981CF2C1AFEE8000E0BEC /* MyListVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListVM.swift; sourceTree = ""; }; + 52A981D52C1B0E27000E0BEC /* FavouriteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouriteCell.swift; sourceTree = ""; }; + 52A981D62C1B0E27000E0BEC /* FavouriteCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FavouriteCell.xib; sourceTree = ""; }; 52AECA7F2C08BCB6004A7579 /* PlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerVC.swift; sourceTree = ""; }; 52B8D4CE2C04A25D00ED65F3 /* UIViewController+Container.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Container.swift"; sourceTree = ""; }; 52B8D4CF2C04A25D00ED65F3 /* Preferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = ""; }; @@ -330,6 +349,7 @@ 52CA28F92BE119F500708B49 /* UserIntrestVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIntrestVC.swift; sourceTree = ""; }; 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 = ""; }; 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 = ""; }; @@ -696,6 +716,7 @@ 525327D12BFCC1BC00F64283 /* Model */ = { isa = PBXGroup; children = ( + 52A981CD2C1AFE66000E0BEC /* FavouriteListingDM.swift */, ); path = Model; sourceTree = ""; @@ -703,6 +724,7 @@ 525327D32BFCC1C900F64283 /* ViewModel */ = { isa = PBXGroup; children = ( + 52A981CF2C1AFEE8000E0BEC /* MyListVM.swift */, ); path = ViewModel; sourceTree = ""; @@ -882,6 +904,7 @@ 52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */, 52BC3BEF2C1701F8002FACA6 /* BlogDM.swift */, 527AC6F92C17387300434FB7 /* SongBlogDM.swift */, + 522D655D2C1ACCF40021E505 /* UserNotificationDM.swift */, ); path = Model; sourceTree = ""; @@ -895,6 +918,8 @@ 527AC6F62C171C8F00434FB7 /* BlogsCell.xib */, 527AC6FB2C173A5100434FB7 /* SongListCell.swift */, 527AC6FC2C173A5100434FB7 /* SongListCell.xib */, + 522D65632C1ACE9C0021E505 /* UserNotificationCell.swift */, + 522D65642C1ACE9C0021E505 /* UserNotificationCell.xib */, ); path = View; sourceTree = ""; @@ -937,6 +962,8 @@ 9C535DC72C00BF3E00DA6DCD /* View */ = { isa = PBXGroup; children = ( + 52A981D52C1B0E27000E0BEC /* FavouriteCell.swift */, + 52A981D62C1B0E27000E0BEC /* FavouriteCell.xib */, ); path = View; sourceTree = ""; @@ -948,6 +975,7 @@ 52F12C812C04569500AF8139 /* View */, 9C535DCC2C00CD1200DA6DCD /* ViewModel */, 9C535DCB2C00CD0800DA6DCD /* Controller */, + 522D65612C1ACDA40021E505 /* CommonNwCall.swift */, 52C1A4E72C05C95D007BAA50 /* Theme.storyboard */, ); path = Theme; @@ -960,6 +988,8 @@ 9C535DC12C00B36900DA6DCD /* ThemeTwoVC.swift */, 52AECA7F2C08BCB6004A7579 /* PlayerVC.swift */, 52BC3BED2C16FBDB002FACA6 /* MoreVC.swift */, + 522D655F2C1ACD8C0021E505 /* UserNotificationVC.swift */, + 52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */, ); path = Controller; sourceTree = ""; @@ -1247,8 +1277,10 @@ 52C8B05B2BDA5924003B51D0 /* WokaSplashSound.m4a in Resources */, 525954352BEB4B3B00191286 /* Exo2-Thin.ttf in Resources */, 527AC6F82C171C8F00434FB7 /* BlogsCell.xib in Resources */, + 52A981D82C1B0E27000E0BEC /* FavouriteCell.xib in Resources */, 52C1A4E82C05C95D007BAA50 /* Theme.storyboard in Resources */, 525954362BEB4B3B00191286 /* Exo2-Medium.ttf in Resources */, + 522D65652C1ACE9C0021E505 /* UserNotificationCell.xib in Resources */, 525954372BEB4B3B00191286 /* Exo2-Bold.ttf in Resources */, 525954382BEB4B3B00191286 /* Exo2-Regular.ttf in Resources */, 525954392BEB4B3B00191286 /* Exo2-ExtraBold.ttf in Resources */, @@ -1360,6 +1392,7 @@ 522242662BFC74380085C632 /* MyListVC.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 */, 52B8D4E12C04A25E00ED65F3 /* BasicTransitionAnimator.swift in Sources */, @@ -1406,6 +1439,7 @@ 9CBCB2AA2BE51A52007D7934 /* ThemeOneVC.swift in Sources */, 52D774E92BDFBDA4001D87DE /* AuthenticationStringConstant.swift in Sources */, 5259541B2BE8D6F900191286 /* NetworkReachibility.swift in Sources */, + 52A981CE2C1AFE66000E0BEC /* FavouriteListingDM.swift in Sources */, 527AC6FD2C173A5100434FB7 /* SongListCell.swift in Sources */, 9C27E1672BDB706700EC1DA9 /* StoryBoard.swift in Sources */, 52C8B0692BDA6E1E003B51D0 /* LocalizedEnum.swift in Sources */, @@ -1413,6 +1447,7 @@ 525954172BE8CAD300191286 /* NetworkManager.swift in Sources */, 52B8D4DD2C04A25E00ED65F3 /* UIViewController+SideMenu.swift in Sources */, 525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */, + 522D655E2C1ACCF40021E505 /* UserNotificationDM.swift in Sources */, 9C1C69FC2C106C240035B2C7 /* ContactSupportVM.swift in Sources */, 52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */, 525954252BE8F01600191286 /* ValueWrapper.swift in Sources */, @@ -1429,6 +1464,7 @@ 52BC3BEC2C16DF9F002FACA6 /* MyOrdersVC.swift in Sources */, 9C56E8482BDBEFAB00E4CA14 /* AssetColor.swift in Sources */, 9C0A85432BEE3EC90093783D /* NewPasswordVM.swift in Sources */, + 522D65662C1ACE9C0021E505 /* UserNotificationCell.swift in Sources */, 524C42332C049D590016A11C /* CustomizableSegmentControl.swift in Sources */, 9C535DB52C005A6D00DA6DCD /* KeyWindowFix.swift in Sources */, 9C9BEEC72BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift in Sources */, @@ -1438,6 +1474,7 @@ 524C42312C0499560016A11C /* NotificationCenterReloads.swift in Sources */, 9C8C4FAE2C1315410017DD3B /* WebViewVC.swift in Sources */, 52BC3BE22C0E02EE002FACA6 /* FaqVC.swift in Sources */, + 52A981D02C1AFEE8000E0BEC /* MyListVM.swift in Sources */, 5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */, 525954272BE9178F00191286 /* UserDataDM.swift in Sources */, 9C27E1652BDB6FBC00EC1DA9 /* StoryBoardID.swift in Sources */, @@ -1449,9 +1486,11 @@ 522242682BFC74380085C632 /* TabBarVC.swift in Sources */, 9C27E1722BDB86B600EC1DA9 /* OnBoardCell.swift in Sources */, 529B0DD42C06156B00CFC54B /* LoginNavVC.swift in Sources */, + 52A981D72C1B0E27000E0BEC /* FavouriteCell.swift in Sources */, 52C8B05F2BDA5AFA003B51D0 /* SplashVM.swift in Sources */, 52C1A4E12C05B69F007BAA50 /* UIApplicationSwitchRoot.swift in Sources */, 52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */, + 522D65602C1ACD8D0021E505 /* UserNotificationVC.swift in Sources */, 9C535DC22C00B36900DA6DCD /* ThemeTwoVC.swift in Sources */, 9CA7C6C22C1095B600D73742 /* ProfileVM.swift in Sources */, 52D774F12BDFC53B001D87DE /* StringSubScript.swift in Sources */, @@ -1468,6 +1507,7 @@ 9C27E16D2BDB852F00EC1DA9 /* GVar.swift in Sources */, 52B8D4E02C04A25E00ED65F3 /* UIView+Container.swift in Sources */, 9C56E8462BDBEE6400E4CA14 /* EmailVC.swift in Sources */, + 522D65622C1ACDA40021E505 /* CommonNwCall.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/BackArrow.imageset/Contents.json b/WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/Contents.json new file mode 100644 index 0000000..345d811 --- /dev/null +++ b/WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "back.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" + } +} diff --git a/WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/back.png b/WOKA/Assets/Assets.xcassets/Home/BackArrow.imageset/back.png new file mode 100644 index 0000000000000000000000000000000000000000..480d179e4d67a928ea552a2c50a41bef4b19878e GIT binary patch literal 392 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!n2Vh}LpV4%Za?&Y0OWEOctjQh zMc08a{a_D^{*rz5BwuPk*!y{wM{i zYW8$-42d}W_PV)HgMx@_;F-uHZ|?th%GJqzVkY$B{M>rdLOg~}&_&nEU z`PLROADs#FSC_NOazEMhHuhjq$;X?=+tugqtEt(4{=f91Zu9LmX3x%o!obtj&t;uc GLK6UaiF%#@ literal 0 HcmV?d00001 diff --git a/WOKA/Constants K/CellIdentifier.swift b/WOKA/Constants K/CellIdentifier.swift index b83b809..d724a71 100644 --- a/WOKA/Constants K/CellIdentifier.swift +++ b/WOKA/Constants K/CellIdentifier.swift @@ -34,6 +34,8 @@ extension K{ struct Home{ static let blogsCell = "BlogsCell" static let songListCell = "SongListCell" + static let userNotificationCell = "UserNotificationCell" + static let favouriteCell = "FavouriteCell" } } } diff --git a/WOKA/Constants K/StoryBoardID.swift b/WOKA/Constants K/StoryBoardID.swift index efa9015..c0f8139 100644 --- a/WOKA/Constants K/StoryBoardID.swift +++ b/WOKA/Constants K/StoryBoardID.swift @@ -31,6 +31,7 @@ extension K{ struct Home{ static let homeVC = "HomeVC" + static let userNotificationVC = "UserNotificationVC" } struct CustomAlerts{ @@ -42,6 +43,7 @@ extension K{ static let themeOneVC = "ThemeOneVC" static let themeTwoVC = "ThemeTwoVC" static let moreVC = "MoreVC" + static let radioVC = "RadioVC" } struct SideBarNav{ diff --git a/WOKA/Helpers/DateFormatterLib.swift b/WOKA/Helpers/DateFormatterLib.swift index 9d17ba9..e87192b 100644 --- a/WOKA/Helpers/DateFormatterLib.swift +++ b/WOKA/Helpers/DateFormatterLib.swift @@ -227,9 +227,10 @@ enum DateFormats: String, CaseIterable { case d = "d" // 2 case EEEE = "EEEE" // wednesday case EEE = "EEE" // wed - case yyyy_MM_dd_T_HH_mm_ss_SSSZ = "yyyy_MM_dd_T_HH_mm_ss_SSSZ" + case yyyy_MM_dd_THH_mm_ss_SSSZ = "yyyy_MM_dd_THH:mm:ss.SSSZ" // 2024-05-21T17:50:15.000000Z + case yyyy_MM_ddTHH_mm_ss_ssZ = "yyyy-MM-dd'T'HH:mm:ss:ssZ" // case yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss" // 2023-07-25 14:03:07 diff --git a/WOKA/Home/Controller/MyListVC.swift b/WOKA/Home/Controller/MyListVC.swift index a6e6ea8..7eee5fb 100644 --- a/WOKA/Home/Controller/MyListVC.swift +++ b/WOKA/Home/Controller/MyListVC.swift @@ -8,12 +8,137 @@ import UIKit class MyListVC: UIViewController { + + @IBOutlet weak var webSeriesCV: UICollectionView! + @IBOutlet weak var webSeriesEnglishStack: UIStackView! + + @IBOutlet weak var webSeriesHindiCV: UICollectionView! + @IBOutlet weak var webSeriesHindiStack: UIStackView! + + @IBOutlet weak var audioBooksCV: UICollectionView! + @IBOutlet weak var audioBooksStack: UIStackView! + + @IBOutlet weak var karaokeCV: UICollectionView! + @IBOutlet weak var karaokeStack: UIStackView! + + @IBOutlet weak var gamesCV: UICollectionView! + @IBOutlet weak var gamesStack: UIStackView! + + var vm = MyListVM() + override func viewDidLoad() { super.viewDidLoad() - + vm.vc = self + vm.initView() } + @IBAction func sideBarBtnTapped(_ sender: UIButton) { self.sideMenuController?.revealMenu() } + @IBAction func backBtntapped(_ sender: UIButton) { + self.tabBarController?.selectedIndex = 0 + } + } +// MARK: - CollectionView Delegate + +extension MyListVC : CollectionViewSRC{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + switch collectionView{ + case webSeriesCV: + if vm.favListingData?.showData?.count == 0{ + webSeriesEnglishStack.isHidden = true + }else{ + webSeriesEnglishStack.isHidden = false + } + return vm.favListingData?.showData?.count ?? 0 + case audioBooksCV: + if vm.favListingData?.audioData?.count == 0{ + audioBooksStack.isHidden = true + }else{ + audioBooksStack.isHidden = false + } + return vm.favListingData?.audioData?.count ?? 0 + case karaokeCV: + if vm.favListingData?.singKaraokeData?.count == 0{ + karaokeStack.isHidden = true + }else{ + karaokeStack.isHidden = false + } + return vm.favListingData?.singKaraokeData?.count ?? 0 + case gamesCV: + if vm.favListingData?.gameData?.count == 0{ + gamesStack.isHidden = true + }else{ + gamesStack.isHidden = false + } + return vm.favListingData?.gameData?.count ?? 0 + case webSeriesHindiCV: + if vm.webSeriesHindi.count == 0{ + webSeriesHindiStack.isHidden = true + }else{ + webSeriesHindiStack.isHidden = false + } + return vm.webSeriesHindi.count + default: + return 0 + } + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.Home.favouriteCell, for: indexPath) as! FavouriteCell + + switch collectionView{ + case webSeriesCV: + if let data = vm.favListingData?.showData?[indexPath.row]{ + cell.setData(data: data) + } + case webSeriesHindiCV: + let data = vm.webSeriesHindi[indexPath.row] + cell.setData(data: data) + case audioBooksCV: + if let data = vm.favListingData?.audioData?[indexPath.row]{ + cell.setOtherData(data: data) + } + case karaokeCV: + if let data = vm.favListingData?.singKaraokeData?[indexPath.row]{ + cell.setOtherData(data: data) + } + case gamesCV: + if let data = vm.favListingData?.gameData?[indexPath.row]{ + cell.setOtherData(data: data) + } + default: + if let data = vm.favListingData?.showData?[indexPath.row]{ + cell.setData(data: data) + } + } + return cell + } +} + + +// MARK: - Collection Flow Layout + +extension MyListVC : 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) + } +} diff --git a/WOKA/Home/Home.storyboard b/WOKA/Home/Home.storyboard index 4b562ad..58ba88a 100644 --- a/WOKA/Home/Home.storyboard +++ b/WOKA/Home/Home.storyboard @@ -4,6 +4,7 @@ + @@ -862,6 +863,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -941,6 +1140,7 @@ + @@ -950,6 +1150,7 @@ + @@ -957,14 +1158,14 @@ + + + - - - - + diff --git a/WOKA/Home/Model/FavouriteListingDM.swift b/WOKA/Home/Model/FavouriteListingDM.swift new file mode 100644 index 0000000..3f21922 --- /dev/null +++ b/WOKA/Home/Model/FavouriteListingDM.swift @@ -0,0 +1,123 @@ +// +// FavouriteListingDM.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import Foundation + +// MARK: - FavouriteListingDM +struct FavouriteListingDM: Codable { + let result: ResultData? + + // MARK: - Result + struct ResultData: Codable { + var showData: [ShowDatum]? + let videoData: [Datum]? + let gameData, audioData, singKaraokeData: [Datum]? + + enum CodingKeys: String, CodingKey { + case showData = "show_data" + case videoData = "video_data" + case gameData = "game_data" + case audioData = "audio_data" + case singKaraokeData = "sing_karaoke_data" + } + + // MARK: - Datum + struct Datum: Codable { + let id: Int? + let title, description: String? + let thumbnailPath: String? + let audioURL: String? + let categoryMasterID, ageRangeMasterID, tagsKeyword, releaseDate: String? + let languageMasterID: Int? + let genderMasterID, audioDuration, mediaID: String? + let contentMoreDetails: [ContentMoreDetail]? + let markAsFavourite, isLiked: Bool? + let viewsCount, likesCount, bookmarkCount: Int? + let bookmarkCategoryIDS: String? + let gameURL: String? + let screenOrientation: String? + let videoURL: String? + let duration: String? + + enum CodingKeys: String, CodingKey { + case id, title, description + case thumbnailPath = "thumbnail_path" + case audioURL = "audio_url" + case categoryMasterID = "category_master_id" + case ageRangeMasterID = "age_range_master_id" + case tagsKeyword = "tags_keyword" + case releaseDate = "release_date" + case languageMasterID = "language_master_id" + case genderMasterID = "gender_master_id" + case audioDuration = "audio_duration" + case mediaID = "media_id" + case contentMoreDetails = "content_more_details" + case markAsFavourite = "mark_as_favourite" + case isLiked = "is_liked" + case viewsCount = "views_count" + case likesCount = "likes_count" + case bookmarkCount = "bookmark_count" + case bookmarkCategoryIDS = "bookmark_category_ids" + case gameURL = "game_url" + case screenOrientation = "screen_orientation" + case videoURL = "video_url" + case duration + } + } + + // MARK: - ContentMoreDetail + struct ContentMoreDetail: Codable { + let id, contentID, postType, languageMasterID: Int? + let title, description: String? + let url: String? + let tagsKeywords: String? + + enum CodingKeys: String, CodingKey { + case id + case contentID = "content_id" + case postType = "post_type" + case languageMasterID = "language_master_id" + case title, description, url + case tagsKeywords = "tags_keywords" + } + } + + // MARK: - ShowDatum + struct ShowDatum: Codable { + let id: Int? + let title, description: String? + let thumbnailPath: String? + let showType: String? + let totalSeasons, totalEpisodes: Int? + let categoryMasterID, ageRangeMasterID, genderMasterID: String? + let contentMoreDetails: [ContentMoreDetail]? + let markAsFavourite, isLiked: Bool? + let viewsCount, likesCount, bookmarkCount: Int? + let bookmarkCategoryIDS: String? + + 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 markAsFavourite = "mark_as_favourite" + case isLiked = "is_liked" + case viewsCount = "views_count" + case likesCount = "likes_count" + case bookmarkCount = "bookmark_count" + case bookmarkCategoryIDS = "bookmark_category_ids" + } + } + + } +} + diff --git a/WOKA/Home/View/FavouriteCell.swift b/WOKA/Home/View/FavouriteCell.swift new file mode 100644 index 0000000..fea4489 --- /dev/null +++ b/WOKA/Home/View/FavouriteCell.swift @@ -0,0 +1,78 @@ +// +// FavouriteCell.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import UIKit + +class FavouriteCell: UICollectionViewCell { + + @IBOutlet weak var cellImage: UIImageView! + @IBOutlet weak var cellTitle: UILabel! + @IBOutlet weak var likeBtn: UIButton! + @IBOutlet weak var favBtnn: UIButton! + @IBOutlet weak var totalLikes: UILabel! + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + func setData(data : FavouriteListingDM.ResultData.ShowDatum){ + //heart.fill , heart , hand.thumbsup.fill , hand.thumbsup + cellTitle.text = data.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(systemName: "heart.fill"), for: .normal) + case false: + favBtnn.setImage(UIImage(systemName: "heart"), for: .normal) + + } + } + + 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) + } + } + } + + func setOtherData(data : FavouriteListingDM.ResultData.Datum){ + //heart.fill , heart , hand.thumbsup.fill , hand.thumbsup + cellTitle.text = data.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(systemName: "heart.fill"), for: .normal) + case false: + favBtnn.setImage(UIImage(systemName: "heart"), for: .normal) + + } + } + + 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) + } + } + } +} diff --git a/WOKA/Home/View/FavouriteCell.xib b/WOKA/Home/View/FavouriteCell.xib new file mode 100644 index 0000000..4484b70 --- /dev/null +++ b/WOKA/Home/View/FavouriteCell.xib @@ -0,0 +1,134 @@ + + + + + + + + + + + + + Exo2-Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Home/ViewModel/MyListVM.swift b/WOKA/Home/ViewModel/MyListVM.swift new file mode 100644 index 0000000..e3a3f5e --- /dev/null +++ b/WOKA/Home/ViewModel/MyListVM.swift @@ -0,0 +1,92 @@ +// +// MyListVM.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import Foundation +import Alamofire + +class MyListVM{ + weak var vc : MyListVC! + var favListingData : FavouriteListingDM.ResultData? + + var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]() + + func initView(){ + setupCell() + getFavouriteListing() + } + + func setupCell(){ + vc.webSeriesCV.register(UINib(nibName: K.CellIdentifier.Home.favouriteCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Home.favouriteCell) + vc.webSeriesCV.delegate = vc.self + vc.webSeriesCV.dataSource = vc.self + + vc.webSeriesHindiCV.register(UINib(nibName: K.CellIdentifier.Home.favouriteCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Home.favouriteCell) + vc.webSeriesHindiCV.delegate = vc.self + vc.webSeriesHindiCV.dataSource = vc.self + + vc.audioBooksCV.register(UINib(nibName: K.CellIdentifier.Home.favouriteCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Home.favouriteCell) + vc.audioBooksCV.delegate = vc.self + vc.audioBooksCV.dataSource = vc.self + + vc.karaokeCV.register(UINib(nibName: K.CellIdentifier.Home.favouriteCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Home.favouriteCell) + vc.karaokeCV.delegate = vc.self + vc.karaokeCV.dataSource = vc.self + + vc.gamesCV.register(UINib(nibName: K.CellIdentifier.Home.favouriteCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Home.favouriteCell) + vc.gamesCV.delegate = vc.self + vc.gamesCV.dataSource = vc.self + } + + // MARK: - Get Favourite Listing + + func getFavouriteListing(){ + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi", + "access-token": AuthFunc.shareInstance.getAccessToken()] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.favourite_listing, method: .post, 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) + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + favListingData = data + + if var hindiData = favListingData?.showData{ + /* + Taking out the hindi series , 1-> English , 18-> Hindi + And the saving it to hindi series + */ + webSeriesHindi = hindiData.compactMap { $0 }.filter { $0.bookmarkCategoryIDS == "18" } + + // Deleting the hindi series from main (those with category ID "18") + hindiData.removeAll { $0.bookmarkCategoryIDS == "18" } + + // Updating the showData with the filtered list + favListingData?.showData = hindiData + } + + vc.webSeriesCV.reloadData() + vc.webSeriesHindiCV.reloadData() + vc.audioBooksCV.reloadData() + vc.karaokeCV.reloadData() + vc.gamesCV.reloadData() + default: + break + } + case .failure(let error): + guard let self else{return} + Utilities.dismissProgressHUD() + self.vc.toast(msg: error.localizedDescription , time: 2) + } + } + } +} diff --git a/WOKA/Main/Delegate/AppDelegate.swift b/WOKA/Main/Delegate/AppDelegate.swift index 7baa4ca..103700e 100644 --- a/WOKA/Main/Delegate/AppDelegate.swift +++ b/WOKA/Main/Delegate/AppDelegate.swift @@ -9,7 +9,6 @@ import UIKit import Lottie import IQKeyboardManagerSwift import JWPlayerKit -import AVFAudio @main class AppDelegate: UIResponder, UIApplicationDelegate { @@ -41,20 +40,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { configureSideBar() JWPlayerKitLicense.setLicenseKey("Lgok1t7H4PKY+M8FZqmCx54ibUF+NeCTn+xgd+/LVTaRdc+L") - setupAudioSession() return true } - - - func setupAudioSession() { - let session = AVAudioSession.sharedInstance() - do { - try session.setCategory(.playback, mode: .default) - try session.setActive(true) - } catch { - print("Failed to set up audio session") - } - } // var myOrientation: UIInterfaceOrientationMask = .portrait // diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift index db10649..3258ae4 100644 --- a/WOKA/Network Adapter/APIEndPoints.swift +++ b/WOKA/Network Adapter/APIEndPoints.swift @@ -67,6 +67,8 @@ struct APIEndPoints { struct Home{ static let blogs = makeURL(path: "blogs") static let song_listing = makeURL(path: "song_listing") + static let get_user_notifications = makeURL(path: "get_user_notifications") + static let favourite_listing = makeURL(path: "favourite_listing") } // Other endpoint categories... diff --git a/WOKA/Theme/Base.lproj/Theme.storyboard b/WOKA/Theme/Base.lproj/Theme.storyboard index b896509..97790dd 100644 --- a/WOKA/Theme/Base.lproj/Theme.storyboard +++ b/WOKA/Theme/Base.lproj/Theme.storyboard @@ -4,6 +4,7 @@ + @@ -72,6 +73,9 @@ + + + @@ -185,6 +189,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -753,6 +854,7 @@ + diff --git a/WOKA/Theme/CommonNwCall.swift b/WOKA/Theme/CommonNwCall.swift new file mode 100644 index 0000000..a05488b --- /dev/null +++ b/WOKA/Theme/CommonNwCall.swift @@ -0,0 +1,48 @@ +// +// CommonNwCall.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import UIKit +import Alamofire + +class CommonNwCall{ + + static let shareInstance = CommonNwCall() + var userNotification = [UserNotificationDM]() + + func getUserNotification(vc : UIViewController , isRefreshing : Bool? = nil, completion : @escaping (Bool) -> Void){ + if isRefreshing == false || isRefreshing == nil{ + Utilities.startProgressHUD() + } + let headers : HTTPHeaders = ["access-token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3dva2FsYW5kLmNvbS9hZG1pbi9hcGkvbG9naW4iLCJpYXQiOjE3MTgxODgwNTMsImV4cCI6MTc0OTcyNDA1MywibmJmIjoxNzE4MTg4MDUzLCJqdGkiOiJaNHIyVTlPYUxZanlDZm1TIiwic3ViIjoiMjE2IiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.09oMvLmPaSzSqI7tQTs0VblGeRxDYYdh4Bt-2z1RTKg"] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.get_user_notifications, method: .get,headers : headers) {(result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) + completion(false) + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data else{return} + self.userNotification.append(contentsOf: data) + //Fetched Blogs + completion(true) + default: + completion(false) + } + case .failure(let error): + Utilities.dismissProgressHUD() + vc.toast(msg: error.localizedDescription , time: 2) + completion(false) + } + } + } +} diff --git a/WOKA/Theme/Controller/MoreVC.swift b/WOKA/Theme/Controller/MoreVC.swift index 2a70a17..ec15098 100644 --- a/WOKA/Theme/Controller/MoreVC.swift +++ b/WOKA/Theme/Controller/MoreVC.swift @@ -40,7 +40,7 @@ extension MoreVC : TableViewSRC{ let cell = tableView.dequeueReusableCell(withIdentifier: "SongListCell", for: indexPath) as! SongListCell let songData = vm.songData[indexPath.row] - let isActive = (indexPath.row == vm.currentIndexPlayingSong) +// let isActive = (indexPath.row == vm.currentIndexPlayingSong) if let index = vm.currentIndexPlayingSong , index == indexPath.row{ cell.setData(data: songData,playerStatus: vm.playerStatus, active: true, currentTime: currentTimePlayer) }else{ @@ -223,11 +223,11 @@ extension MoreVC : UICollectionViewDelegateFlowLayout{ } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let itemsPerRow: CGFloat = 2 + let itemsPerRow: CGFloat = 2.2 let paddingSpace = 5 * (itemsPerRow + 1) let availableWidth = collectionView.frame.width - paddingSpace let widthPerItem = availableWidth / itemsPerRow - return CGSize(width: widthPerItem, height: widthPerItem - 20) + return CGSize(width: widthPerItem, height: widthPerItem) } } diff --git a/WOKA/Theme/Controller/RadioVC.swift b/WOKA/Theme/Controller/RadioVC.swift new file mode 100644 index 0000000..e6a6c08 --- /dev/null +++ b/WOKA/Theme/Controller/RadioVC.swift @@ -0,0 +1,60 @@ +// +// RadioVC.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import UIKit +import WebKit + +class RadioVC: UIViewController { + + @IBOutlet weak var webView: WKWebView! + var url = "https://wokastaging.in/api/woka_fm" + @IBOutlet weak var backView: UIView! + + deinit { + unloadWebView() + } + + override func viewDidLoad() { + super.viewDidLoad() + let radioURL = URL(string: url)! + let request = URLRequest(url: radioURL) + webView.load(request) + + 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 + } + + +} diff --git a/WOKA/Theme/Controller/ThemeOneVC.swift b/WOKA/Theme/Controller/ThemeOneVC.swift index 0c92538..c726a1f 100644 --- a/WOKA/Theme/Controller/ThemeOneVC.swift +++ b/WOKA/Theme/Controller/ThemeOneVC.swift @@ -69,6 +69,23 @@ class ThemeOneVC: 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) + } + } + } + + @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) + } } diff --git a/WOKA/Theme/Controller/UserNotificationVC.swift b/WOKA/Theme/Controller/UserNotificationVC.swift new file mode 100644 index 0000000..118d966 --- /dev/null +++ b/WOKA/Theme/Controller/UserNotificationVC.swift @@ -0,0 +1,79 @@ +// +// UserNotificationVC.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import UIKit + +class UserNotificationVC: UIViewController { + + @IBOutlet weak var tableView: UITableView! + let refreshControl = UIRefreshControl() + let feedbackGenerator = UIImpactFeedbackGenerator(style: .light) + + override func viewDidLoad() { + super.viewDidLoad() + let color1 = #colorLiteral(red: 0.05490196078, green: 0.01176470588, blue: 0.3882352941, alpha: 1) + let color2 = #colorLiteral(red: 0.2041364683, green: 0.156624428, blue: 0.5904380268, alpha: 1) + self.view.applyMultiGradient(colors: [color1, color2,color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 0.8)) + self.title = "NOTIFICATIONS" + setupCell() + + 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 + refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged) + tableView.addSubview(refreshControl) + } + + // MARK: - Pull to refresh + + @objc func refresh(_ sender: AnyObject) { + CommonNwCall.shareInstance.getUserNotification(vc: self,isRefreshing: true) { [weak self] isDone in + guard let self else{return} + feedbackGenerator.impactOccurred() + tableView.reloadData() + refreshControl.endRefreshing() + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(false, animated: animated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + navigationController?.setNavigationBarHidden(true, animated: animated) + self.navigationController?.setColor(color: .black) + } + + func setupCell(){ + tableView.register(UINib(nibName: K.CellIdentifier.Home.userNotificationCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.Home.userNotificationCell) + tableView.delegate = self + tableView.dataSource = self + } + +} + +// MARK: - TableView DataSource , Delegates + +extension UserNotificationVC : TableViewSRC{ + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return CommonNwCall.shareInstance.userNotification.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Home.userNotificationCell) as! UserNotificationCell + let data = CommonNwCall.shareInstance.userNotification[indexPath.row] + cell.setData(data: data) + return cell + } +} diff --git a/WOKA/Theme/Model/UserNotificationDM.swift b/WOKA/Theme/Model/UserNotificationDM.swift new file mode 100644 index 0000000..5cf701b --- /dev/null +++ b/WOKA/Theme/Model/UserNotificationDM.swift @@ -0,0 +1,27 @@ +// +// UserNotificationDM.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import Foundation + +// MARK: - UserNotificationDM +struct UserNotificationDM: Codable { + let id, userID, postType: Int? + let title, type, description, createdAt: String? + let image: String? + let link: String? + let isRead: Int? + + enum CodingKeys: String, CodingKey { + case id + case userID = "user_id" + case postType = "post_type" + case title, type, description + case createdAt = "created_at" + case image, link + case isRead = "is_read" + } +} diff --git a/WOKA/Theme/View/BlogsCell.xib b/WOKA/Theme/View/BlogsCell.xib index 7288a4a..aea5f3b 100644 --- a/WOKA/Theme/View/BlogsCell.xib +++ b/WOKA/Theme/View/BlogsCell.xib @@ -16,30 +16,35 @@ - + - + - + - - + + - - - - - - + + + + + + + + - - + + diff --git a/WOKA/Theme/View/UserNotificationCell.swift b/WOKA/Theme/View/UserNotificationCell.swift new file mode 100644 index 0000000..0f4f439 --- /dev/null +++ b/WOKA/Theme/View/UserNotificationCell.swift @@ -0,0 +1,51 @@ +// +// UserNotificationCell.swift +// WOKA +// +// Created by MacBook Pro on 13/06/24. +// + +import UIKit + +class UserNotificationCell: UITableViewCell { + + @IBOutlet weak var notificationDate: UILabel! + @IBOutlet weak var notificationDesc: UILabel! + + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } + + + func setData(data : UserNotificationDM){ + if let dateStr = data.createdAt, let date = DateFormatterLib.dateMods(dateStr: dateStr, dateCurrentFormat: .yyyy_MM_ddTHH_mm_ss_ssZ, dateReturnFormat: .yyyy_MM_ddTHH_mm_ss_ssZ, stringOrDate: .date).1{ + let currentDate = Date() + + // Calculate the difference in days + let calendar = Calendar.current + let dateComponents = calendar.dateComponents([.day], from: currentDate, to: date) + + if let daysDifference = dateComponents.day { + let datePositive = abs(daysDifference) + if datePositive == 0{ + notificationDate.text = "Today" + }else if datePositive == 1{ + notificationDate.text = "Yesterday" + }else{ + notificationDate.text = datePositive.toString() + " days ago" + } + } else { + notificationDate.text = "0 days ago" + } + } + notificationDesc.text = data.title + } +} diff --git a/WOKA/Theme/View/UserNotificationCell.xib b/WOKA/Theme/View/UserNotificationCell.xib new file mode 100644 index 0000000..bfd2031 --- /dev/null +++ b/WOKA/Theme/View/UserNotificationCell.xib @@ -0,0 +1,75 @@ + + + + + + + + + + + + + Exo2-Regular + + + Exo2-SemiBold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Theme/ViewModel/MoreVM.swift b/WOKA/Theme/ViewModel/MoreVM.swift index 9b923fb..9711aae 100644 --- a/WOKA/Theme/ViewModel/MoreVM.swift +++ b/WOKA/Theme/ViewModel/MoreVM.swift @@ -35,6 +35,7 @@ class MoreVM{ func initView(){ getBLogs() + setupAudioSession() getSong() setupCell() vc.songTableView.showsVerticalScrollIndicator = false @@ -44,6 +45,17 @@ class MoreVM{ } } + + func setupAudioSession() { + let session = AVAudioSession.sharedInstance() + do { + try session.setCategory(.playback, mode: .default) + try session.setActive(true) + } catch { + print("Failed to set up audio session") + } + } + func observePlayer() { playerObserver = self.player?.observe(\.timeControlStatus, options: [.new, .old], changeHandler: { [weak self] player, change in guard let self = self else { return } diff --git a/WOKA/Theme/ViewModel/ThemeOneVM.swift b/WOKA/Theme/ViewModel/ThemeOneVM.swift index df687f6..f38a3ac 100644 --- a/WOKA/Theme/ViewModel/ThemeOneVM.swift +++ b/WOKA/Theme/ViewModel/ThemeOneVM.swift @@ -36,8 +36,6 @@ class ThemeOneVM{ vc.nameLabel.setContentHuggingPriority(.fittingSizeLevel, for: .horizontal) vc.nameLabel.setContentCompressionResistancePriority(.fittingSizeLevel, for: .horizontal) - - } private func handleNotificationCenter(){