From 54c3da8bed45387b4b9e51d8642a1efc1d592c77 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 17 Sep 2024 22:52:09 +0530 Subject: [PATCH] - worked on google ads. - Removed the fullscreen button from jwplayerviewcontroller. - removed picuture in picutre - removed the laguage button - added skin styling for jwplayer --- WOKA.xcodeproj/project.pbxproj | 21 ++-- WOKA/Cart/CartDataCache.swift | 2 + WOKA/Constants K/GVar.swift | 6 ++ WOKA/Constants K/GoogleAdIDs.swift | 6 ++ WOKA/Games/Controller/GamesDetailVC.swift | 93 +++++++++++++++++- WOKA/Games/Controller/GamesListVC.swift | 95 +------------------ WOKA/Games/Controller/GamesWebViewVC.swift | 30 ++++-- WOKA/Games/Games.storyboard | 62 ++++++------ WOKA/Games/ViewModel/GamesListVM.swift | 1 + WOKA/Main/JWPlayerManager.swift | 25 +++-- .../Base.lproj/Main.storyboard | 35 +++++-- .../Controller/SplashVC.swift | 47 +++++++++ .../ViewModel/SplashVM.swift | 6 ++ WOKA/Shop/View/ShopListingCell.swift | 8 +- WOKA/Shop/View/ShopListingCell.xib | 26 ++--- WOKA/Shop/View/ShopProductsCell.swift | 9 +- WOKA/Shop/View/ShopProductsCell.xib | 14 +-- WOKA/Theme/Controller/PlayerVC.swift | 13 +++ WOKA/WOKAFM/Controller/WokaFMVC.swift | 4 +- WOKA/WebSeries/View/SeasonCategoryCell.xib | 6 +- 20 files changed, 317 insertions(+), 192 deletions(-) diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index f736191..4f712a3 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -112,7 +112,6 @@ 527AC6FE2C173A5100434FB7 /* SongListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 527AC6FC2C173A5100434FB7 /* SongListCell.xib */; }; 527AC7012C182DCE00434FB7 /* TimeStringToSeconds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 527AC7002C182DCE00434FB7 /* TimeStringToSeconds.swift */; }; 5282DB292C92D73B00465BA1 /* GoogleInteractiveMediaAds in Frameworks */ = {isa = PBXBuildFile; productRef = 5282DB282C92D73B00465BA1 /* GoogleInteractiveMediaAds */; }; - 5282DB2C2C9816C600465BA1 /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 5282DB2A2C9816C600465BA1 /* WOKA.xcdatamodeld */; }; 5282DB2F2C981EAD00465BA1 /* AdReusable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5282DB2E2C981EAD00465BA1 /* AdReusable.swift */; }; 528BEF602C2C372900FFDAB8 /* ContinueWatchingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 528BEF5F2C2C372900FFDAB8 /* ContinueWatchingVC.swift */; }; 528E5F1B2C24531200E33E4E /* SeasonListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 528E5F1A2C24531200E33E4E /* SeasonListingDM.swift */; }; @@ -363,6 +362,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 */; }; + 9CE306B22C9961E0008EF78B /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 9CE306B02C9961E0008EF78B /* WOKA.xcdatamodeld */; }; 9CF6980B2C89A324006007EF /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 9CF6980A2C89A324006007EF /* Lottie */; }; 9CF6980F2C8AFFBF006007EF /* SDWebImage in Frameworks */ = {isa = PBXBuildFile; productRef = 9CF6980E2C8AFFBF006007EF /* SDWebImage */; }; /* End PBXBuildFile section */ @@ -518,7 +518,6 @@ 527AC6FB2C173A5100434FB7 /* SongListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongListCell.swift; sourceTree = ""; }; 527AC6FC2C173A5100434FB7 /* SongListCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SongListCell.xib; sourceTree = ""; }; 527AC7002C182DCE00434FB7 /* TimeStringToSeconds.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeStringToSeconds.swift; sourceTree = ""; }; - 5282DB2B2C9816C600465BA1 /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; 5282DB2E2C981EAD00465BA1 /* AdReusable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdReusable.swift; sourceTree = ""; }; 528BEF5F2C2C372900FFDAB8 /* ContinueWatchingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContinueWatchingVC.swift; sourceTree = ""; }; 528E5F1A2C24531200E33E4E /* SeasonListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeasonListingDM.swift; sourceTree = ""; }; @@ -761,6 +760,7 @@ 9CDCE1412BDB94BA003FEF11 /* hi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hi; path = hi.lproj/Main.strings; sourceTree = ""; }; 9CDCE1422BDB94BD003FEF11 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; 9CDCE1442BDB9B9A003FEF11 /* OnBoardMainSound.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = OnBoardMainSound.m4a; sourceTree = ""; }; + 9CE306B12C9961E0008EF78B /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; C83A2BA3B8F575DC890CC5DD /* Pods-WOKA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WOKA.debug.xcconfig"; path = "Target Support Files/Pods-WOKA/Pods-WOKA.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -972,7 +972,7 @@ 9C535DC82C00C34000DA6DCD /* Theme */, 52DAC6462C21761700E2F85B /* WebSeries */, 9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */, - 5282DB2A2C9816C600465BA1 /* WOKA.xcdatamodeld */, + 9CE306B02C9961E0008EF78B /* WOKA.xcdatamodeld */, 52ACC1292C610EC900791528 /* PersistentStorage.swift */, ); path = WOKA; @@ -2383,7 +2383,6 @@ 52B8D4DC2C04A25E00ED65F3 /* Delegate.swift in Sources */, 52CA28FC2BE11A0400708B49 /* UserIntrestVM.swift in Sources */, 52B8D4DB2C04A25E00ED65F3 /* TransitionContext.swift in Sources */, - 5282DB2C2C9816C600465BA1 /* WOKA.xcdatamodeld in Sources */, 9C27E1602BDB6ECA00EC1DA9 /* UserDefaultsStruct.swift in Sources */, 52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */, 52D6A24C2C21B43300145908 /* WebSeriesCell.swift in Sources */, @@ -2404,6 +2403,7 @@ 9C7939172C0F23E900F5D6E6 /* LinkTypeEnum.swift in Sources */, 9CDAEB122C53F12800890C47 /* UIView.swift in Sources */, 523ED2622BDA2BC700CFED02 /* SplashVC.swift in Sources */, + 9CE306B22C9961E0008EF78B /* WOKA.xcdatamodeld in Sources */, 9CDC343C2BDBBC6B00093089 /* SelectAgeVC.swift in Sources */, 52A6DCAC2C4E5A1100F63C51 /* ShopCategoryVC.swift in Sources */, 52BBFCB22C52730C00F7D0D1 /* AddressListVC.swift in Sources */, @@ -2873,7 +2873,7 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UIStatusBarHidden = NO; - INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent; + INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UIUserInterfaceStyle = Light; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -2916,7 +2916,7 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UIStatusBarHidden = NO; - INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleLightContent; + INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UIUserInterfaceStyle = Light; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -3237,14 +3237,13 @@ /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ - 5282DB2A2C9816C600465BA1 /* WOKA.xcdatamodeld */ = { + 9CE306B02C9961E0008EF78B /* WOKA.xcdatamodeld */ = { isa = XCVersionGroup; children = ( - 5282DB2B2C9816C600465BA1 /* WOKA.xcdatamodel */, + 9CE306B12C9961E0008EF78B /* WOKA.xcdatamodel */, ); - currentVersion = 5282DB2B2C9816C600465BA1 /* WOKA.xcdatamodel */; - name = WOKA.xcdatamodeld; - path = /Users/macbookpro/Desktop/WOKA/WOKA/WOKA.xcdatamodeld; + currentVersion = 9CE306B12C9961E0008EF78B /* WOKA.xcdatamodel */; + path = WOKA.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; diff --git a/WOKA/Cart/CartDataCache.swift b/WOKA/Cart/CartDataCache.swift index 7759822..531b3a6 100644 --- a/WOKA/Cart/CartDataCache.swift +++ b/WOKA/Cart/CartDataCache.swift @@ -99,6 +99,8 @@ class BadgeBarBtn { badgeLabel.font = FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 10) badgeLabel.textAlignment = .center badgeLabel.text = text + + button.addShadowAndCorner(radius: button.frame.width / 2, shadowColor: .darkGray, shadowOpacity: 0.5, shadowOffset: CGSize(width: 0, height: 0.8), shadowRadius: 6) // Add the badge label to the button if not already added if badgeLabel.superview != button { diff --git a/WOKA/Constants K/GVar.swift b/WOKA/Constants K/GVar.swift index 1c9d2e7..0e1cbf4 100644 --- a/WOKA/Constants K/GVar.swift +++ b/WOKA/Constants K/GVar.swift @@ -35,5 +35,11 @@ extension K{ Username selected from forgot username shall be stored here */ static var selectedUsername : String? = nil + + /* + this will handle ad timing for games + */ + static var adTimeStamp : Date? = nil + } } diff --git a/WOKA/Constants K/GoogleAdIDs.swift b/WOKA/Constants K/GoogleAdIDs.swift index a1aa9fd..e5bab59 100644 --- a/WOKA/Constants K/GoogleAdIDs.swift +++ b/WOKA/Constants K/GoogleAdIDs.swift @@ -15,8 +15,14 @@ extension K{ static let karaoke = "ca-app-pub-3940256099942544/2934735716" static let audioBooks = "ca-app-pub-3940256099942544/2934735716" + + static let games = "ca-app-pub-3940256099942544/2934735716" + static let gamesDetailsInterStial = "ca-app-pub-5699008063638916/8126400123" // static let themeTwo = "ca-app-pub-3940256099942544/2934735716" static let themeTwo = "ca-app-pub-5699008063638916/1393141241" + + static let splashBanner1 = "ca-app-pub-5699008063638916/1393141241" + static let splashBanner2 = "ca-app-pub-5699008063638916/1393141241" } } diff --git a/WOKA/Games/Controller/GamesDetailVC.swift b/WOKA/Games/Controller/GamesDetailVC.swift index d3f8144..0fe9f5c 100644 --- a/WOKA/Games/Controller/GamesDetailVC.swift +++ b/WOKA/Games/Controller/GamesDetailVC.swift @@ -6,6 +6,8 @@ // import UIKit +import GoogleMobileAds +import Alamofire class GamesDetailVC: UIViewController { @@ -35,11 +37,16 @@ class GamesDetailVC: UIViewController { var btnTapped : btnTappedBlock? var reloadType : FavCellCLick? + private var interstitial: GADInterstitialAd? + private var rewardedAd: GADRewardedAd? + + let reachability = NetworkReachabilityManager() + override func viewDidLoad() { super.viewDidLoad() initView() tapHandler() - + setupAds() } @objc func handleTap(_ gesture: UITapGestureRecognizer) { @@ -225,6 +232,70 @@ class GamesDetailVC: UIViewController { PersistentStorage.shared.addGamesCount(postID: postID) } + /* + check ad timestamp from gvar + show ads if the saved timestamp time and current time has diffrenece of 30 minutes + */ + if let timeStamp = K.GVar.adTimeStamp{ + /* + check if timestamp difference is equal and greater than 30 minutes i.e 1800 seconds + */ + let duration = DateFormatterLib.dateDifferenceINT(date1: timeStamp, date2: Date()) + print(duration) + + if duration <= 1800{ + // dont show ads navigate to webview + navigateToGamesWebView() + }else{ + //show ads & reset timestamp to current time + K.GVar.adTimeStamp = Date() + + guard let interstitial = interstitial else { + // if ad doesnt loads make sure to make adtimestamp nil, and let user navigate to games + K.GVar.adTimeStamp = nil + navigateToGamesWebView() + return print("Ad wasn't ready.") + } + + // The UIViewController parameter is an optional. + interstitial.present(fromRootViewController: nil) + } + }else{ + /* assing date if it is nil and play the ad. + also it means its the first time show the interstial ad. + */ + K.GVar.adTimeStamp = Date() + + guard let interstitial = interstitial else { + // if ad doesnt loads make sure to make adtimestamp nil, and let user navigate to games + K.GVar.adTimeStamp = nil + navigateToGamesWebView() + return print("Ad wasn't ready.") + } + + // The UIViewController parameter is an optional. + interstitial.present(fromRootViewController: nil) + return + } + + } + + private func setupAds(){ + Task { + do { + interstitial = try await GADInterstitialAd.load( + withAdUnitID: K.GoogleAdIDs.gamesDetailsInterStial, request: GADRequest()) + interstitial?.fullScreenContentDelegate = self + } catch { + if reachability?.isReachable == true{ + setupAds() + } + print("Failed to load interstitial ad with error: \(error.localizedDescription)") + } + } + } + + private func navigateToGamesWebView(){ let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesWebViewVC) as! GamesWebViewVC vcPush.url = self.gameData?.gameURL @@ -247,3 +318,23 @@ class GamesDetailVC: UIViewController { self.dismiss(animated: true) } } + +extension GamesDetailVC : 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.") + self.navigateToGamesWebView() + //setup ads again and wait for the timestamp 30 minutes + self.setupAds() + } +} diff --git a/WOKA/Games/Controller/GamesListVC.swift b/WOKA/Games/Controller/GamesListVC.swift index ae0baad..3523521 100644 --- a/WOKA/Games/Controller/GamesListVC.swift +++ b/WOKA/Games/Controller/GamesListVC.swift @@ -6,7 +6,6 @@ // import UIKit -import GoogleMobileAds class GamesListVC: UIViewController { @@ -26,10 +25,7 @@ class GamesListVC: UIViewController { @IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView! var vm = GamesListVM() - - private var interstitial: GADInterstitialAd? - private var rewardedAd: GADRewardedAd? - + override func viewDidLoad() { super.viewDidLoad() vm.vc = self @@ -39,19 +35,7 @@ class GamesListVC: UIViewController { navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() - Task { - do { - interstitial = try await GADInterstitialAd.load( - withAdUnitID: "ca-app-pub-5699008063638916/8126400123", 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) { @@ -189,40 +173,7 @@ extension GamesListVC : TableViewSRC{ 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 - } - - if data.title == "WOKA Carrom"{ - guard let interstitial = interstitial else { - return print("Ad wasn't ready.") - } - - // The UIViewController parameter is an optional. - interstitial.present(fromRootViewController: nil) - return - } - + let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil) let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesDetailVC) as! GamesDetailVC @@ -296,45 +247,3 @@ 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[vm.indexToLoad] - - 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 = vm.indexToLoad - 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/Games/Controller/GamesWebViewVC.swift b/WOKA/Games/Controller/GamesWebViewVC.swift index be3dd0c..25c125b 100644 --- a/WOKA/Games/Controller/GamesWebViewVC.swift +++ b/WOKA/Games/Controller/GamesWebViewVC.swift @@ -42,19 +42,19 @@ class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizer override func viewDidLoad() { super.viewDidLoad() - - DispatchQueue.main.async { [weak self] in - guard let self else{return} - AdReusable.sharedInstance.setupBannerAd(bannerView: self.bottomBannerView, in: adView, adUnitID: K.GoogleAdIDs.themeTwo, viewController: self) - - if let orientation, orientation == .landscape{ + + + + if let orientation, orientation == .landscape{ + DispatchQueue.main.async { [weak self] in + guard let self else{return} appDelegate.deviceOrientation = .landscapeRight let value = UIInterfaceOrientation.landscapeRight.rawValue UIDevice.current.setValue(value, forKey: "orientation") - // rotateToLandsScapeDevice() } + }else{ + showAds() } - guard let url else{return} @@ -125,6 +125,15 @@ class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizer self.present(vcPush, animated: true) } + // MARK: - SetupAds + + private func showAds(){ + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {[weak self] in + guard let self else{return} + AdReusable.sharedInstance.setupBannerAd(bannerView: self.bottomBannerView, in: adView, adUnitID: K.GoogleAdIDs.themeTwo, viewController: self) + }) + } + // MARK: - App LifeCycle HAndler @@ -174,11 +183,12 @@ extension GamesWebViewVC : GADBannerViewDelegate{ func bannerViewDidReceiveAd(_ bannerView: GADBannerView) { print("bannerViewDidReceiveAd") + self.adView.isHidden = false bannerView.alpha = 0 bannerView.backgroundColor = #colorLiteral(red: 0.01960784314, green: 0, blue: 0.2196078431, alpha: 1) - UIView.animate(withDuration: 1, animations: { + UIView.animate(withDuration: 0.3, animations: { bannerView.alpha = 1 - }) + }) } func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) { diff --git a/WOKA/Games/Games.storyboard b/WOKA/Games/Games.storyboard index 562b85c..83fb2a7 100644 --- a/WOKA/Games/Games.storyboard +++ b/WOKA/Games/Games.storyboard @@ -1,9 +1,9 @@ - + - + @@ -584,32 +584,36 @@ - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/OnBoarding Module/Controller/SplashVC.swift b/WOKA/OnBoarding Module/Controller/SplashVC.swift index 9f0d0f2..7e95ad9 100644 --- a/WOKA/OnBoarding Module/Controller/SplashVC.swift +++ b/WOKA/OnBoarding Module/Controller/SplashVC.swift @@ -8,6 +8,7 @@ import UIKit import Lottie import OneSignalFramework +import GoogleMobileAds class SplashVC: UIViewController { @@ -20,12 +21,25 @@ class SplashVC: UIViewController { @IBOutlet weak var retryBtn: UIButton! @IBOutlet weak var activityIndicator: UIActivityIndicatorView! + @IBOutlet weak var adBanner1: UIView! + @IBOutlet weak var adBanner2: UIView! + var vm = SplashVM() // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() + /* + Show google ads with dispatch queue. + */ + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: { [weak self] in + guard let self else{return} + AdReusable.sharedInstance.setupBannerAd(bannerView: vm.banner1, in: adBanner1, adUnitID: K.GoogleAdIDs.splashBanner1, viewController: self) + AdReusable.sharedInstance.setupBannerAd(bannerView: vm.banner2, in: adBanner2, adUnitID: K.GoogleAdIDs.splashBanner2, viewController: self) + }) + + vm.vc = self vm.playSplashSound() animateImageScale() @@ -141,4 +155,37 @@ class SplashVC: UIViewController { } +// MARK: - Google Ad Banner Delegate + +extension SplashVC : GADBannerViewDelegate{ + func bannerViewDidReceiveAd(_ bannerView: GADBannerView) { + print("bannerViewDidReceiveAd") + bannerView.alpha = 0 + bannerView.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) + UIView.animate(withDuration: 0.5, animations: { + bannerView.alpha = 1 + }) + } + + func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) { + print("bannerView:didFailToReceiveAdWithError: \(error.localizedDescription)") + } + + func bannerViewDidRecordImpression(_ bannerView: GADBannerView) { + print("bannerViewDidRecordImpression") + } + + func bannerViewWillPresentScreen(_ bannerView: GADBannerView) { + print("bannerViewWillPresentScreen") + } + + func bannerViewWillDismissScreen(_ bannerView: GADBannerView) { + print("bannerViewWillDIsmissScreen") + } + + func bannerViewDidDismissScreen(_ bannerView: GADBannerView) { + print("bannerViewDidDismissScreen") + } +} + diff --git a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift index 99d720e..d657647 100644 --- a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift +++ b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift @@ -9,13 +9,19 @@ import UIKit import AVFoundation import Alamofire import FirebaseAnalytics +import GoogleMobileAds class SplashVM{ weak var vc : SplashVC! var player: AVAudioPlayer? + var banner1 = GADBannerView() + var banner2 = GADBannerView() + + func initView(){ + if AuthFunc.shareInstance.staticURLs == nil{ AuthFunc.shareInstance.getStaticURLs() } diff --git a/WOKA/Shop/View/ShopListingCell.swift b/WOKA/Shop/View/ShopListingCell.swift index 332f9f5..18a45cf 100644 --- a/WOKA/Shop/View/ShopListingCell.swift +++ b/WOKA/Shop/View/ShopListingCell.swift @@ -15,10 +15,16 @@ class ShopListingCell: UITableViewCell { @IBOutlet weak var imageHeight: NSLayoutConstraint! + override func prepareForReuse() { + super.prepareForReuse() + // Reset or reapply shadow only if needed + shimmerEffectView.layer.shadowPath = nil + } + override func awakeFromNib() { super.awakeFromNib() self.backgroundColor = .clear - // Initialization code + shimmerEffectView.addShadowAndCorner(radius: 8, shadowColor: .darkGray, shadowOpacity: 0.6, shadowOffset: CGSize(width: 0, height: 0.5), shadowRadius: 5) } func showShimmer(){ diff --git a/WOKA/Shop/View/ShopListingCell.xib b/WOKA/Shop/View/ShopListingCell.xib index 3079b9b..70dc741 100644 --- a/WOKA/Shop/View/ShopListingCell.xib +++ b/WOKA/Shop/View/ShopListingCell.xib @@ -1,9 +1,9 @@ - + - + @@ -20,7 +20,7 @@ - + @@ -28,10 +28,10 @@ - + - + @@ -43,7 +43,7 @@ - + - - - - - + + + + - - - - - diff --git a/WOKA/Shop/View/ShopProductsCell.swift b/WOKA/Shop/View/ShopProductsCell.swift index 83baded..4b0a80b 100644 --- a/WOKA/Shop/View/ShopProductsCell.swift +++ b/WOKA/Shop/View/ShopProductsCell.swift @@ -12,12 +12,19 @@ class ShopProductsCell: UICollectionViewCell { @IBOutlet weak var productImage: UIImageView! @IBOutlet weak var productTitle: UILabel! @IBOutlet weak var productPrice: UILabel! + @IBOutlet weak var outerView: UIView! + + override func prepareForReuse() { + super.prepareForReuse() + // Reset or reapply shadow only if needed + outerView.layer.shadowPath = nil + } override func awakeFromNib() { super.awakeFromNib() productTitle.font = FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 13) productPrice.font = FontCustom.shareInstance.customFont(fontName: .Exo2_Regular, size: 13) - // Initialization code + outerView.addShadowAndCorner(radius: 6, shadowColor: .darkGray, shadowOpacity: 0.5, shadowOffset: CGSize(width: 0, height: 0.3), shadowRadius: 3) } func setData(data : ShopProductsListingDM.ResultData){ diff --git a/WOKA/Shop/View/ShopProductsCell.xib b/WOKA/Shop/View/ShopProductsCell.xib index 13e7889..b498b18 100644 --- a/WOKA/Shop/View/ShopProductsCell.xib +++ b/WOKA/Shop/View/ShopProductsCell.xib @@ -1,9 +1,9 @@ - + - + @@ -17,14 +17,14 @@ - + - + @@ -72,11 +72,6 @@ sadasdasdasdsad - - - - - @@ -89,6 +84,7 @@ sadasdasdasdsad + diff --git a/WOKA/Theme/Controller/PlayerVC.swift b/WOKA/Theme/Controller/PlayerVC.swift index 5b399d5..5986f93 100644 --- a/WOKA/Theme/Controller/PlayerVC.swift +++ b/WOKA/Theme/Controller/PlayerVC.swift @@ -59,6 +59,19 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate { self.view.bringSubviewToFront(backButton) NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil) + + // let skinStylingBuilder = JWPlayerSkinBuilder() + // .buttonsColor(.blue) + // .backgroundColor(.cyan) + // + // let skinStyling = try? skinStylingBuilder.build() + // self.styling = skinStyling + + self.setVisibility(.hidden, for: [.fullscreenButton]) + self.setVisibility(.hidden, for: [.settingsButton]) + self.setVisibility(.hidden, for: [.pictureInPictureButton]) + self.setVisibility(.hidden, for: [.languagesButton]) + } override func viewDidAppear(_ animated: Bool) { diff --git a/WOKA/WOKAFM/Controller/WokaFMVC.swift b/WOKA/WOKAFM/Controller/WokaFMVC.swift index fde1b13..f0f9add 100644 --- a/WOKA/WOKAFM/Controller/WokaFMVC.swift +++ b/WOKA/WOKAFM/Controller/WokaFMVC.swift @@ -227,9 +227,9 @@ extension WokaFMVC : GADBannerViewDelegate{ print("bannerViewDidReceiveAd") bannerView.alpha = 0 bannerView.backgroundColor = #colorLiteral(red: 0.01960784314, green: 0, blue: 0.2196078431, alpha: 1) - UIView.animate(withDuration: 1, animations: { + UIView.animate(withDuration: 0.3, animations: { bannerView.alpha = 1 - }) + }) } func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) { diff --git a/WOKA/WebSeries/View/SeasonCategoryCell.xib b/WOKA/WebSeries/View/SeasonCategoryCell.xib index 4dfe05d..77c341f 100644 --- a/WOKA/WebSeries/View/SeasonCategoryCell.xib +++ b/WOKA/WebSeries/View/SeasonCategoryCell.xib @@ -1,9 +1,9 @@ - + - + @@ -15,7 +15,7 @@ - +