diff --git a/Podfile b/Podfile index 72a8e41..1549735 100644 --- a/Podfile +++ b/Podfile @@ -8,7 +8,7 @@ target 'WOKA' do pod 'IQKeyboardManagerSwift', '~> 7.0.2' # GIF Animations - pod 'lottie-ios', '~> 4.4.1' +# pod 'lottie-ios', '~> 4.4.3' #Network call pod 'Alamofire' , '~> 5.9.1' @@ -16,6 +16,9 @@ target 'WOKA' do # Image Loading & Caching pod 'SDWebImage' , '~> 5.19.4' + # Google Ads + pod 'Google-Mobile-Ads-SDK' + #JwPlayer # pod 'JWPlayerKit' diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index fe57866..c47f96c 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -252,7 +252,6 @@ 52DAC6482C21762900E2F85B /* WebSeries.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52DAC6472C21762900E2F85B /* WebSeries.storyboard */; }; 52DAC64E2C21775300E2F85B /* WebSeriesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */; }; 52E214C72C2AD47F00BC2D29 /* EpisodeDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52E214C62C2AD47F00BC2D29 /* EpisodeDetailsVC.swift */; }; - 52E5B3442C859104000291E0 /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 52E5B3422C859104000291E0 /* WOKA.xcdatamodeld */; }; 52F4E8662C3D123B00778FBC /* JWKaraokePlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52F4E8652C3D123B00778FBC /* JWKaraokePlayerVC.swift */; }; 52FB2D8F2BDF898F0009B0C7 /* TextFieldPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */; }; 52FDBA782BFF23F4009D7AC7 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */; }; @@ -317,9 +316,6 @@ 9C834EDC2C1C26CD00B29A9C /* HtmlText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */; }; 9C8446872C40FC6E003E3E53 /* AVPlayerTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8446862C40FC6E003E3E53 /* AVPlayerTesting.swift */; }; 9C85A9EC2C5CD5CD0031C365 /* MyListDataTemp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C85A9EB2C5CD5CD0031C365 /* MyListDataTemp.swift */; }; - 9C85A9EF2C5CE1060031C365 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */; }; - 9C85A9F12C5CE1060031C365 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */; }; - 9C85A9F32C5CE1060031C365 /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 9C85A9F22C5CE1060031C365 /* FirebasePerformance */; }; 9C8C4FAE2C1315410017DD3B /* WebViewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */; }; 9C8C4FB02C1328060017DD3B /* Disclaimer.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */; }; 9C9BE46E2C663B1600C48D6A /* JWKaraokePlayerVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BE46D2C663B1600C48D6A /* JWKaraokePlayerVM.swift */; }; @@ -332,6 +328,10 @@ 9CB3D08F2C37D0D60062869D /* KaraokeListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CB3D08E2C37D0D60062869D /* KaraokeListingDM.swift */; }; 9CB3D0912C37D6930062869D /* KaraokeDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CB3D0902C37D6930062869D /* KaraokeDetailsVC.swift */; }; 9CB4C5A92C118EF300737C00 /* NavBarColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CB4C5A82C118EF300737C00 /* NavBarColor.swift */; }; + 9CBA53092C8996F50046735C /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 9CBA53072C8996F50046735C /* WOKA.xcdatamodeld */; }; + 9CBA530C2C89A2680046735C /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9CBA530B2C89A2680046735C /* FirebaseAnalytics */; }; + 9CBA530E2C89A2680046735C /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 9CBA530D2C89A2680046735C /* FirebaseCrashlytics */; }; + 9CBA53102C89A2680046735C /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 9CBA530F2C89A2680046735C /* FirebasePerformance */; }; 9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29A2BE4D614007D7934 /* LoginVC.swift */; }; 9CBCB29D2BE4D6BB007D7934 /* LoginVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */; }; 9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CBCB29E2BE4E13A007D7934 /* ValidatorClass.swift */; }; @@ -360,6 +360,7 @@ 9CDAEB142C54132E00890C47 /* CheckEddDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CDAEB132C54132E00890C47 /* CheckEddDM.swift */; }; 9CDC343C2BDBBC6B00093089 /* SelectAgeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CDC343B2BDBBC6B00093089 /* SelectAgeVC.swift */; }; 9CDCE1452BDB9B9A003FEF11 /* OnBoardMainSound.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 9CDCE1442BDB9B9A003FEF11 /* OnBoardMainSound.m4a */; }; + 9CF6980B2C89A324006007EF /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 9CF6980A2C89A324006007EF /* Lottie */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -654,7 +655,6 @@ 52DAC6472C21762900E2F85B /* WebSeries.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = WebSeries.storyboard; sourceTree = ""; }; 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSeriesVC.swift; sourceTree = ""; }; 52E214C62C2AD47F00BC2D29 /* EpisodeDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EpisodeDetailsVC.swift; sourceTree = ""; }; - 52E5B3432C859104000291E0 /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; 52E7E0F62BDF7DD500C86E10 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/AuthenticationSB.strings; sourceTree = ""; }; 52E7E0F82BDF7DD900C86E10 /* hi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hi; path = hi.lproj/AuthenticationSB.strings; sourceTree = ""; }; 52F477A42C492ED900F79200 /* JWPlayerKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = JWPlayerKit.xcframework; path = Pods/JWPlayerKit/JWPlayerKit.xcframework; sourceTree = ""; }; @@ -723,6 +723,7 @@ 9CB3D08E2C37D0D60062869D /* KaraokeListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KaraokeListingDM.swift; sourceTree = ""; }; 9CB3D0902C37D6930062869D /* KaraokeDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KaraokeDetailsVC.swift; sourceTree = ""; }; 9CB4C5A82C118EF300737C00 /* NavBarColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavBarColor.swift; sourceTree = ""; }; + 9CBA53082C8996F50046735C /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; 9CBCB29A2BE4D614007D7934 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = ""; }; 9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVM.swift; sourceTree = ""; }; 9CBCB29E2BE4E13A007D7934 /* ValidatorClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidatorClass.swift; sourceTree = ""; }; @@ -764,11 +765,12 @@ files = ( 4469E533EC95AC428FE50FB2 /* Pods_WOKA.framework in Frameworks */, 52C83E3F2C493FD700F27563 /* RSKPlaceholderTextView in Frameworks */, + 9CF6980B2C89A324006007EF /* Lottie in Frameworks */, + 9CBA530C2C89A2680046735C /* FirebaseAnalytics in Frameworks */, + 9CBA530E2C89A2680046735C /* FirebaseCrashlytics in Frameworks */, 528F26F02C6B7BD1003E4D99 /* OneSignalFramework in Frameworks */, - 9C85A9F32C5CE1060031C365 /* FirebasePerformance in Frameworks */, - 9C85A9F12C5CE1060031C365 /* FirebaseCrashlytics in Frameworks */, - 9C85A9EF2C5CE1060031C365 /* FirebaseAnalytics in Frameworks */, 528F26F22C6B7BD1003E4D99 /* OneSignalInAppMessages in Frameworks */, + 9CBA53102C89A2680046735C /* FirebasePerformance in Frameworks */, 521CB1002C493DB80085BDF8 /* JWPlayerKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -962,7 +964,7 @@ 9C535DC82C00C34000DA6DCD /* Theme */, 52DAC6462C21761700E2F85B /* WebSeries */, 9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */, - 52E5B3422C859104000291E0 /* WOKA.xcdatamodeld */, + 9CBA53072C8996F50046735C /* WOKA.xcdatamodeld */, 52ACC1292C610EC900791528 /* PersistentStorage.swift */, ); path = WOKA; @@ -2012,6 +2014,7 @@ 523ED2582BDA2BC700CFED02 /* Resources */, 90182DDCD7EAE5F6DA5B4DFB /* [CP] Embed Pods Frameworks */, 528F26E72C6B7B30003E4D99 /* Embed Foundation Extensions */, + 7E437097FFA5CD78E3590A44 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -2022,11 +2025,12 @@ packageProductDependencies = ( 521CB0FF2C493DB80085BDF8 /* JWPlayerKit */, 52C83E3E2C493FD700F27563 /* RSKPlaceholderTextView */, - 9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */, - 9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */, - 9C85A9F22C5CE1060031C365 /* FirebasePerformance */, 528F26EF2C6B7BD1003E4D99 /* OneSignalFramework */, 528F26F12C6B7BD1003E4D99 /* OneSignalInAppMessages */, + 9CBA530B2C89A2680046735C /* FirebaseAnalytics */, + 9CBA530D2C89A2680046735C /* FirebaseCrashlytics */, + 9CBA530F2C89A2680046735C /* FirebasePerformance */, + 9CF6980A2C89A324006007EF /* Lottie */, ); productName = WOKA; productReference = 523ED25A2BDA2BC700CFED02 /* WOKA.app */; @@ -2127,8 +2131,9 @@ packageReferences = ( 521CB0FE2C493DB80085BDF8 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */, 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */, - 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, 528F26EC2C6B7BD1003E4D99 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */, + 9CBA530A2C89A2680046735C /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + 9CF698092C89A324006007EF /* XCRemoteSwiftPackageReference "lottie-spm" */, ); productRefGroup = 523ED25B2BDA2BC700CFED02 /* Products */; projectDirPath = ""; @@ -2240,6 +2245,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 7E437097FFA5CD78E3590A44 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-WOKA/Pods-WOKA-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-WOKA/Pods-WOKA-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-WOKA/Pods-WOKA-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 85374DA1EC2E3F7D8F24983D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2439,6 +2461,7 @@ 525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */, 52ACC1352C64C89900791528 /* MyOrderDetailsVC.swift in Sources */, 522D655E2C1ACCF40021E505 /* UserNotificationDM.swift in Sources */, + 9CBA53092C8996F50046735C /* WOKA.xcdatamodeld in Sources */, 52ACC13A2C64CD0100791528 /* MyOrderDetailsCell.swift in Sources */, 9C1C69FC2C106C240035B2C7 /* ContactSupportVM.swift in Sources */, 52AF71F22C36B77B00BC5972 /* GamesDetailVC.swift in Sources */, @@ -2458,7 +2481,6 @@ 9CBE1B432C0F37B300CA6E61 /* DropDown.swift in Sources */, 52A6DC9C2C4E38E000F63C51 /* ShopListingVC.swift in Sources */, 52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */, - 52E5B3442C859104000291E0 /* WOKA.xcdatamodeld in Sources */, 5219C2C22C086D9C00A1DF4D /* DataTypeConversion.swift in Sources */, 525953CF2BE8B28F00191286 /* Utilities.swift in Sources */, 52BFB5332C33DAD700BAAE15 /* AudioBookHomeVC.swift in Sources */, @@ -2790,7 +2812,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = Added; DEVELOPMENT_TEAM = 4S9A74ZB6H; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -2830,7 +2852,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = Added; DEVELOPMENT_TEAM = 4S9A74ZB6H; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -3068,12 +3090,20 @@ minimumVersion = 8.0.0; }; }; - 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + 9CBA530A2C89A2680046735C /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 11.0.0; + minimumVersion = 11.1.0; + }; + }; + 9CF698092C89A324006007EF /* XCRemoteSwiftPackageReference "lottie-spm" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/airbnb/lottie-spm.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 4.5.0; }; }; /* End XCRemoteSwiftPackageReference section */ @@ -3104,32 +3134,37 @@ package = 52C83E3D2C493FD700F27563 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */; productName = RSKPlaceholderTextView; }; - 9C85A9EE2C5CE1060031C365 /* FirebaseAnalytics */ = { + 9CBA530B2C89A2680046735C /* FirebaseAnalytics */ = { isa = XCSwiftPackageProductDependency; - package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + package = 9CBA530A2C89A2680046735C /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebaseAnalytics; }; - 9C85A9F02C5CE1060031C365 /* FirebaseCrashlytics */ = { + 9CBA530D2C89A2680046735C /* FirebaseCrashlytics */ = { isa = XCSwiftPackageProductDependency; - package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + package = 9CBA530A2C89A2680046735C /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebaseCrashlytics; }; - 9C85A9F22C5CE1060031C365 /* FirebasePerformance */ = { + 9CBA530F2C89A2680046735C /* FirebasePerformance */ = { isa = XCSwiftPackageProductDependency; - package = 9C85A9ED2C5CE1060031C365 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + package = 9CBA530A2C89A2680046735C /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebasePerformance; }; + 9CF6980A2C89A324006007EF /* Lottie */ = { + isa = XCSwiftPackageProductDependency; + package = 9CF698092C89A324006007EF /* XCRemoteSwiftPackageReference "lottie-spm" */; + productName = Lottie; + }; /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ - 52E5B3422C859104000291E0 /* WOKA.xcdatamodeld */ = { + 9CBA53072C8996F50046735C /* WOKA.xcdatamodeld */ = { isa = XCVersionGroup; children = ( - 52E5B3432C859104000291E0 /* WOKA.xcdatamodel */, + 9CBA53082C8996F50046735C /* WOKA.xcdatamodel */, ); - currentVersion = 52E5B3432C859104000291E0 /* WOKA.xcdatamodel */; + currentVersion = 9CBA53082C8996F50046735C /* WOKA.xcdatamodel */; name = WOKA.xcdatamodeld; - path = /Users/macbookpro/Desktop/WOKA/WOKA/WOKA.xcdatamodeld; + path = /Users/bilal/Desktop/woka_native_ios_swift/WOKA/WOKA.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; diff --git a/WOKA/Games/Controller/GamesListVC.swift b/WOKA/Games/Controller/GamesListVC.swift index e938b43..6b83b76 100644 --- a/WOKA/Games/Controller/GamesListVC.swift +++ b/WOKA/Games/Controller/GamesListVC.swift @@ -6,6 +6,7 @@ // import UIKit +import GoogleMobileAds class GamesListVC: UIViewController { @@ -25,6 +26,9 @@ class GamesListVC: UIViewController { var vm = GamesListVM() + private var interstitial: GADInterstitialAd? + private var rewardedAd: GADRewardedAd? + override func viewDidLoad() { super.viewDidLoad() vm.vc = self @@ -33,6 +37,22 @@ class GamesListVC: UIViewController { self.title = "GAMES".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() + + Task { + do { + interstitial = try await GADInterstitialAd.load( + withAdUnitID: "ca-app-pub-3940256099942544/4411468910", request: GADRequest()) + interstitial?.fullScreenContentDelegate = self + + rewardedAd = try await GADRewardedAd.load( + withAdUnitID: "ca-app-pub-3940256099942544/1712485313", request: GADRequest()) + rewardedAd?.fullScreenContentDelegate = self + + + } catch { + print("Failed to load interstitial ad with error: \(error.localizedDescription)") + } + } } override func viewWillAppear(_ animated: Bool) { @@ -150,9 +170,35 @@ extension GamesListVC : TableViewSRC{ vm.setHeaderData() let data = vm.gameData[indexPath.row] + if let postID = data.id{ PersistentStorage.shared.addGamesCount(postID: postID) } + + /* + This is only for test + */ + if data.title == "WOKA Ludo"{ +// guard let interstitial = interstitial else { +// return print("Ad wasn't ready.") +// } +// +// // The UIViewController parameter is an optional. +// interstitial.present(fromRootViewController: nil) + guard let rewardedAd = rewardedAd else { + return print("Ad wasn't ready.") + } + + // The UIViewController parameter is an optional. + rewardedAd.present(fromRootViewController: nil) { + let reward = rewardedAd.adReward + print("Reward received with currency \(reward.amount), amount \(reward.amount.doubleValue)") + // TODO: Reward the user. + } + return + } + + let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesDetailVC) as! GamesDetailVC vcPush.modalPresentationStyle = .overCurrentContext @@ -225,3 +271,45 @@ extension GamesListVC: UIScrollViewDelegate { } } } + + +extension GamesListVC : GADFullScreenContentDelegate{ + /// Tells the delegate that the ad failed to present full screen content. + func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { + print("Ad did fail to present full screen content.") + } + + /// Tells the delegate that the ad will present full screen content. + func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { + print("Ad will present full screen content.") + } + + /// Tells the delegate that the ad dismissed full screen content. + func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { + print("Ad did dismiss full screen content.") + let data = vm.gameData.first + + 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.gameIndex = 0 + vcPush.gameData = data + vcPush.delegate = self + self.present(vcPush, animated: true) + + Task { + do { + interstitial = try await GADInterstitialAd.load( + withAdUnitID: "ca-app-pub-3940256099942544/4411468910", request: GADRequest()) + interstitial?.fullScreenContentDelegate = self + + rewardedAd = try await GADRewardedAd.load( + withAdUnitID: "ca-app-pub-3940256099942544/1712485313", request: GADRequest()) + rewardedAd?.fullScreenContentDelegate = self + } catch { + print("Failed to load interstitial ad with error: \(error.localizedDescription)") + } + } + } +} diff --git a/WOKA/Info.plist b/WOKA/Info.plist index 290a04a..f969987 100644 --- a/WOKA/Info.plist +++ b/WOKA/Info.plist @@ -2,6 +2,8 @@ + GADApplicationIdentifier + ca-app-pub-5699008063638916~6654980943 API_KEY_ID $(API_KEY_ID) API_KEY_PASS diff --git a/WOKA/Main/Delegate/AppDelegate.swift b/WOKA/Main/Delegate/AppDelegate.swift index 0a32c9b..3f1738b 100644 --- a/WOKA/Main/Delegate/AppDelegate.swift +++ b/WOKA/Main/Delegate/AppDelegate.swift @@ -10,6 +10,7 @@ import Lottie import IQKeyboardManagerSwift import JWPlayerKit import Firebase +import GoogleMobileAds import OneSignalFramework let appDelegate = UIApplication.shared.delegate as! AppDelegate @@ -32,10 +33,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // //Initialize Firebase FirebaseApp.configure() + // Initialize the Google Mobile Ads SDK. + GADMobileAds.sharedInstance().start(completionHandler: nil) + // enabling the IQKeyboard manager instance IQKeyboardManager.shared.enable = true IQKeyboardManager.shared.resignOnTouchOutside = true diff --git a/WOKA/Network Adapter/NetworkManager.swift b/WOKA/Network Adapter/NetworkManager.swift index 2573bf5..249d6e0 100644 --- a/WOKA/Network Adapter/NetworkManager.swift +++ b/WOKA/Network Adapter/NetworkManager.swift @@ -14,7 +14,7 @@ class NetworkManager{ private init() {} - enum APIError: Error { + enum APIError: Error, LocalizedError { case networkError case noNetwork(message:String) case invalidURL @@ -22,6 +22,25 @@ class NetworkManager{ case responseValidationFailed case unknown(message: String) case custom(message: String) + + var errorDescription: String? { + switch self { + case .networkError: + return "A network error occurred." + case .noNetwork(let message): + return "No network: \(message)" + case .invalidURL: + return "The URL provided is invalid." + case .parameterEncodingFailed: + return "Failed to encode the parameters." + case .responseValidationFailed: + return "Response validation failed." + case .unknown(let message): + return "Unknown error: \(message)" + case .custom(let message): + return "Custom error: \(message)" + } + } } /// This function will do the network call for HTTPMethod & Encoding is URLEncoding with contentType ["application/json"] diff --git a/WOKA/Shop/Controller/ShopListingVC.swift b/WOKA/Shop/Controller/ShopListingVC.swift index 8473532..91ff8da 100644 --- a/WOKA/Shop/Controller/ShopListingVC.swift +++ b/WOKA/Shop/Controller/ShopListingVC.swift @@ -108,27 +108,36 @@ extension ShopListingVC : TableViewSRC{ if vm.superCatData.count == 0 {return} - if let adsData = AuthFunc.shareInstance.adsData, (adsData.result?.filter({$0.forPage == AdsEnum.shop_super_category.rawValue}).first) != nil{ - // check if ads data contains ad for webseries - let superCatID = vm.superCatData[indexPath.row - 1].id - if let superCatID{ - PersistentStorage.shared.addShopCount(postID: superCatID) - } - let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) - let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC - vcPush.vm.superCatID = superCatID - self.navigationController?.pushViewController(vcPush, animated: true) - return - }else{ - let superCatID = vm.superCatData[indexPath.row].id - if let superCatID{ - PersistentStorage.shared.addShopCount(postID: superCatID) - } - let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) - let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC - vcPush.vm.superCatID = superCatID - self.navigationController?.pushViewController(vcPush, animated: true) + let superCatID = vm.superCatData[indexPath.row].id + if let superCatID{ + PersistentStorage.shared.addShopCount(postID: superCatID) } + let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC + vcPush.vm.superCatID = superCatID + self.navigationController?.pushViewController(vcPush, animated: true) + +// if let adsData = AuthFunc.shareInstance.adsData, (adsData.result?.filter({$0.forPage == AdsEnum.shop_super_category.rawValue}).first) != nil{ +// // check if ads data contains ad for webseries +// let superCatID = vm.superCatData[indexPath.row - 1].id +// if let superCatID{ +// PersistentStorage.shared.addShopCount(postID: superCatID) +// } +// let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) +// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC +// vcPush.vm.superCatID = superCatID +// self.navigationController?.pushViewController(vcPush, animated: true) +// return +// }else{ +// let superCatID = vm.superCatData[indexPath.row].id +// if let superCatID{ +// PersistentStorage.shared.addShopCount(postID: superCatID) +// } +// let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) +// let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC +// vcPush.vm.superCatID = superCatID +// self.navigationController?.pushViewController(vcPush, animated: true) +// } } } diff --git a/WOKA/Theme/Base.lproj/Theme.storyboard b/WOKA/Theme/Base.lproj/Theme.storyboard index 59f0c87..b49bbb7 100644 --- a/WOKA/Theme/Base.lproj/Theme.storyboard +++ b/WOKA/Theme/Base.lproj/Theme.storyboard @@ -961,7 +961,7 @@ - +