- Added click for header image webseries.

- Handled scroll for webseries, if its fetching stopped scrolling
This commit is contained in:
2024-09-10 11:55:23 +05:30
parent a810cfb511
commit 44d6ef4b85
9 changed files with 109 additions and 23 deletions

View File

@@ -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 = "<group>"; };
52F477A42C492ED900F79200 /* JWPlayerKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = JWPlayerKit.xcframework; path = Pods/JWPlayerKit/JWPlayerKit.xcframework; sourceTree = "<group>"; };
52F4E8652C3D123B00778FBC /* JWKaraokePlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JWKaraokePlayerVC.swift; sourceTree = "<group>"; };
52F77E602C8EE4440043161F /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = "<group>"; };
52F77E622C8EF3CC0043161F /* GoogleAdIDs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleAdIDs.swift; sourceTree = "<group>"; };
52FB2D8E2BDF898F0009B0C7 /* TextFieldPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldPadding.swift; sourceTree = "<group>"; };
52FDBA772BFF23F4009D7AC7 /* TimePeriod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriod.swift; sourceTree = "<group>"; };
52FDBA7A2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthFuncTimeHandling.swift; sourceTree = "<group>"; };
@@ -724,7 +727,6 @@
9CB3D08E2C37D0D60062869D /* KaraokeListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KaraokeListingDM.swift; sourceTree = "<group>"; };
9CB3D0902C37D6930062869D /* KaraokeDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KaraokeDetailsVC.swift; sourceTree = "<group>"; };
9CB4C5A82C118EF300737C00 /* NavBarColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavBarColor.swift; sourceTree = "<group>"; };
9CBA53082C8996F50046735C /* WOKA.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = WOKA.xcdatamodel; sourceTree = "<group>"; };
9CBCB29A2BE4D614007D7934 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = "<group>"; };
9CBCB29C2BE4D6BB007D7934 /* LoginVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVM.swift; sourceTree = "<group>"; };
9CBCB29E2BE4E13A007D7934 /* ValidatorClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidatorClass.swift; sourceTree = "<group>"; };
@@ -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 = "<group>";
@@ -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 = "<group>";
versionGroupType = wrapper.xcdatamodel;
};

View File

@@ -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

View File

@@ -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"
}
}

View File

@@ -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){

View File

@@ -87,6 +87,7 @@
<connections>
<outlet property="cellImage" destination="WaI-mH-feh" id="8qs-st-jVc"/>
<outlet property="cellTitle" destination="OAi-7e-Ifq" id="LhX-KE-jZc"/>
<outlet property="imageHeight" destination="MAu-oG-jtt" id="WYk-bR-4ac"/>
<outlet property="shimmerEffectView" destination="fIB-0u-s5x" id="wYP-ox-Pt8"/>
</connections>
<point key="canvasLocation" x="184.73282442748092" y="58.098591549295776"/>

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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
}

View File

@@ -98,7 +98,7 @@
<constraint firstItem="tRo-aT-Zuf" firstAttribute="leading" secondItem="Cog-DZ-ib0" secondAttribute="leading" id="icB-N3-EK6"/>
</constraints>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rom-H6-7RC">
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rom-H6-7RC">
<rect key="frame" x="0.0" y="116" width="430" height="517"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="c6v-VU-iKP">
@@ -476,7 +476,7 @@
<rect key="frame" x="377.66666666666669" y="0.0" width="32.333333333333314" height="49"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hand.thumbsup.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="eng-oC-d9H">
<rect key="frame" x="0.0" y="0.66666666666666785" width="20" height="47.666666666666671"/>
<rect key="frame" x="0.0" y="0.66666666666666785" width="20" height="47.666666666666657"/>
<color key="tintColor" red="0.035294117649999998" green="0.0" blue="0.36470588240000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Egv-Cu-aPK">