diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index da67b98..254618b 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -253,6 +253,8 @@ 52DAC64E2C21775300E2F85B /* WebSeriesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52DAC64D2C21775300E2F85B /* WebSeriesVC.swift */; }; 52E214C72C2AD47F00BC2D29 /* EpisodeDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52E214C62C2AD47F00BC2D29 /* EpisodeDetailsVC.swift */; }; 52F4E8662C3D123B00778FBC /* JWKaraokePlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52F4E8652C3D123B00778FBC /* JWKaraokePlayerVC.swift */; }; + 52F77E612C8EE4440043161F /* WOKA.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 52F77E5F2C8EE4440043161F /* WOKA.xcdatamodeld */; }; + 52F77E632C8EF3CC0043161F /* GoogleAdIDs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52F77E622C8EF3CC0043161F /* GoogleAdIDs.swift */; }; 52FB2D8F2BDF898F0009B0C7 /* TextFieldPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */; }; 52FDBA782BFF23F4009D7AC7 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */; }; 52FDBA7B2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FDBA7A2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift */; }; @@ -328,7 +330,6 @@ 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 */; }; @@ -660,6 +661,8 @@ 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 = ""; }; 52F4E8652C3D123B00778FBC /* JWKaraokePlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JWKaraokePlayerVC.swift; sourceTree = ""; }; + 52F77E602C8EE4440043161F /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = ""; }; + 52F77E622C8EF3CC0043161F /* GoogleAdIDs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleAdIDs.swift; sourceTree = ""; }; 52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldPadding.swift; sourceTree = ""; }; 52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriod.swift; sourceTree = ""; }; 52FDBA7A2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthFuncTimeHandling.swift; sourceTree = ""; }; @@ -724,7 +727,6 @@ 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 = ""; }; @@ -966,7 +968,7 @@ 9C535DC82C00C34000DA6DCD /* Theme */, 52DAC6462C21761700E2F85B /* WebSeries */, 9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */, - 9CBA53072C8996F50046735C /* WOKA.xcdatamodeld */, + 52F77E5F2C8EE4440043161F /* WOKA.xcdatamodeld */, 52ACC1292C610EC900791528 /* PersistentStorage.swift */, ); path = WOKA; @@ -1551,6 +1553,7 @@ 9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */, 9C3E14462C517E8F00D06C10 /* TopViewEnum.swift */, 527A2BCB2C577F8A0080DF9B /* AnalyticsEventKeys.swift */, + 52F77E622C8EF3CC0043161F /* GoogleAdIDs.swift */, ); path = "Constants K"; sourceTree = ""; @@ -2463,6 +2466,7 @@ 52CA28FA2BE119F500708B49 /* UserIntrestVC.swift in Sources */, 9CBE1B442C0F37B300CA6E61 /* DropDown+Appearance.swift in Sources */, 9C27E16B2BDB774D00EC1DA9 /* CarouselData.swift in Sources */, + 52F77E632C8EF3CC0043161F /* GoogleAdIDs.swift in Sources */, 525954212BE8EB7900191286 /* APIEndPoints.swift in Sources */, 9CDAEB072C53E42900890C47 /* ProductDetailsVM.swift in Sources */, 5259545A2BEB67D200191286 /* DateFormatterLib.swift in Sources */, @@ -2488,7 +2492,7 @@ 525954292BEA079500191286 /* UserEmailVerifyDM.swift in Sources */, 52ACC1352C64C89900791528 /* MyOrderDetailsVC.swift in Sources */, 522D655E2C1ACCF40021E505 /* UserNotificationDM.swift in Sources */, - 9CBA53092C8996F50046735C /* WOKA.xcdatamodeld in Sources */, + 52F77E612C8EE4440043161F /* WOKA.xcdatamodeld in Sources */, 52ACC13A2C64CD0100791528 /* MyOrderDetailsCell.swift in Sources */, 9C1C69FC2C106C240035B2C7 /* ContactSupportVM.swift in Sources */, 52AF71F22C36B77B00BC5972 /* GamesDetailVC.swift in Sources */, @@ -3198,14 +3202,14 @@ /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ - 9CBA53072C8996F50046735C /* WOKA.xcdatamodeld */ = { + 52F77E5F2C8EE4440043161F /* WOKA.xcdatamodeld */ = { isa = XCVersionGroup; children = ( - 9CBA53082C8996F50046735C /* WOKA.xcdatamodel */, + 52F77E602C8EE4440043161F /* WOKA.xcdatamodel */, ); - currentVersion = 9CBA53082C8996F50046735C /* WOKA.xcdatamodel */; + currentVersion = 52F77E602C8EE4440043161F /* WOKA.xcdatamodel */; name = WOKA.xcdatamodeld; - path = /Users/bilal/Desktop/woka_native_ios_swift/WOKA/WOKA.xcdatamodeld; + path = /Users/macbookpro/Desktop/WOKA/WOKA/WOKA.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; diff --git a/WOKA/Constants K/GVar.swift b/WOKA/Constants K/GVar.swift index 95eb143..1c9d2e7 100644 --- a/WOKA/Constants K/GVar.swift +++ b/WOKA/Constants K/GVar.swift @@ -11,6 +11,8 @@ extension K{ struct GVar{ // static var localized = K.LocalizedEnum.english + static var lastOpenTimestamp : Date? + static var reloadMyList = false static var topView = TopViewEnum.theme1 diff --git a/WOKA/Constants K/GoogleAdIDs.swift b/WOKA/Constants K/GoogleAdIDs.swift new file mode 100644 index 0000000..d2cb644 --- /dev/null +++ b/WOKA/Constants K/GoogleAdIDs.swift @@ -0,0 +1,18 @@ +// +// GoogleAdIDs.swift +// WOKA +// +// Created by MacBook Pro on 09/09/24. +// + +import Foundation + +extension K{ + struct GoogleAdIDs{ + static let webSeries = "ca-app-pub-3940256099942544/2934735716" + 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 themeTwo = "ca-app-pub-3940256099942544/2934735716" + } +} diff --git a/WOKA/Shop/View/ShopListingCell.swift b/WOKA/Shop/View/ShopListingCell.swift index 0fbe2ba..332f9f5 100644 --- a/WOKA/Shop/View/ShopListingCell.swift +++ b/WOKA/Shop/View/ShopListingCell.swift @@ -13,6 +13,8 @@ class ShopListingCell: UITableViewCell { @IBOutlet weak var cellTitle: UILabel! @IBOutlet weak var shimmerEffectView: ShimmerEffectView! + @IBOutlet weak var imageHeight: NSLayoutConstraint! + override func awakeFromNib() { super.awakeFromNib() self.backgroundColor = .clear @@ -35,10 +37,20 @@ class ShopListingCell: UITableViewCell { } func setData(data : ShopSuperCategoryDM.ResultData){ + + if data.isAD == true{ + self.cellImage.contentMode = .scaleAspectFit + self.imageHeight.constant = self.cellImage.frame.width * 0.55 + }else{ + self.imageHeight.constant = 180 + self.cellImage.contentMode = .scaleAspectFill + } + if let url = data.superCategoryThumbnail{ self.cellImage.imageURL(url, color: .black) } self.cellTitle.text = data.superCategoryName + self.layoutIfNeeded() } func setCategoryData(data : ShopCategoryDM.ResultData){ diff --git a/WOKA/Shop/View/ShopListingCell.xib b/WOKA/Shop/View/ShopListingCell.xib index e632a83..3079b9b 100644 --- a/WOKA/Shop/View/ShopListingCell.xib +++ b/WOKA/Shop/View/ShopListingCell.xib @@ -87,6 +87,7 @@ + diff --git a/WOKA/Theme/Controller/ThemeTwoVC.swift b/WOKA/Theme/Controller/ThemeTwoVC.swift index dd0a585..44dceee 100644 --- a/WOKA/Theme/Controller/ThemeTwoVC.swift +++ b/WOKA/Theme/Controller/ThemeTwoVC.swift @@ -24,7 +24,6 @@ class ThemeTwoVC: UIViewController{ var vm = ThemeTwoVM() - deinit{ NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeTwoPush), object: nil) @@ -57,14 +56,12 @@ class ThemeTwoVC: UIViewController{ MyListDataTemp.shareInstance.favListingData = FavouriteListingDM.ResultData(totalRecords: nil, showData: FavouriteListingDM.ResultData.ShowData(hindi: [],english: []),videoData: [],gameData: [],singKaraokeData: [],audioData: []) } - /* This is test ad. */ - testAdView.adUnitID = "ca-app-pub-3940256099942544/2934735716" + testAdView.adUnitID = K.GoogleAdIDs.themeTwo testAdView.rootViewController = self testAdView.load(GADRequest()) - } override func viewWillAppear(_ animated: Bool) { diff --git a/WOKA/WebSeries/Controller/WebSeriesVC.swift b/WOKA/WebSeries/Controller/WebSeriesVC.swift index e68deee..96e6c1b 100644 --- a/WOKA/WebSeries/Controller/WebSeriesVC.swift +++ b/WOKA/WebSeries/Controller/WebSeriesVC.swift @@ -111,9 +111,9 @@ class WebSeriesVC: UIViewController { @IBAction func playTrailer(_ sender: LocalisedElementsButton) { //If its ads then nav user to webview - if let adsData = AuthFunc.shareInstance.adsData{ + if let adsData = AuthFunc.shareInstance.adsData, let webSeriesAd = adsData.result?.filter({$0.forPage == AdsEnum.web_series.rawValue}).first{ // check if ads data contains ad for webseries - if let webSeriesAd = adsData.result?.filter({$0.forPage == AdsEnum.web_series.rawValue}).first, let adLink = webSeriesAd.adLink,let adID = webSeriesAd.id{ + if let adLink = webSeriesAd.adLink,let adID = webSeriesAd.id{ PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1) if let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) diff --git a/WOKA/WebSeries/ViewModel/WebSeriesVM.swift b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift index 75c98f7..15860f2 100644 --- a/WOKA/WebSeries/ViewModel/WebSeriesVM.swift +++ b/WOKA/WebSeries/ViewModel/WebSeriesVM.swift @@ -7,6 +7,7 @@ import Foundation import Alamofire +import GoogleMobileAds class WebSeriesVM{ @@ -66,22 +67,73 @@ class WebSeriesVM{ } checkAds() - } - - func checkAds(){ + /* MAke logic for ads */ - if let adsData = AuthFunc.shareInstance.adsData{ +// if let adsData = AuthFunc.shareInstance.adsData{ +// // check if ads data contains ad for webseries +// if let webSeriesAd = adsData.result?.filter({$0.forPage == AdsEnum.web_series.rawValue}).first{ +// vc.headerViewImage.addTapGesture { +// if let adID = webSeriesAd.id{ +// PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1) +// } +// if let adLink = webSeriesAd.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) { +// UIApplication.shared.open(url) +// } +// } +// } +// } + } + + func checkAds(){ + + /* + This is test ad. + */ + + /* + MAke logic for ads + */ + if let adsData = AuthFunc.shareInstance.adsData, let webSeriesAd = adsData.result?.filter({$0.forPage == AdsEnum.web_series.rawValue}).first{ // check if ads data contains ad for webseries - if let webSeriesAd = adsData.result?.filter({$0.forPage == AdsEnum.web_series.rawValue}).first, let bannerImage = webSeriesAd.bannerImage, let buttonImage = webSeriesAd.buttonImage{ + if let bannerImage = webSeriesAd.bannerImage, let buttonImage = webSeriesAd.buttonImage{ vc.headerViewImage.imageURL(bannerImage, color: .white) vc.headerBtn.setTitle("", for: .normal) vc.headerViewLabel.text = "" vc.headerViewLabelHeight.constant = 10 vc.headerBtn.backgroundColor = .clear vc.headerBtn.sd_setBackgroundImage(with: URL(string:buttonImage), for: .normal) + + vc.headerViewImage.addTapGesture { + if let adID = webSeriesAd.id{ + PersistentStorage.shared.addAdsCount(adID: adID ,clicks: 1) + } + if let adLink = webSeriesAd.adLink ,let url = URL(string: adLink), UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url) + } + } } + }else{ + var bannerView = GADBannerView() + + let viewWidth = vc.headerView.frame.inset(by: vc.headerView.safeAreaInsets).width + + // Here the current interface orientation is used. Use + // GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth or + // GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth if you prefer to load an ad of a + // particular orientation, + let adaptiveSize = GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth) + bannerView = GADBannerView(adSize: adaptiveSize) + + bannerView.center = vc.headerView.center + + // bannerView.frame = CGRect(x: 0, y: 0, width: vc.headerView.frame.width, height: vc.headerView.frame.height) + vc.headerView.addSubview(bannerView) + + bannerView.adUnitID = K.GoogleAdIDs.themeTwo + bannerView.rootViewController = self.vc + bannerView.load(GADRequest()) } } @@ -230,13 +282,12 @@ class WebSeriesVM{ } self.stopShimmer() - + self.vc.scrollView.isScrollEnabled = true self.vc.showListingTableView.reloadData() self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height + 100 self.vc.showListingTableView.layoutIfNeeded() self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height - self.vc.loadMoreActivityIndicator.stopAnimating() self.vc.loadMoreActivityIndicator.hidesWhenStopped = true @@ -245,6 +296,7 @@ class WebSeriesVM{ }else{ self.vc.loadMoreBtn.isHidden = false } + default: break } diff --git a/WOKA/WebSeries/WebSeries.storyboard b/WOKA/WebSeries/WebSeries.storyboard index a734454..148e388 100644 --- a/WOKA/WebSeries/WebSeries.storyboard +++ b/WOKA/WebSeries/WebSeries.storyboard @@ -98,7 +98,7 @@ - + @@ -476,7 +476,7 @@ - +