From 5cf02c5aae6b4baa249df29f649e223b5b596349 Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Tue, 13 Aug 2024 20:02:41 +0530 Subject: [PATCH] - Completed click count in sidebar - Handled optional gender type - Handled optional gender in profile - Remaining MyListVC changes --- .../Info.plist | 13 + .../NotificationService.swift | 41 + ...lNotificationServiceExtension.entitlements | 10 + WOKA.xcodeproj/project.pbxproj | 193 ++++- .../xcshareddata/xcschemes/WOKA.xcscheme | 4 +- WOKA/Alerts/YesNoAlertVC.swift | 1 + .../Base.lproj/AuthenticationSB.storyboard | 176 ++-- WOKA/Authentication/Controller/LoginVC.swift | 4 + .../Controller/UserIntrestVC.swift | 24 +- WOKA/Authentication/Model/UserDataDM.swift | 9 +- .../Model/UserRegPostModel.swift | 3 +- WOKA/Authentication/ViewModel/LoginVM.swift | 29 +- .../ViewModel/SelectAvatarVM.swift | 9 +- .../ViewModel/UserIntrestVM.swift | 3 + WOKA/Constants K/AnalyticsEventKeys.swift | 3 +- WOKA/Constants K/OnBoardVM.swift | 6 +- WOKA/Games/Controller/GamesListVC.swift | 4 +- WOKA/Games/Controller/GamesWebViewVC.swift | 35 +- WOKA/Games/Games.storyboard | 41 +- WOKA/Home/Controller/ExploreWokaVC.swift | 8 + WOKA/Home/Controller/MyListVC.swift | 799 +++++++++--------- WOKA/Home/Controller/MyListViewAllVC.swift | 10 +- WOKA/Home/Model/FavouriteListingDM.swift | 6 +- WOKA/Home/MyListDataTemp.swift | 2 +- WOKA/Home/ViewModel/MyListVM.swift | 128 +-- WOKA/Info.plist | 2 + WOKA/Main/AuthFunc/AuthFunc.swift | 6 + WOKA/Main/Delegate/AppDelegate.swift | 29 +- WOKA/Network Adapter/APIEndPoints.swift | 2 +- .../Base.lproj/Main.storyboard | 36 + .../Controller/SplashVC.swift | 3 + .../ViewModel/SplashVM.swift | 2 +- WOKA/PersistentStorage.swift | 4 +- WOKA/SideBarNav/Controller/AboutUsVc.swift | 4 + .../Controller/ContactSupportVC.swift | 6 +- WOKA/SideBarNav/Controller/FaqVC.swift | 5 + WOKA/SideBarNav/Controller/ProfileVC.swift | 5 + WOKA/SideBarNav/Controller/WebViewVC.swift | 5 + .../ViewModel/ContactSupportVM.swift | 2 + WOKA/SideBarNav/ViewModel/ProfileVM.swift | 65 +- .../Controller/TabBarVC.swift | 2 + WOKA/Theme/Base.lproj/Theme.storyboard | 7 +- WOKA/Theme/Controller/ThemeOneVC.swift | 3 +- WOKA/Theme/Controller/ThemeTwoVC.swift | 1 + WOKA/Theme/ViewModel/ThemeOneVM.swift | 10 +- WOKA/Theme/ViewModel/ThemeTwoVM.swift | 12 +- WOKA/WOKA.entitlements | 6 + 47 files changed, 1142 insertions(+), 636 deletions(-) create mode 100644 OneSignalNotificationServiceExtension/Info.plist create mode 100644 OneSignalNotificationServiceExtension/NotificationService.swift create mode 100644 OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements diff --git a/OneSignalNotificationServiceExtension/Info.plist b/OneSignalNotificationServiceExtension/Info.plist new file mode 100644 index 0000000..57421eb --- /dev/null +++ b/OneSignalNotificationServiceExtension/Info.plist @@ -0,0 +1,13 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.usernotifications.service + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).NotificationService + + + diff --git a/OneSignalNotificationServiceExtension/NotificationService.swift b/OneSignalNotificationServiceExtension/NotificationService.swift new file mode 100644 index 0000000..9e18623 --- /dev/null +++ b/OneSignalNotificationServiceExtension/NotificationService.swift @@ -0,0 +1,41 @@ +// +// NotificationService.swift +// OneSignalNotificationServiceExtension +// +// Created by MacBook Pro on 13/08/24. +// + +import UserNotifications +import OneSignalExtension + +class NotificationService: UNNotificationServiceExtension { + + var contentHandler: ((UNNotificationContent) -> Void)? + var receivedRequest: UNNotificationRequest! + var bestAttemptContent: UNMutableNotificationContent? + + override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { + self.receivedRequest = request + self.contentHandler = contentHandler + self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) + + if let bestAttemptContent = bestAttemptContent { + /* DEBUGGING: Uncomment the 2 lines below to check this extension is executing + Note, this extension only runs when mutable-content is set + Setting an attachment or action buttons automatically adds this */ + // print("Running NotificationServiceExtension") + // bestAttemptContent.body = "[Modified] " + bestAttemptContent.body + + OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler) + } + } + + override func serviceExtensionTimeWillExpire() { + // Called just before the extension will be terminated by the system. + // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. + if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { + OneSignalExtension.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent) + contentHandler(bestAttemptContent) + } + } +} diff --git a/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements b/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements new file mode 100644 index 0000000..fc0daa7 --- /dev/null +++ b/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.com.app.woka.onesignal + + + diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 9243c99..7243ac2 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -108,6 +108,11 @@ 528E5F1B2C24531200E33E4E /* SeasonListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 528E5F1A2C24531200E33E4E /* SeasonListingDM.swift */; }; 528E5F222C24660F00E33E4E /* SeasonCategoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 528E5F202C24660F00E33E4E /* SeasonCategoryCell.swift */; }; 528E5F232C24660F00E33E4E /* SeasonCategoryCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 528E5F212C24660F00E33E4E /* SeasonCategoryCell.xib */; }; + 528F26E22C6B7B30003E4D99 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 528F26E12C6B7B30003E4D99 /* NotificationService.swift */; }; + 528F26E62C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 528F26DF2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 528F26EE2C6B7BD1003E4D99 /* OneSignalExtension in Frameworks */ = {isa = PBXBuildFile; productRef = 528F26ED2C6B7BD1003E4D99 /* OneSignalExtension */; }; + 528F26F02C6B7BD1003E4D99 /* OneSignalFramework in Frameworks */ = {isa = PBXBuildFile; productRef = 528F26EF2C6B7BD1003E4D99 /* OneSignalFramework */; }; + 528F26F22C6B7BD1003E4D99 /* OneSignalInAppMessages in Frameworks */ = {isa = PBXBuildFile; productRef = 528F26F12C6B7BD1003E4D99 /* OneSignalInAppMessages */; }; 529B0DD42C06156B00CFC54B /* LoginNavVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 529B0DD32C06156B00CFC54B /* LoginNavVC.swift */; }; 529B0DD62C070C0F00CFC54B /* GuestDataDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 529B0DD52C070C0F00CFC54B /* GuestDataDM.swift */; }; 529CFEEE2C60F49000B0B380 /* UserNotificationVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 529CFEED2C60F49000B0B380 /* UserNotificationVM.swift */; }; @@ -361,8 +366,29 @@ remoteGlobalIDString = 523ED2592BDA2BC700CFED02; remoteInfo = WOKA; }; + 528F26E42C6B7B30003E4D99 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 523ED2522BDA2BC700CFED02 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 528F26DE2C6B7B30003E4D99; + remoteInfo = OneSignalNotificationServiceExtension; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 528F26E72C6B7B30003E4D99 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 528F26E62C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 2081C2B186A876137E7DBDF2 /* Pods-WOKA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WOKA.release.xcconfig"; path = "Target Support Files/Pods-WOKA/Pods-WOKA.release.xcconfig"; sourceTree = ""; }; 3B045136DB6D1DB0D38BD128 /* Pods_WOKA.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WOKA.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -473,6 +499,10 @@ 528E5F1A2C24531200E33E4E /* SeasonListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeasonListingDM.swift; sourceTree = ""; }; 528E5F202C24660F00E33E4E /* SeasonCategoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeasonCategoryCell.swift; sourceTree = ""; }; 528E5F212C24660F00E33E4E /* SeasonCategoryCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SeasonCategoryCell.xib; sourceTree = ""; }; + 528F26DF2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 528F26E12C6B7B30003E4D99 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; + 528F26E32C6B7B30003E4D99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 528F26EB2C6B7B80003E4D99 /* OneSignalNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneSignalNotificationServiceExtension.entitlements; sourceTree = ""; }; 529B0DD32C06156B00CFC54B /* LoginNavVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginNavVC.swift; sourceTree = ""; }; 529B0DD52C070C0F00CFC54B /* GuestDataDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuestDataDM.swift; sourceTree = ""; }; 529CFEED2C60F49000B0B380 /* UserNotificationVM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserNotificationVM.swift; sourceTree = ""; }; @@ -712,9 +742,11 @@ files = ( 4469E533EC95AC428FE50FB2 /* Pods_WOKA.framework in Frameworks */, 52C83E3F2C493FD700F27563 /* RSKPlaceholderTextView in Frameworks */, + 528F26F02C6B7BD1003E4D99 /* OneSignalFramework in Frameworks */, 9C85A9F32C5CE1060031C365 /* FirebasePerformance in Frameworks */, 9C85A9F12C5CE1060031C365 /* FirebaseCrashlytics in Frameworks */, 9C85A9EF2C5CE1060031C365 /* FirebaseAnalytics in Frameworks */, + 528F26F22C6B7BD1003E4D99 /* OneSignalInAppMessages in Frameworks */, 521CB1002C493DB80085BDF8 /* JWPlayerKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -733,6 +765,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 528F26DC2C6B7B30003E4D99 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 528F26EE2C6B7BD1003E4D99 /* OneSignalExtension in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -838,6 +878,7 @@ 523ED25C2BDA2BC700CFED02 /* WOKA */, 523ED2732BDA2BC900CFED02 /* WOKATests */, 523ED27D2BDA2BC900CFED02 /* WOKAUITests */, + 528F26E02C6B7B30003E4D99 /* OneSignalNotificationServiceExtension */, 523ED25B2BDA2BC700CFED02 /* Products */, 23C3A42E953212A2665EE308 /* Pods */, 05869DFFEE498B214527F2E9 /* Frameworks */, @@ -850,6 +891,7 @@ 523ED25A2BDA2BC700CFED02 /* WOKA.app */, 523ED2702BDA2BC900CFED02 /* WOKATests.xctest */, 523ED27A2BDA2BC900CFED02 /* WOKAUITests.xctest */, + 528F26DF2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex */, ); name = Products; sourceTree = ""; @@ -1219,6 +1261,16 @@ path = Timer; sourceTree = ""; }; + 528F26E02C6B7B30003E4D99 /* OneSignalNotificationServiceExtension */ = { + isa = PBXGroup; + children = ( + 528F26EB2C6B7B80003E4D99 /* OneSignalNotificationServiceExtension.entitlements */, + 528F26E12C6B7B30003E4D99 /* NotificationService.swift */, + 528F26E32C6B7B30003E4D99 /* Info.plist */, + ); + path = OneSignalNotificationServiceExtension; + sourceTree = ""; + }; 52A6DC942C4E385500F63C51 /* Shop */ = { isa = PBXGroup; children = ( @@ -1918,10 +1970,12 @@ 523ED2572BDA2BC700CFED02 /* Frameworks */, 523ED2582BDA2BC700CFED02 /* Resources */, 90182DDCD7EAE5F6DA5B4DFB /* [CP] Embed Pods Frameworks */, + 528F26E72C6B7B30003E4D99 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( + 528F26E52C6B7B30003E4D99 /* PBXTargetDependency */, ); name = WOKA; packageProductDependencies = ( @@ -1930,6 +1984,8 @@ 9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */, 9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */, 9C85A9F22C5CE1060031C365 /* FirebasePerformance */, + 528F26EF2C6B7BD1003E4D99 /* OneSignalFramework */, + 528F26F12C6B7BD1003E4D99 /* OneSignalInAppMessages */, ); productName = WOKA; productReference = 523ED25A2BDA2BC700CFED02 /* WOKA.app */; @@ -1971,6 +2027,26 @@ productReference = 523ED27A2BDA2BC900CFED02 /* WOKAUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; + 528F26DE2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 528F26EA2C6B7B30003E4D99 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */; + buildPhases = ( + 528F26DB2C6B7B30003E4D99 /* Sources */, + 528F26DC2C6B7B30003E4D99 /* Frameworks */, + 528F26DD2C6B7B30003E4D99 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OneSignalNotificationServiceExtension; + packageProductDependencies = ( + 528F26ED2C6B7BD1003E4D99 /* OneSignalExtension */, + ); + productName = OneSignalNotificationServiceExtension; + productReference = 528F26DF2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -1978,7 +2054,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1530; + LastSwiftUpdateCheck = 1540; LastUpgradeCheck = 1530; TargetAttributes = { 523ED2592BDA2BC700CFED02 = { @@ -1992,6 +2068,9 @@ CreatedOnToolsVersion = 15.3; TestTargetID = 523ED2592BDA2BC700CFED02; }; + 528F26DE2C6B7B30003E4D99 = { + CreatedOnToolsVersion = 15.4; + }; }; }; buildConfigurationList = 523ED2552BDA2BC700CFED02 /* Build configuration list for PBXProject "WOKA" */; @@ -2008,6 +2087,7 @@ 521CB0FE2C493DB80085BDF8 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */, 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */, 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */, ); productRefGroup = 523ED25B2BDA2BC700CFED02 /* Products */; projectDirPath = ""; @@ -2016,6 +2096,7 @@ 523ED2592BDA2BC700CFED02 /* WOKA */, 523ED26F2BDA2BC900CFED02 /* WOKATests */, 523ED2792BDA2BC900CFED02 /* WOKAUITests */, + 528F26DE2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension */, ); }; /* End PBXProject section */ @@ -2108,6 +2189,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 528F26DD2C6B7B30003E4D99 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -2439,6 +2527,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 528F26DB2C6B7B30003E4D99 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 528F26E22C6B7B30003E4D99 /* NotificationService.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -2452,6 +2548,11 @@ target = 523ED2592BDA2BC700CFED02 /* WOKA */; targetProxy = 523ED27B2BDA2BC900CFED02 /* PBXContainerItemProxy */; }; + 528F26E52C6B7B30003E4D99 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 528F26DE2C6B7B30003E4D99 /* OneSignalNotificationServiceExtension */; + targetProxy = 528F26E42C6B7B30003E4D99 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -2632,6 +2733,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C83A2BA3B8F575DC890CC5DD /* Pods-WOKA.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements; @@ -2671,6 +2773,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 2081C2B186A876137E7DBDF2 /* Pods-WOKA.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements; @@ -2782,6 +2885,62 @@ }; name = Release; }; + 528F26E82C6B7B30003E4D99 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 4S9A74ZB6H; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 17.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.app.woka.OneSignalNotificationServiceExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 528F26E92C6B7B30003E4D99 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 4S9A74ZB6H; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 17.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.app.woka.OneSignalNotificationServiceExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -2821,6 +2980,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 528F26EA2C6B7B30003E4D99 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 528F26E82C6B7B30003E4D99 /* Debug */, + 528F26E92C6B7B30003E4D99 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ @@ -2832,6 +3000,14 @@ version = 4.19.1; }; }; + 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/OneSignal/OneSignal-XCFramework"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.2.2; + }; + }; 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/ruslanskorb/RSKPlaceholderTextView.git"; @@ -2856,6 +3032,21 @@ package = 521CB0FE2C493DB80085BDF8 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */; productName = JWPlayerKit; }; + 528F26ED2C6B7BD1003E4D99 /* OneSignalExtension */ = { + isa = XCSwiftPackageProductDependency; + package = 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */; + productName = OneSignalExtension; + }; + 528F26EF2C6B7BD1003E4D99 /* OneSignalFramework */ = { + isa = XCSwiftPackageProductDependency; + package = 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */; + productName = OneSignalFramework; + }; + 528F26F12C6B7BD1003E4D99 /* OneSignalInAppMessages */ = { + isa = XCSwiftPackageProductDependency; + package = 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */; + productName = OneSignalInAppMessages; + }; 52C83E3E2C493FD700F27563 /* RSKPlaceholderTextView */ = { isa = XCSwiftPackageProductDependency; package = 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */; diff --git a/WOKA.xcodeproj/xcshareddata/xcschemes/WOKA.xcscheme b/WOKA.xcodeproj/xcshareddata/xcschemes/WOKA.xcscheme index 77be55b..2ecdd02 100644 --- a/WOKA.xcodeproj/xcshareddata/xcschemes/WOKA.xcscheme +++ b/WOKA.xcodeproj/xcshareddata/xcschemes/WOKA.xcscheme @@ -85,11 +85,11 @@ + isEnabled = "YES"> + isEnabled = "YES"> diff --git a/WOKA/Alerts/YesNoAlertVC.swift b/WOKA/Alerts/YesNoAlertVC.swift index fdd6cb7..3162b78 100644 --- a/WOKA/Alerts/YesNoAlertVC.swift +++ b/WOKA/Alerts/YesNoAlertVC.swift @@ -57,6 +57,7 @@ class YesNoAlertVC: UIViewController { // MARK: - Button Handler @IBAction func closeBtnTapped(_ sender: UIButton) { + PersistentStorage.shared.addOthersCount() self.dismiss() } diff --git a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard index ba1bea6..3f423aa 100644 --- a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard +++ b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard @@ -43,25 +43,25 @@ - + - + - + @@ -80,7 +80,7 @@ - + - + - + + + - - - + - + + - + diff --git a/WOKA/Home/Controller/ExploreWokaVC.swift b/WOKA/Home/Controller/ExploreWokaVC.swift index 3222f9c..926950c 100644 --- a/WOKA/Home/Controller/ExploreWokaVC.swift +++ b/WOKA/Home/Controller/ExploreWokaVC.swift @@ -51,6 +51,7 @@ class ExploreWokaVC: UIViewController { @IBAction func btnTapped(_ sender: UIButton) { switch sender{ case wokaFmBtn: + PersistentStorage.shared.addRadioCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -62,6 +63,7 @@ class ExploreWokaVC: UIViewController { } } case webSeriesBtn: + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -73,6 +75,7 @@ class ExploreWokaVC: UIViewController { } } case gamesBtn: + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -84,6 +87,7 @@ class ExploreWokaVC: UIViewController { } } case audioBookBtn: + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -95,6 +99,7 @@ class ExploreWokaVC: UIViewController { } } case karaokeBtn: + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -106,6 +111,7 @@ class ExploreWokaVC: UIViewController { } } case shopBtn: + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -117,6 +123,7 @@ class ExploreWokaVC: UIViewController { } } case liveTvBtn: + PersistentStorage.shared.addLiveTVCount() self.dismiss(animated: true) { switch K.GVar.topView{ case .theme1: @@ -145,6 +152,7 @@ class ExploreWokaVC: UIViewController { @IBAction func closeTapped(_ sender: UIButton) { + PersistentStorage.shared.addOthersCount() self.dismiss(animated: true) } } diff --git a/WOKA/Home/Controller/MyListVC.swift b/WOKA/Home/Controller/MyListVC.swift index 87e2aa3..dee14a9 100644 --- a/WOKA/Home/Controller/MyListVC.swift +++ b/WOKA/Home/Controller/MyListVC.swift @@ -129,6 +129,7 @@ class MyListVC: UIViewController{ } @IBAction func viewAllBtnTapped(_ sender: UIButton) { + PersistentStorage.shared.addOthersCount() switch sender{ case webSeriesHindiBtn: let sb = UIStoryboard(name: K.StoryBoard.home, bundle: nil) @@ -170,12 +171,19 @@ extension MyListVC : CollectionViewSRC{ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { switch collectionView{ case webSeriesCV: - if MyListDataTemp.shareInstance.favListingData?.showData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{ + if MyListDataTemp.shareInstance.favListingData?.showData?.english?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{ webSeriesEnglishStack.isHidden = true }else{ webSeriesEnglishStack.isHidden = false } - return MyListDataTemp.shareInstance.favListingData?.showData?.count ?? 0 + return MyListDataTemp.shareInstance.favListingData?.showData?.english?.count ?? 0 + case webSeriesHindiCV: + if MyListDataTemp.shareInstance.favListingData?.showData?.hindi?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{ + webSeriesHindiStack.isHidden = true + }else{ + webSeriesHindiStack.isHidden = false + } + return MyListDataTemp.shareInstance.favListingData?.showData?.hindi?.count ?? 0 case audioBooksCV: if MyListDataTemp.shareInstance.favListingData?.audioData?.count == 0 || MyListDataTemp.shareInstance.favListingData == nil{ audioBooksStack.isHidden = true @@ -197,13 +205,6 @@ extension MyListVC : CollectionViewSRC{ gamesStack.isHidden = false } return MyListDataTemp.shareInstance.favListingData?.gameData?.count ?? 0 - case webSeriesHindiCV: - if MyListDataTemp.shareInstance.webSeriesHindi.count == 0{ - webSeriesHindiStack.isHidden = true - }else{ - webSeriesHindiStack.isHidden = false - } - return MyListDataTemp.shareInstance.webSeriesHindi.count default: return 0 } @@ -214,12 +215,13 @@ extension MyListVC : CollectionViewSRC{ switch collectionView{ case webSeriesCV: - if let data = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row]{ + if let data = MyListDataTemp.shareInstance.favListingData?.showData?.english?[indexPath.row]{ cell.setData(data: data) } case webSeriesHindiCV: - let data = MyListDataTemp.shareInstance.webSeriesHindi[indexPath.row] - cell.setData(data: data) + if let data = MyListDataTemp.shareInstance.favListingData?.showData?.hindi?[indexPath.row]{ + cell.setData(data: data) + } case audioBooksCV: if let data = MyListDataTemp.shareInstance.favListingData?.audioData?[indexPath.row]{ cell.setAudioData(data: data) @@ -233,308 +235,321 @@ extension MyListVC : CollectionViewSRC{ cell.setGameData(data: data) } default: - if let data = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row]{ - cell.setData(data: data) - } + break +// if let data = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row]{ +// cell.setData(data: data) +// } } cell.btnTapped = { [self] (type) -> Void in - updateFavLikes(cv: collectionView, type: type, index: indexPath.row) +// updateFavLikes(cv: collectionView, type: type, index: indexPath.row) } return cell } // Updates from Cell Clicks - func updateFavLikes(cv : UICollectionView , type : FavCellCLick, index : Int){ - switch cv{ - case webSeriesCV: - guard let data = MyListDataTemp.shareInstance.favListingData?.showData?[index] else{return} - switch type { - case .favourite: - guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.categoryMasterID else{return} - if isFav{ - vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.showData?.remove(at: index) - webSeriesCV.reloadData() - vm.checkNil() - } - } - } - 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{ - MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1 - webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - - for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ - if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ - MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false - MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - } - } - }else{ - vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1 - webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - - for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ - if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ - MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true - MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - } - } - } - } - case webSeriesHindiCV: - let data = MyListDataTemp.shareInstance.webSeriesHindi[index] - switch type { - case .favourite: - guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.categoryMasterID else{return} - if isFav{ - vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.webSeriesHindi.remove(at: index) - webSeriesHindiCV.reloadData() - vm.checkNil() - } - } - } - case .liked: // Hindi Data - 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{ - MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false - MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - - guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} - - for (i,element) in showData.enumerated(){ - if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ - MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false - MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1 - webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - - } - } - }else{ - vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true - MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - - guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} - - for (i,element) in showData.enumerated(){ - if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ - MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true - MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1 - webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - } - } - } - } - case audioBooksCV: - guard let data = MyListDataTemp.shareInstance.favListingData?.audioData?[index] else{return} - switch type { - case .favourite: - guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} - if isFav{ - vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: index) - audioBooksCV.reloadData() - vm.checkNil() - } - } - } - 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{ - MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! -= 1 - audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - }else{ - vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! += 1 - audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - } - } - case karaokeCV: - guard let data = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index] else{return} - - switch type { - case .favourite: - guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} - if isFav{ - vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: index) - karaokeCV.reloadData() - vm.checkNil() - } - } - } - 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{ - MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1 - karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - }else{ - vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1 - karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - } - } - case gamesCV: - guard let data = MyListDataTemp.shareInstance.favListingData?.gameData?[index] else{return} - - switch type { - case .favourite: - guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} - if isFav{ - vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.gameData?.remove(at: index) - gamesCV.reloadData() - vm.checkNil() - } - } - } - 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{ - MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1 - gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - }else{ - vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in - if isDone{ - MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1 - gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - } - } - } - } - default: - break - } - } +// func updateFavLikes(cv : UICollectionView , type : FavCellCLick, index : Int){ +// switch cv{ +// case webSeriesCV: +// guard let data = MyListDataTemp.shareInstance.favListingData?.showData?[index] else{return} +// switch type { +// case .favourite: +// guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.categoryMasterID else{return} +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.showData?.remove(at: index) +// webSeriesCV.reloadData() +// vm.checkNil() +// } +// } +// } +// 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{ +// MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// +// for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ +// MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false +// MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// } +// } +// }else{ +// vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// +// for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ +// MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true +// MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// } +// } +// } +// } +// case webSeriesHindiCV: +// let data = MyListDataTemp.shareInstance.webSeriesHindi[index] +// switch type { +// case .favourite: +// guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.categoryMasterID else{return} +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.webSeriesHindi.remove(at: index) +// webSeriesHindiCV.reloadData() +// vm.checkNil() +// } +// } +// } +// case .liked: // Hindi Data +// 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{ +// MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false +// MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// +// guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} +// +// for (i,element) in showData.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ +// MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// +// } +// } +// }else{ +// vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true +// MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// +// guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} +// +// for (i,element) in showData.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ +// MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// } +// } +// } +// } +// case audioBooksCV: +// guard let data = MyListDataTemp.shareInstance.favListingData?.audioData?[index] else{return} +// switch type { +// case .favourite: +// guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.audioData?.remove(at: index) +// audioBooksCV.reloadData() +// vm.checkNil() +// } +// } +// } +// 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{ +// MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! -= 1 +// audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// }else{ +// vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.audioData?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.audioData?[index].likesCount! += 1 +// audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// } +// } +// case karaokeCV: +// guard let data = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index] else{return} +// +// switch type { +// case .favourite: +// guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.singKaraokeData?.remove(at: index) +// karaokeCV.reloadData() +// vm.checkNil() +// } +// } +// } +// 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{ +// MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! -= 1 +// karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// }else{ +// vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[index].likesCount! += 1 +// karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// } +// } +// case gamesCV: +// guard let data = MyListDataTemp.shareInstance.favListingData?.gameData?[index] else{return} +// +// switch type { +// case .favourite: +// guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return} +// if isFav{ +// vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.gameData?.remove(at: index) +// gamesCV.reloadData() +// vm.checkNil() +// } +// } +// } +// 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{ +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1 +// gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// }else{ +// vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in +// if isDone{ +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1 +// gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// } +// } +// } +// } +// default: +// break +// } +// } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { switch collectionView{ case webSeriesCV: // 18- hindi , 1- english - guard let showData = MyListDataTemp.shareInstance.favListingData?.showData?[indexPath.row] else{return} - PersistentStorage.shared.addWebSeries(catID: 1, postID: showData.id ?? 0) + guard let showData = MyListDataTemp.shareInstance.favListingData?.showData?.english?[indexPath.row] else{return} +// PersistentStorage.shared.addWebSeries(catID: 1, postID: showData.id ?? 0) + if let showID = showData.id{ + PersistentStorage.shared.addWebSeries(catID: 1, postID: showID, postType: .series) + } + let showDataModified = WebSeriesShowListDM.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: nil, ageRangeMasterID: nil, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, seasonData: nil, categoryData: nil, ageRangeData: nil, genderData: nil, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likedCategoryIDS: nil, favouriteCategoryIDS: ValueWrapper.stringValue(showData.bookmarkCategoryIDS ?? "1") , likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount) let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesSeasonVC) as! WebSeriesSeasonVC vcPush.vm.showData = showDataModified vcPush.vm.indexSelected = indexPath.row - vcPush.likeFavDelegate = self +// vcPush.likeFavDelegate = self vcPush.vm.categoryID = 1 self.navigationController?.pushViewController(vcPush, animated: true) self.vm.selectedCollection = .webSeriesCV case webSeriesHindiCV: - let showData = MyListDataTemp.shareInstance.webSeriesHindi[indexPath.row] - PersistentStorage.shared.addWebSeries(catID: 18, postID: showData.id ?? 0) - + guard let showData = MyListDataTemp.shareInstance.favListingData?.showData?.hindi?[indexPath.row] else{return} + if let showID = showData.id{ + PersistentStorage.shared.addWebSeries(catID: 18, postID: showID, postType: .series) + } + let showDataModified = WebSeriesShowListDM.ShowDatum(id: showData.id, title: showData.title, description: showData.description, thumbnailPath: showData.thumbnailPath, showType: showData.showType, totalSeasons: showData.totalSeasons, totalEpisodes: showData.totalEpisodes, categoryMasterID: nil, ageRangeMasterID: nil, genderMasterID: showData.genderMasterID, contentMoreDetails: showData.contentMoreDetails, seasonData: nil, categoryData: nil, ageRangeData: nil, genderData: nil, markAsFavourite: showData.markAsFavourite, isLiked: showData.isLiked, likedCategoryIDS: nil, favouriteCategoryIDS: ValueWrapper.stringValue(showData.bookmarkCategoryIDS ?? "1") , likesCount: showData.likesCount, viewsCount: showData.viewsCount, bookmarkCount: showData.bookmarkCount) let sb = UIStoryboard(name: K.StoryBoard.webSeries, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WebSeries.webSeriesSeasonVC) as! WebSeriesSeasonVC vcPush.vm.showData = showDataModified vcPush.vm.indexSelected = indexPath.row - vcPush.likeFavDelegate = self +// vcPush.likeFavDelegate = self vcPush.vm.categoryID = 18 self.navigationController?.pushViewController(vcPush, animated: true) self.vm.selectedCollection = .webSeriesHindiCV case audioBooksCV: guard let audioData = MyListDataTemp.shareInstance.favListingData?.audioData?[indexPath.row] else{return} - + if let postID = audioData.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC vcPush.modalPresentationStyle = .overCurrentContext vcPush.modalTransitionStyle = .crossDissolve vcPush.audioData = audioData - vcPush.delegate = self +// vcPush.delegate = self self.vm.selectedCollection = .audioBooksCV self.present(vcPush, animated: true) case karaokeCV: guard let karaokeData = MyListDataTemp.shareInstance.favListingData?.singKaraokeData?[indexPath.row] else{return} - + if let postID = karaokeData.id{ + PersistentStorage.shared.addKaraokeCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeDetailsVC) as! KaraokeDetailsVC vcPush.modalPresentationStyle = .overCurrentContext vcPush.modalTransitionStyle = .crossDissolve vcPush.karaokeData = karaokeData vcPush.karaokeIndex = indexPath.row - vcPush.delegate = self +// vcPush.delegate = self self.vm.selectedCollection = .karaokeCV self.present(vcPush, animated: true) case gamesCV: guard let gameData = MyListDataTemp.shareInstance.favListingData?.gameData?[indexPath.row] else{return} - + if let postID = gameData.id{ + PersistentStorage.shared.addGamesCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesDetailVC) as! GamesDetailVC vcPush.modalPresentationStyle = .overCurrentContext vcPush.modalTransitionStyle = .crossDissolve vcPush.gameData = gameData vcPush.gameIndex = indexPath.row - vcPush.delegate = self +// vcPush.delegate = self self.vm.selectedCollection = .gamesCV self.present(vcPush, animated: true) default: @@ -545,147 +560,147 @@ extension MyListVC : CollectionViewSRC{ } // MARK: - Delegate for reload -extension MyListVC : ReloadSeriesFavLike{ +//extension MyListVC : ReloadSeriesFavLike{ //Updates from details - func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) { - switch vm.selectedCollection { - case .webSeriesCV: - - if let isLike{ - switch isLike{ - case true: - MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! += 1 - webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - - for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ - if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ - MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true - MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - case false: - MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1 - webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - - for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ - if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ - MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false - MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - } - } - case .webSeriesHindiCV: - if let isLike{ - switch isLike{ - case true: - MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true - MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - - guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} - - for (i,element) in showData.enumerated(){ - if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ - MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true - MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1 - webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - case false: - MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false - MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1 - webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - vm.checkNil() - - guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} - - for (i,element) in showData.enumerated(){ - if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ - MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false - MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1 - webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) - } - } - - } - } - case .gamesCV: - if let isLike{ - switch isLike{ - case true: - MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true - MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1 - gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - case false: - MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false - MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1 - gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - } - } - - if let isFav{ - switch isFav{ - case true: - self.gamesCV.reloadData() - self.vm.checkNil() - case false: - self.gamesCV.reloadData() - self.vm.checkNil() - } - } - - case .karaokeCV: - if let isLike{ - switch isLike{ - case true: - karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - case false: - karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - } - } - - if let isFav{ - switch isFav{ - case true: - self.karaokeCV.reloadData() - self.vm.checkNil() - case false: - self.karaokeCV.reloadData() - self.vm.checkNil() - } - } - case .audioBooksCV: - if let isLike{ - switch isLike{ - case true: - audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - case false: - audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) - } - } - - if let isFav{ - switch isFav{ - case true: - self.audioBooksCV.reloadData() - self.vm.checkNil() - case false: - self.audioBooksCV.reloadData() - self.vm.checkNil() - } - } - default: - break - - } - } -} +// func updateRows(index: Int, type: FavCellCLick, isFav: Bool?, isLike: Bool?, id: Int?) { +// switch vm.selectedCollection { +// case .webSeriesCV: +// +// if let isLike{ +// switch isLike{ +// case true: +// MyListDataTemp.shareInstance.favListingData?.showData?.english?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.showData?.english?[index].likesCount! += 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// +// for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ +// MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = true +// MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! += 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// case false: +// MyListDataTemp.shareInstance.favListingData?.showData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.showData?[index].likesCount! -= 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// +// for (i,element) in MyListDataTemp.shareInstance.webSeriesHindi.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.favListingData?.showData?[index].id{ +// MyListDataTemp.shareInstance.webSeriesHindi[i].isLiked = false +// MyListDataTemp.shareInstance.webSeriesHindi[i].likesCount! -= 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// } +// } +// case .webSeriesHindiCV: +// if let isLike{ +// switch isLike{ +// case true: +// MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = true +// MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! += 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// +// guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} +// +// for (i,element) in showData.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ +// MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! += 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// case false: +// MyListDataTemp.shareInstance.webSeriesHindi[index].isLiked = false +// MyListDataTemp.shareInstance.webSeriesHindi[index].likesCount! -= 1 +// webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// vm.checkNil() +// +// guard let showData = MyListDataTemp.shareInstance.favListingData?.showData else{return} +// +// for (i,element) in showData.enumerated(){ +// if element.id == MyListDataTemp.shareInstance.webSeriesHindi[index].id{ +// MyListDataTemp.shareInstance.favListingData?.showData?[i].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.showData?[i].likesCount! -= 1 +// webSeriesCV.reloadItems(at: [IndexPath(row: i, section: 0)]) +// } +// } +// +// } +// } +// case .gamesCV: +// if let isLike{ +// switch isLike{ +// case true: +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = true +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! += 1 +// gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// case false: +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].isLiked = false +// MyListDataTemp.shareInstance.favListingData?.gameData?[index].likesCount! -= 1 +// gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// } +// } +// +// if let isFav{ +// switch isFav{ +// case true: +// self.gamesCV.reloadData() +// self.vm.checkNil() +// case false: +// self.gamesCV.reloadData() +// self.vm.checkNil() +// } +// } +// +// case .karaokeCV: +// if let isLike{ +// switch isLike{ +// case true: +// karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// case false: +// karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// } +// } +// +// if let isFav{ +// switch isFav{ +// case true: +// self.karaokeCV.reloadData() +// self.vm.checkNil() +// case false: +// self.karaokeCV.reloadData() +// self.vm.checkNil() +// } +// } +// case .audioBooksCV: +// if let isLike{ +// switch isLike{ +// case true: +// audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// case false: +// audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)]) +// } +// } +// +// if let isFav{ +// switch isFav{ +// case true: +// self.audioBooksCV.reloadData() +// self.vm.checkNil() +// case false: +// self.audioBooksCV.reloadData() +// self.vm.checkNil() +// } +// } +// default: +// break +// +// } +// } +//} // MARK: - Collection Flow Layout diff --git a/WOKA/Home/Controller/MyListViewAllVC.swift b/WOKA/Home/Controller/MyListViewAllVC.swift index de0f094..1074d78 100644 --- a/WOKA/Home/Controller/MyListViewAllVC.swift +++ b/WOKA/Home/Controller/MyListViewAllVC.swift @@ -80,7 +80,9 @@ extension MyListViewAllVC : TableViewSRC{ break case 6://Games guard let gameData = vm.favListingData?.gameData?[indexPath.row] else{return} - + if let postID = gameData.id{ + PersistentStorage.shared.addGamesCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesDetailVC) as! GamesDetailVC vcPush.modalPresentationStyle = .overCurrentContext @@ -89,6 +91,9 @@ extension MyListViewAllVC : TableViewSRC{ self.present(vcPush, animated: true) case 7: // audio books guard let audioData = vm.favListingData?.audioData?[indexPath.row] else{return} + if let postID = audioData.id{ + PersistentStorage.shared.addAudioCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC vcPush.modalPresentationStyle = .overCurrentContext @@ -98,6 +103,9 @@ extension MyListViewAllVC : TableViewSRC{ self.present(vcPush, animated: true) case 8: //KAraoke guard let karaokeData = vm.favListingData?.singKaraokeData?[indexPath.row] else{return} + if let postID = karaokeData.id{ + PersistentStorage.shared.addKaraokeCount(postID: postID) + } let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.karaokeDetailsVC) as! KaraokeDetailsVC vcPush.modalPresentationStyle = .overCurrentContext diff --git a/WOKA/Home/Model/FavouriteListingDM.swift b/WOKA/Home/Model/FavouriteListingDM.swift index b4e4b44..d211337 100644 --- a/WOKA/Home/Model/FavouriteListingDM.swift +++ b/WOKA/Home/Model/FavouriteListingDM.swift @@ -14,7 +14,7 @@ struct FavouriteListingDM: Codable { // MARK: - Result struct ResultData: Codable { let totalRecords: Int? - var showData: [ShowDatum]? + var showData: ShowData? var videoData: [Datum]? var gameData: [GamesListDM.GameDatum]? var singKaraokeData : [KaraokeListingDM.KaraokeDatum]? @@ -73,6 +73,10 @@ struct FavouriteListingDM: Codable { } } + // MARK: - ShowData + struct ShowData: Codable { + var hindi, english: [ShowDatum]? + } // MARK: - ShowDatum struct ShowDatum: Codable { let id: Int? diff --git a/WOKA/Home/MyListDataTemp.swift b/WOKA/Home/MyListDataTemp.swift index eaf4261..205d10d 100644 --- a/WOKA/Home/MyListDataTemp.swift +++ b/WOKA/Home/MyListDataTemp.swift @@ -14,7 +14,7 @@ class MyListDataTemp{ var favListingData : FavouriteListingDM.ResultData? - var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]() +// var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]() var isDatafetched = false diff --git a/WOKA/Home/ViewModel/MyListVM.swift b/WOKA/Home/ViewModel/MyListVM.swift index 5e3dc20..f1d660a 100644 --- a/WOKA/Home/ViewModel/MyListVM.swift +++ b/WOKA/Home/ViewModel/MyListVM.swift @@ -135,7 +135,7 @@ class MyListVM{ self.refreshControl.endRefreshing() Utilities.dismissProgressHUD() self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) - MyListDataTemp.shareInstance.webSeriesHindi.removeAll() +// MyListDataTemp.shareInstance.webSeriesHindi.removeAll() MyListDataTemp.shareInstance.favListingData = nil // make this true if mylist is loaded once MyListDataTemp.shareInstance.isDatafetched = true @@ -150,62 +150,62 @@ class MyListVM{ Utilities.dismissProgressHUD() guard let data = data.data?.result else{return} MyListDataTemp.shareInstance.favListingData = nil - MyListDataTemp.shareInstance.webSeriesHindi.removeAll() +// MyListDataTemp.shareInstance.webSeriesHindi.removeAll() MyListDataTemp.shareInstance.favListingData = data - if var hindiData = MyListDataTemp.shareInstance.favListingData?.showData{ - - /* - Taking out the hindi series , 1-> English , 18-> Hindi - And the saving it to hindi series, also modify the bookmark category ids - */ - MyListDataTemp.shareInstance.webSeriesHindi = hindiData.compactMap { $0 }.filter { - ($0.bookmarkCategoryIDS?.components(separatedBy: ",").first == "18" || $0.bookmarkCategoryIDS?.components(separatedBy: ",").last == "18") - }.map { element -> FavouriteListingDM.ResultData.ShowDatum in - var modifiedElement = element - modifiedElement.bookmarkCategoryIDS = "18" - modifiedElement.categoryMasterID = "18" - return modifiedElement - } - - if let data = MyListDataTemp.shareInstance.favListingData?.showData{ - var indicesToRemove = [Int]() - - // Deleting the hindi series from main (those with category ID "18") - for (index, element) in data.enumerated() { - if let bookMarkCatID = element.bookmarkCategoryIDS?.components(separatedBy: ","){ - if bookMarkCatID.count > 1{ // means multiple language - /* - if its greater than one , its for sure we have extracted the hindi episode - */ - hindiData[index].bookmarkCategoryIDS = "1" - }else{ // means single language - if bookMarkCatID.first == "18"{ - indicesToRemove.append(index) - } - } - } - } - - // Remove items in reverse order to avoid index shifting issues - for index in indicesToRemove.reversed() { - hindiData.remove(at: index) - } - } - - - // Updating the showData with the filtered list -// MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map({$0.categoryMasterID = 1}) - MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map { item in - var modifiedItem = item - modifiedItem.categoryMasterID = "1" - return modifiedItem - } - - // make this true if mylist is loaded once - MyListDataTemp.shareInstance.isDatafetched = true - } +// if var hindiData = MyListDataTemp.shareInstance.favListingData?.showData{ +// +// /* +// Taking out the hindi series , 1-> English , 18-> Hindi +// And the saving it to hindi series, also modify the bookmark category ids +// */ +// MyListDataTemp.shareInstance.webSeriesHindi = hindiData.compactMap { $0 }.filter { +// ($0.bookmarkCategoryIDS?.components(separatedBy: ",").first == "18" || $0.bookmarkCategoryIDS?.components(separatedBy: ",").last == "18") +// }.map { element -> FavouriteListingDM.ResultData.ShowDatum in +// var modifiedElement = element +// modifiedElement.bookmarkCategoryIDS = "18" +// modifiedElement.categoryMasterID = "18" +// return modifiedElement +// } +// +// if let data = MyListDataTemp.shareInstance.favListingData?.showData{ +// var indicesToRemove = [Int]() +// +// // Deleting the hindi series from main (those with category ID "18") +// for (index, element) in data.enumerated() { +// if let bookMarkCatID = element.bookmarkCategoryIDS?.components(separatedBy: ","){ +// if bookMarkCatID.count > 1{ // means multiple language +// /* +// if its greater than one , its for sure we have extracted the hindi episode +// */ +// hindiData[index].bookmarkCategoryIDS = "1" +// }else{ // means single language +// if bookMarkCatID.first == "18"{ +// indicesToRemove.append(index) +// } +// } +// } +// } +// +// // Remove items in reverse order to avoid index shifting issues +// for index in indicesToRemove.reversed() { +// hindiData.remove(at: index) +// } +// } +// +// +// // Updating the showData with the filtered list +//// MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map({$0.categoryMasterID = 1}) +// MyListDataTemp.shareInstance.favListingData?.showData = hindiData.map { item in +// var modifiedItem = item +// modifiedItem.categoryMasterID = "1" +// return modifiedItem +// } +// +// // make this true if mylist is loaded once +// MyListDataTemp.shareInstance.isDatafetched = true +// } reloadCollections() feedbackGenerator.impactOccurred() checkNil() @@ -247,19 +247,25 @@ class MyListVM{ vc.gamesBtn.isHidden = true } - if let webbSeriesEnglishCount = favListing.showData?.count , webbSeriesEnglishCount >= 3{ + if let webbSeriesEnglishCount = favListing.showData?.english?.count , webbSeriesEnglishCount >= 3{ vc.webSeriesBtn.isHidden = false }else{ vc.webSeriesBtn.isHidden = true } + + if let hindiSeriesCount = favListing.showData?.hindi?.count , hindiSeriesCount >= 3{ + vc.webSeriesHindiBtn.isHidden = false + }else{ + vc.webSeriesHindiBtn.isHidden = true + } } - let hindiListing = MyListDataTemp.shareInstance.webSeriesHindi - if hindiListing.count >= 3{ - vc.webSeriesHindiBtn.isHidden = false - }else{ - vc.webSeriesHindiBtn.isHidden = true - } +// let hindiListing = MyListDataTemp.shareInstance.webSeriesHindi +// if hindiListing.count >= 3{ +// vc.webSeriesHindiBtn.isHidden = false +// }else{ +// vc.webSeriesHindiBtn.isHidden = true +// } } // MARK: - Like , unlike diff --git a/WOKA/Info.plist b/WOKA/Info.plist index d08457d..7d2da2e 100644 --- a/WOKA/Info.plist +++ b/WOKA/Info.plist @@ -41,5 +41,7 @@ audio remote-notification + NSUserNotificationsUsageDescription + You need to allow for notifications to keep you updated about the content. diff --git a/WOKA/Main/AuthFunc/AuthFunc.swift b/WOKA/Main/AuthFunc/AuthFunc.swift index 1111908..50e0c30 100644 --- a/WOKA/Main/AuthFunc/AuthFunc.swift +++ b/WOKA/Main/AuthFunc/AuthFunc.swift @@ -8,6 +8,7 @@ import Foundation import AVFoundation import UIKit +import OneSignalFramework enum GetSet{ case get @@ -60,6 +61,11 @@ class AuthFunc{ return UIDevice.current.identifierForVendor!.uuidString } + //This will return oneplayer signal id + func getOneSignalID() -> String{ + return OneSignal.User.pushSubscription.id ?? "" + } + // Sets authentication ID and password from the app's info dictionary func setAuthIDPass(){ if let id = Bundle.main.infoDictionary?["API_KEY_ID"] as? String{ diff --git a/WOKA/Main/Delegate/AppDelegate.swift b/WOKA/Main/Delegate/AppDelegate.swift index 6689819..8e0c5c8 100644 --- a/WOKA/Main/Delegate/AppDelegate.swift +++ b/WOKA/Main/Delegate/AppDelegate.swift @@ -10,11 +10,14 @@ import Lottie import IQKeyboardManagerSwift import JWPlayerKit import Firebase +import OneSignalFramework let appDelegate = UIApplication.shared.delegate as! AppDelegate @main class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? var deviceOrientation = UIInterfaceOrientationMask.portrait @@ -31,7 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - + // //Initialize Firebase // FirebaseApp.configure() @@ -45,6 +48,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Set the authentication ID Pass after app starts AuthFunc.shareInstance.setAuthIDPass() + UNUserNotificationCenter.current().delegate = self + + // OneSignal initialization + OneSignal.initialize("f9674e6f-75fb-49e8-8379-4f2ed2a880b8", withLaunchOptions: launchOptions) + OneSignal.Notifications.requestPermission() + // Add your AppDelegate as an obsserver + OneSignal.Notifications.addClickListener(self) + OneSignal.Notifications.addForegroundLifecycleListener(self) + // Set the toast defaults setupToast() @@ -112,3 +124,18 @@ extension AppDelegate { } } + +// MARK: - Notification Click Handler + +extension AppDelegate : OSNotificationClickListener, OSNotificationLifecycleListener, UNUserNotificationCenterDelegate{ + + //Handle on click event + func onClick(event: OSNotificationClickEvent) { +// print("event") + // Respond to notification click + } + + func onWillDisplay(event: OSNotificationWillDisplayEvent) { + print("Will Display") + } +} diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift index 58ec79e..e8f0a5b 100644 --- a/WOKA/Network Adapter/APIEndPoints.swift +++ b/WOKA/Network Adapter/APIEndPoints.swift @@ -78,7 +78,7 @@ struct APIEndPoints { 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") + static let favourite_listing = makeURL(path: "v2/favourite_listing") //Post Like Unlike static let post_like = makeURL(path: "post_like") diff --git a/WOKA/OnBoarding Module/Base.lproj/Main.storyboard b/WOKA/OnBoarding Module/Base.lproj/Main.storyboard index 12ba1f8..ee89a79 100644 --- a/WOKA/OnBoarding Module/Base.lproj/Main.storyboard +++ b/WOKA/OnBoarding Module/Base.lproj/Main.storyboard @@ -519,6 +519,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/OnBoarding Module/Controller/SplashVC.swift b/WOKA/OnBoarding Module/Controller/SplashVC.swift index 0f9ab69..4031fb5 100644 --- a/WOKA/OnBoarding Module/Controller/SplashVC.swift +++ b/WOKA/OnBoarding Module/Controller/SplashVC.swift @@ -7,6 +7,7 @@ import UIKit import Lottie +import OneSignalFramework class SplashVC: UIViewController { @@ -29,6 +30,8 @@ class SplashVC: UIViewController { vm.playSplashSound() animateImageScale() self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.plain, target:nil, action:nil) + + print("OneSignalID:- ", OneSignal.User.pushSubscription.id ?? "NIL") } @IBAction func languageBtnTapped(_ sender: UIButton) { diff --git a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift index d336172..b6180dd 100644 --- a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift +++ b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift @@ -64,7 +64,7 @@ class SplashVM{ func getUserData(){ if AuthFunc.shareInstance.getUserType() == 3{ //setusertype - AuthFunc.shareInstance.userData = UserDataDM.ResultData(id: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil) + AuthFunc.shareInstance.userData = UserDataDM.ResultData(id: nil, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil) UIApplication.setRootView(SideMenuController.instantiate(from: .Home)) return } diff --git a/WOKA/PersistentStorage.swift b/WOKA/PersistentStorage.swift index c104ac0..b39eec7 100644 --- a/WOKA/PersistentStorage.swift +++ b/WOKA/PersistentStorage.swift @@ -295,8 +295,8 @@ final class PersistentStorage PersistentStorage.shared.checkIfExist( key: .post_type,clicksData: userClicks) } - func addGamesCount(postID : Int){ - let userClicks = UserClickData(clickCounts: 1, categoryId: 0, postId: postID, postType: PostType.game.rawValue) + func addGamesCount(postID : Int, count : Int = 1){ + let userClicks = UserClickData(clickCounts: count, categoryId: 0, postId: postID, postType: PostType.game.rawValue) PersistentStorage.shared.checkIfExist( key: .post_type,clicksData: userClicks) } diff --git a/WOKA/SideBarNav/Controller/AboutUsVc.swift b/WOKA/SideBarNav/Controller/AboutUsVc.swift index 903c707..94a1f3b 100644 --- a/WOKA/SideBarNav/Controller/AboutUsVc.swift +++ b/WOKA/SideBarNav/Controller/AboutUsVc.swift @@ -27,6 +27,10 @@ class AboutUsVc: UIViewController { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) self.navigationController?.setColor(color: .white) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } } diff --git a/WOKA/SideBarNav/Controller/ContactSupportVC.swift b/WOKA/SideBarNav/Controller/ContactSupportVC.swift index 380b6fd..d0daee7 100644 --- a/WOKA/SideBarNav/Controller/ContactSupportVC.swift +++ b/WOKA/SideBarNav/Controller/ContactSupportVC.swift @@ -48,12 +48,16 @@ class ContactSupportVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } // MARK: - Button Click Handler @IBAction func submitBtnTapped(_ sender: LocalisedElementsButton) { - + PersistentStorage.shared.addOthersCount() /* if user is guest check for name and email */ diff --git a/WOKA/SideBarNav/Controller/FaqVC.swift b/WOKA/SideBarNav/Controller/FaqVC.swift index dfb5d8b..6f99844 100644 --- a/WOKA/SideBarNav/Controller/FaqVC.swift +++ b/WOKA/SideBarNav/Controller/FaqVC.swift @@ -42,6 +42,10 @@ class FaqVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } override func viewDidDisappear(_ animated: Bool) { @@ -63,6 +67,7 @@ extension FaqVC : TableViewSRC{ } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + PersistentStorage.shared.addOthersCount() var index = [IndexPath]() if let lastIndex = vm.lastIndex{ if lastIndex == indexPath.row{ diff --git a/WOKA/SideBarNav/Controller/ProfileVC.swift b/WOKA/SideBarNav/Controller/ProfileVC.swift index bfd61d4..839dd40 100644 --- a/WOKA/SideBarNav/Controller/ProfileVC.swift +++ b/WOKA/SideBarNav/Controller/ProfileVC.swift @@ -38,9 +38,14 @@ class ProfileVC: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } @IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) { + PersistentStorage.shared.addOthersCount() if fullNameTF.text!.count < 3 { let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC diff --git a/WOKA/SideBarNav/Controller/WebViewVC.swift b/WOKA/SideBarNav/Controller/WebViewVC.swift index 88c8f6c..c591e38 100644 --- a/WOKA/SideBarNav/Controller/WebViewVC.swift +++ b/WOKA/SideBarNav/Controller/WebViewVC.swift @@ -67,5 +67,10 @@ class WebViewVC: UIViewController, WKNavigationDelegate{ super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) self.navigationController?.setColor(color: .black) + + if self.isMovingFromParent { + // Back button was pressed + PersistentStorage.shared.addOthersCount() + } } } diff --git a/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift b/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift index add06ce..edd1b12 100644 --- a/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift +++ b/WOKA/SideBarNav/ViewModel/ContactSupportVM.swift @@ -51,10 +51,12 @@ class ContactSupportVM{ initDropDown() vc.bottomArrow.addTapGesture { + PersistentStorage.shared.addOthersCount() self.dropDownModule.show() } vc.subjectLabel.addTapGesture { + PersistentStorage.shared.addOthersCount() self.dropDownModule.show() } diff --git a/WOKA/SideBarNav/ViewModel/ProfileVM.swift b/WOKA/SideBarNav/ViewModel/ProfileVM.swift index d2c10b6..9a5bba6 100644 --- a/WOKA/SideBarNav/ViewModel/ProfileVM.swift +++ b/WOKA/SideBarNav/ViewModel/ProfileVM.swift @@ -28,7 +28,8 @@ class ProfileVM{ addTapGesture() setUserData() hindiEnglishLanguage() - + + vc.dob.isEnabled = false /* Depnding on user type limit the date */ @@ -52,6 +53,7 @@ class ProfileVM{ } @objc func editNameClicked(){ + PersistentStorage.shared.addOthersCount() vc.fullNameTF.becomeFirstResponder() } @@ -66,6 +68,15 @@ class ProfileVM{ } } + if let genderData = data.genderData ,let id = genderData.id { + if gender == id{ + enableDisableNextBtn(enable: false) + }else{ + enableDisableNextBtn(enable: true) + } + }else{ + enableDisableNextBtn(enable: true) + } } private func enableDisableNextBtn(enable : Bool){ @@ -80,8 +91,17 @@ class ProfileVM{ func setUserData(){ guard let data = AuthFunc.shareInstance.userData else{return} - gender = 2 // static for now - + gender = 0 // default + if let genderData = data.genderData{ + if genderData.id == 1{ // girl + gender = genderData.id ?? 1 + }else if genderData.id == 2{ //boy + gender = genderData.id ?? 2 + } + }else{ + gender = 0 + } + vc.fullNameTF.text = data.fullname vc.userNameLabel.text = data.username vc.emailTF.text = data.email @@ -130,9 +150,13 @@ class ProfileVM{ self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) case 1: // Success Utilities.dismissProgressHUD() - self.vc.toast(msg: data.message ?? "Updated profile", time: 1.5) { - guard let data = data.data?.result else{return} - AuthFunc.shareInstance.userData = data + self.vc.toast(msg: data.message ?? "Updated profile", time: 1.5) { [weak self] in + guard let self, let data = data.data?.result else{return} + AuthFunc.shareInstance.userData?.fullname = vc.fullNameTF.text + AuthFunc.shareInstance.userData?.genderData?.id = gender + AuthFunc.shareInstance.userData?.genderData?.genderName = (gender == 1 ? "Boy" : "Girl") + +// AuthFunc.shareInstance.userData = data self.enableDisableNextBtn(enable: false) // self.vc.navigationController?.popViewController(animated: true) } @@ -151,7 +175,22 @@ class ProfileVM{ func boyBtnTapped() { // Apply click effect animation + PersistentStorage.shared.addOthersCount() gender = 2 + + //check if userdata has same gender + if let data = AuthFunc.shareInstance.userData { + if let genderData = data.genderData, let id = genderData.id{ + if id == 2{ + enableDisableNextBtn(enable: false) + }else{ + enableDisableNextBtn(enable: true) + } + }else{ + enableDisableNextBtn(enable: true) + } + } + UIView.animate(withDuration: 0.1, animations: { self.vc.boyView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) }) { _ in @@ -163,8 +202,22 @@ class ProfileVM{ } func girlBtnTapped() { + PersistentStorage.shared.addOthersCount() gender = 1 + //check if userdata has same gender + if let data = AuthFunc.shareInstance.userData { + if let genderData = data.genderData, let id = genderData.id{ + if id == 1{ + enableDisableNextBtn(enable: false) + }else{ + enableDisableNextBtn(enable: true) + } + }else{ + enableDisableNextBtn(enable: true) + } + } + // Apply click effect animation UIView.animate(withDuration: 0.1, animations: { self.vc.girlView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) diff --git a/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift b/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift index fbfa04a..73daf65 100644 --- a/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift +++ b/WOKA/TabBar & SideMenu/Controller/TabBarVC.swift @@ -77,9 +77,11 @@ class TabBarVC: UITabBarController { switch mode{ case .yes: //If user clicked nav him to login screen. Call the api. + PersistentStorage.shared.addOthersCount() deactivateAccount() print("Yes") case .no: + PersistentStorage.shared.addOthersCount() print("no") } } diff --git a/WOKA/Theme/Base.lproj/Theme.storyboard b/WOKA/Theme/Base.lproj/Theme.storyboard index 1e8aaf6..1151492 100644 --- a/WOKA/Theme/Base.lproj/Theme.storyboard +++ b/WOKA/Theme/Base.lproj/Theme.storyboard @@ -775,7 +775,7 @@ - + @@ -1319,10 +1319,7 @@ - - - - + diff --git a/WOKA/Theme/Controller/ThemeOneVC.swift b/WOKA/Theme/Controller/ThemeOneVC.swift index db20010..99bf5ed 100644 --- a/WOKA/Theme/Controller/ThemeOneVC.swift +++ b/WOKA/Theme/Controller/ThemeOneVC.swift @@ -55,10 +55,9 @@ class ThemeOneVC: UIViewController { playerItem.removeObserver(self, forKeyPath: "isPlaybackLikelyToKeepUp") } if let playerLayer = vm.playerLayer, let avPlayer = vm.avPlayer { - playerLayer.removeObserver(self, forKeyPath: "timeControlStatus") + avPlayer.removeObserver(self, forKeyPath: "timeControlStatus") avPlayer.pause() } - } override var preferredStatusBarStyle: UIStatusBarStyle { diff --git a/WOKA/Theme/Controller/ThemeTwoVC.swift b/WOKA/Theme/Controller/ThemeTwoVC.swift index dbcdbef..35db385 100644 --- a/WOKA/Theme/Controller/ThemeTwoVC.swift +++ b/WOKA/Theme/Controller/ThemeTwoVC.swift @@ -49,6 +49,7 @@ class ThemeTwoVC: UIViewController { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() vm.setData() + vm.playerLayer.frame = liveTvView.bounds } @IBAction func sideBarBtnTapped(_ sender: UIButton) { diff --git a/WOKA/Theme/ViewModel/ThemeOneVM.swift b/WOKA/Theme/ViewModel/ThemeOneVM.swift index c5dfab1..53948b2 100644 --- a/WOKA/Theme/ViewModel/ThemeOneVM.swift +++ b/WOKA/Theme/ViewModel/ThemeOneVM.swift @@ -443,14 +443,10 @@ class ThemeOneVM{ vc.modalPresentationStyle = .fullScreen vc.modalTransitionStyle = .crossDissolve - DispatchQueue.main.async { [weak self] in - guard let self else{return} - // Present the PlayerVC - self.vc.present(vc, animated: false) { [weak self] in - guard let self else{return} - stopLiveStream() - } + self.vc.present(vc, animated: false) { [weak self] in + guard let self else{return} + stopLiveStream() } } catch { print("Error creating JWPlayer configuration: \(error)") diff --git a/WOKA/Theme/ViewModel/ThemeTwoVM.swift b/WOKA/Theme/ViewModel/ThemeTwoVM.swift index 1258a20..249073e 100644 --- a/WOKA/Theme/ViewModel/ThemeTwoVM.swift +++ b/WOKA/Theme/ViewModel/ThemeTwoVM.swift @@ -174,14 +174,10 @@ class ThemeTwoVM{ vc.modalPresentationStyle = .fullScreen vc.modalTransitionStyle = .crossDissolve - DispatchQueue.main.async { [weak self] in + // Present the PlayerVC + self.vc.present(vc, animated: false) { [weak self] in guard let self else{return} - - // Present the PlayerVC - self.vc.present(vc, animated: false) { [weak self] in - guard let self else{return} - stopLiveStream() - } + stopLiveStream() } } catch { print("Error creating JWPlayer configuration: \(error)") @@ -269,7 +265,7 @@ class ThemeTwoVM{ playerLayer.frame = self.vc.liveTvView.bounds self.vc.liveTvView.layer.addSublayer(playerLayer) - + self.vc.liveTvView.layoutIfNeeded() avPlayer.play() avPlayer.volume = 0 } diff --git a/WOKA/WOKA.entitlements b/WOKA/WOKA.entitlements index 8b1b443..500f444 100644 --- a/WOKA/WOKA.entitlements +++ b/WOKA/WOKA.entitlements @@ -2,10 +2,16 @@ + aps-environment + development com.apple.developer.user-fonts app-usage system-installation + com.apple.security.application-groups + + group.com.app.woka.onesignal +