- updated google analytics key.
- added a check for live tv player, checking if its not playing for a long time. - fixed the apiversion check on splash - Fixed the guest user issue, if no internet connect and app is started. - fixed woka fm issue for google and normal ads.
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
5255C3FF2C5B67E70030BB22 /* WokaFMVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5255C3FE2C5B67E70030BB22 /* WokaFMVC.swift */; };
|
||||
5257B2652BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5257B2642BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift */; };
|
||||
5258464F2C491829004F074B /* connectedness.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5258464E2C491829004F074B /* connectedness.swift */; };
|
||||
525855152CBCECC300E6002A /* JWPlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 525855142CBCECC300E6002A /* JWPlayerKit */; };
|
||||
525855172CBD3C7100E6002A /* PlayerStatusEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525855162CBD3C6C00E6002A /* PlayerStatusEnum.swift */; };
|
||||
525861D02C4F9E3200C33C79 /* SwipeTableViewFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525861CF2C4F9E3200C33C79 /* SwipeTableViewFont.swift */; };
|
||||
525861D22C4FC6C000C33C79 /* CartPaymentOptionsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525861D12C4FC6C000C33C79 /* CartPaymentOptionsVC.swift */; };
|
||||
525861D42C4FCCB500C33C79 /* CartPaymentOptionsVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525861D32C4FCCB500C33C79 /* CartPaymentOptionsVM.swift */; };
|
||||
@@ -92,7 +94,6 @@
|
||||
52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF62BDFACF60001D8CE /* ShadowView.swift */; };
|
||||
52663FF92BDFAF110001D8CE /* EmailVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF82BDFAF110001D8CE /* EmailVM.swift */; };
|
||||
52663FFB2BDFB1700001D8CE /* TextFieldShadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FFA2BDFB1700001D8CE /* TextFieldShadow.swift */; };
|
||||
5267659B2C9C5F8900CF2271 /* JWPlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 5267659A2C9C5F8900CF2271 /* JWPlayerKit */; };
|
||||
526A436F2C36A97400AE148F /* Games.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 526A436E2C36A97400AE148F /* Games.storyboard */; };
|
||||
526A43752C36AA4A00AE148F /* GamesListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A43742C36AA4A00AE148F /* GamesListVC.swift */; };
|
||||
5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */; };
|
||||
@@ -467,6 +468,7 @@
|
||||
5257B2642BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckPhoneHomeBtnOrNotch.swift; sourceTree = "<group>"; };
|
||||
5258464E2C491829004F074B /* connectedness.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = connectedness.swift; sourceTree = "<group>"; };
|
||||
525846502C491A9E004F074B /* speedchecker-sdk-ios-master */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "speedchecker-sdk-ios-master"; path = "../../Downloads/speedchecker-sdk-ios-master"; sourceTree = "<group>"; };
|
||||
525855162CBD3C6C00E6002A /* PlayerStatusEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerStatusEnum.swift; sourceTree = "<group>"; };
|
||||
525861CF2C4F9E3200C33C79 /* SwipeTableViewFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeTableViewFont.swift; sourceTree = "<group>"; };
|
||||
525861D12C4FC6C000C33C79 /* CartPaymentOptionsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartPaymentOptionsVC.swift; sourceTree = "<group>"; };
|
||||
525861D32C4FCCB500C33C79 /* CartPaymentOptionsVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartPaymentOptionsVM.swift; sourceTree = "<group>"; };
|
||||
@@ -784,7 +786,7 @@
|
||||
4469E533EC95AC428FE50FB2 /* Pods_WOKA.framework in Frameworks */,
|
||||
52C83E3F2C493FD700F27563 /* RSKPlaceholderTextView in Frameworks */,
|
||||
9CF6980B2C89A324006007EF /* Lottie in Frameworks */,
|
||||
5267659B2C9C5F8900CF2271 /* JWPlayerKit in Frameworks */,
|
||||
525855152CBCECC300E6002A /* JWPlayerKit in Frameworks */,
|
||||
9CBA530C2C89A2680046735C /* FirebaseAnalytics in Frameworks */,
|
||||
9CF6980F2C8AFFBF006007EF /* SDWebImage in Frameworks */,
|
||||
9CBA530E2C89A2680046735C /* FirebaseCrashlytics in Frameworks */,
|
||||
@@ -1525,6 +1527,7 @@
|
||||
52C8B0512BDA4B51003B51D0 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
525855162CBD3C6C00E6002A /* PlayerStatusEnum.swift */,
|
||||
52423CD02CB6A8A300623CA7 /* CheckReachability.swift */,
|
||||
5282DB2D2C981E9300465BA1 /* AdResuable */,
|
||||
5201D4272C7F22DD008E3211 /* Network */,
|
||||
@@ -2085,7 +2088,7 @@
|
||||
9CF6980A2C89A324006007EF /* Lottie */,
|
||||
9CF6980E2C8AFFBF006007EF /* SDWebImage */,
|
||||
5282DB282C92D73B00465BA1 /* GoogleInteractiveMediaAds */,
|
||||
5267659A2C9C5F8900CF2271 /* JWPlayerKit */,
|
||||
525855142CBCECC300E6002A /* JWPlayerKit */,
|
||||
);
|
||||
productName = WOKA;
|
||||
productReference = 523ED25A2BDA2BC700CFED02 /* WOKA.app */;
|
||||
@@ -2190,7 +2193,7 @@
|
||||
9CF698092C89A324006007EF /* XCRemoteSwiftPackageReference "lottie-spm" */,
|
||||
9CF6980D2C8AFFBF006007EF /* XCRemoteSwiftPackageReference "SDWebImage" */,
|
||||
5282DB272C92D73B00465BA1 /* XCRemoteSwiftPackageReference "swift-package-manager-google-interactive-media-ads-ios" */,
|
||||
526765992C9C5F8900CF2271 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */,
|
||||
525855132CBCECC300E6002A /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */,
|
||||
);
|
||||
productRefGroup = 523ED25B2BDA2BC700CFED02 /* Products */;
|
||||
projectDirPath = "";
|
||||
@@ -2388,6 +2391,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
525855172CBD3C7100E6002A /* PlayerStatusEnum.swift in Sources */,
|
||||
9C535DC62C00BF2400DA6DCD /* HomeExploreCell.swift in Sources */,
|
||||
52D774EF2BDFC50D001D87DE /* StringValidations.swift in Sources */,
|
||||
52A6DCC52C4F8EA800F63C51 /* CartListVC.swift in Sources */,
|
||||
@@ -2899,7 +2903,7 @@
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = 4S9A74ZB6H;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
@@ -2943,7 +2947,7 @@
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
DEVELOPMENT_TEAM = 4S9A74ZB6H;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -3169,7 +3173,7 @@
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
526765992C9C5F8900CF2271 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */ = {
|
||||
525855132CBCECC300E6002A /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/jwplayer/JWPlayerKit-package.git";
|
||||
requirement = {
|
||||
@@ -3228,9 +3232,9 @@
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
5267659A2C9C5F8900CF2271 /* JWPlayerKit */ = {
|
||||
525855142CBCECC300E6002A /* JWPlayerKit */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 526765992C9C5F8900CF2271 /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */;
|
||||
package = 525855132CBCECC300E6002A /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */;
|
||||
productName = JWPlayerKit;
|
||||
};
|
||||
5282DB282C92D73B00465BA1 /* GoogleInteractiveMediaAds */ = {
|
||||
|
||||
@@ -12,7 +12,7 @@ extension K{
|
||||
static var guest_login_iOS = "guest_login_iOS"
|
||||
static var user_signup_iOS = "user_signup_iOS"
|
||||
static var new_user_iOS = "new_user_iOS"
|
||||
static var engaged_users = "engaged_users"
|
||||
static var engaged_users_iOS = "engaged_users_iOS"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
15
WOKA/Helpers/PlayerStatusEnum.swift
Normal file
15
WOKA/Helpers/PlayerStatusEnum.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// PlayerStatusEnum.swift
|
||||
// WOKA
|
||||
//
|
||||
// Created by MacBook Pro on 14/10/24.
|
||||
//
|
||||
|
||||
|
||||
enum PlayerStatusEnum {
|
||||
case playing
|
||||
case paused
|
||||
case buffering
|
||||
case stopped
|
||||
case none
|
||||
}
|
||||
@@ -34,7 +34,7 @@ struct APIEndPoints {
|
||||
}
|
||||
|
||||
struct BaseURL {
|
||||
static let staging = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/"
|
||||
static let staging = "https://wokastaging.in/api/"
|
||||
static let development = "https://wokanative.betadelivery.com/api/"
|
||||
static let production = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/"
|
||||
|
||||
@@ -57,7 +57,6 @@ struct APIEndPoints {
|
||||
static let login_proceed = makeURL(path: "login_proceed")
|
||||
static let guest_login = makeURL(path: "guest_login")
|
||||
|
||||
|
||||
static let user_email_verification = makeURL(path: "user_email_verification")
|
||||
static let validate_otp = makeURL(path: "validate_otp")
|
||||
static let interest_topic_listing = makeURL(path: "interest_topic_listing")
|
||||
|
||||
@@ -38,7 +38,6 @@ class SplashVC: UIViewController {
|
||||
// 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.initView()
|
||||
|
||||
})
|
||||
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.plain, target:nil, action:nil)
|
||||
@@ -73,41 +72,29 @@ class SplashVC: UIViewController {
|
||||
|
||||
//flow is updated, now on language click call the guest login api
|
||||
vm.guestLogin()
|
||||
// let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil)
|
||||
// let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.onBoardVC) as! OnBoardVC
|
||||
//
|
||||
// // Create a CATransition instance
|
||||
// let transition = CATransition()
|
||||
// transition.duration = 0.3 // Set the duration of the animation
|
||||
// transition.type = CATransitionType.fade // Set the type of animation to fade
|
||||
//
|
||||
// // Get the navigation controller
|
||||
// guard let navigationController = navigationController else { return }
|
||||
//
|
||||
// // Perform the push animation with the custom transition
|
||||
// navigationController.view.layer.add(transition, forKey: nil)
|
||||
// navigationController.pushViewController(vc, animated: false)
|
||||
}
|
||||
|
||||
@IBAction func retryBtnTapped(_ sender: UIButton) {
|
||||
if AuthFunc.shareInstance.getUserType() == 3{
|
||||
vm.startStopIndicator(start: true)
|
||||
if AuthFunc.shareInstance.staticURLs == nil{
|
||||
AuthFunc.shareInstance.getStaticURLs { [weak self] isDone in
|
||||
guard let self else{return}
|
||||
vm.startStopIndicator(start: false)
|
||||
if isDone == true{
|
||||
UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
}else{
|
||||
self.retryBtn.isHidden = false
|
||||
}
|
||||
}
|
||||
}else{
|
||||
vm.startStopIndicator(start: false)
|
||||
UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
}
|
||||
vm.getVersionHistory()
|
||||
// if AuthFunc.shareInstance.staticURLs == nil{
|
||||
// AuthFunc.shareInstance.getStaticURLs { [weak self] isDone in
|
||||
// guard let self else{return}
|
||||
// vm.startStopIndicator(start: false)
|
||||
// if isDone == true{
|
||||
// UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
// }else{
|
||||
// self.retryBtn.isHidden = false
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// vm.startStopIndicator(start: false)
|
||||
// UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
// }
|
||||
}else{
|
||||
vm.getUserData()
|
||||
vm.startStopIndicator(start: true)
|
||||
vm.getVersionHistory()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class SplashVM{
|
||||
if AuthFunc.shareInstance.adsData == nil{
|
||||
AuthFunc.shareInstance.getAds()
|
||||
}
|
||||
|
||||
vc.activityIndicator.hidesWhenStopped = true
|
||||
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
|
||||
let color2 = #colorLiteral(red: 0.4862745098, green: 0.1960784314, blue: 0.7019607843, alpha: 1)
|
||||
@@ -75,9 +76,11 @@ class SplashVM{
|
||||
if AuthFunc.shareInstance.getUserType() == 3{
|
||||
//setusertype
|
||||
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)
|
||||
|
||||
if AuthFunc.shareInstance.adsData == nil{
|
||||
AuthFunc.shareInstance.getAds()
|
||||
}
|
||||
|
||||
if AuthFunc.shareInstance.staticURLs == nil{
|
||||
AuthFunc.shareInstance.getStaticURLs { isDone in
|
||||
if isDone == true{
|
||||
@@ -95,10 +98,11 @@ class SplashVM{
|
||||
/*
|
||||
If user is guest then dont do the nw call
|
||||
*/
|
||||
if AuthFunc.shareInstance.getUserType() == 3{
|
||||
UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
return
|
||||
}
|
||||
// if AuthFunc.shareInstance.getUserType() == 3{
|
||||
// UIApplication.setRootView(SideMenuController.instantiate(from: .Home))
|
||||
// return
|
||||
// }
|
||||
|
||||
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi",
|
||||
"access-token": AuthFunc.shareInstance.getAccessToken()]
|
||||
startStopIndicator(start: true)
|
||||
@@ -152,6 +156,7 @@ class SplashVM{
|
||||
guard let self else{return}
|
||||
switch data.success{
|
||||
case 0:
|
||||
startStopIndicator(start: false)
|
||||
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
||||
case 1:
|
||||
guard let data = data.data?.the0, let newVersionFromApi = data.newVersion, let forceUpdateVersion = data.forceUpdateVersion, let forceUpdate = data.forceUpdate, let forceUpdateApi = (forceUpdate == 1 ? true : false) else{return}
|
||||
@@ -165,6 +170,7 @@ class SplashVM{
|
||||
Check if user has skipped the force update version
|
||||
*/
|
||||
let skippedVer = UserDefaults.standard.string(forKey: K.UserDefaultsStruct.appUpdateSkipVer)
|
||||
print("Skipped Ver:- ", skippedVer)
|
||||
if skippedVer == forceUpdateVersion{
|
||||
// it means user has skipped this version.
|
||||
vc.animateForward()
|
||||
@@ -200,6 +206,7 @@ class SplashVM{
|
||||
}
|
||||
case .failure(let error):
|
||||
guard let self else{return}
|
||||
startStopIndicator(start: false)
|
||||
self.vc.toast(msg: error.localizedDescription , time: 2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommonNwCallTheme{
|
||||
print("Success Unique User")
|
||||
// update local user data && trigger firebase analytics for engaged_users
|
||||
AuthFunc.shareInstance.userData?.isUniqueUser = false
|
||||
Analytics.logEvent(K.AnalyticsEventKeys.engaged_users, parameters: nil)
|
||||
Analytics.logEvent(K.AnalyticsEventKeys.engaged_users_iOS, parameters: nil)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -328,6 +328,10 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
|
||||
errorCount += 1
|
||||
self.player.configurePlayer(with: config)
|
||||
self.player.play()
|
||||
if contentType == .webSeries, let videoIndex{
|
||||
player.nextUpPlaylistIndex = videoIndex
|
||||
player.next()
|
||||
}
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
@@ -341,6 +345,10 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
|
||||
if isDone{
|
||||
self.player.configurePlayer(with: config)
|
||||
self.player.play()
|
||||
if contentType == .webSeries, let videoIndex{
|
||||
player.nextUpPlaylistIndex = videoIndex
|
||||
player.next()
|
||||
}
|
||||
}else{
|
||||
self.vm.handleBackAction()
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ class ThemeOneVC: UIViewController {
|
||||
|
||||
weak var delegate: ChildViewControllerDelegate?
|
||||
|
||||
|
||||
// MARK: - LifeCycle
|
||||
|
||||
deinit{
|
||||
@@ -76,17 +75,19 @@ class ThemeOneVC: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
vm.vc = self
|
||||
vm.initView()
|
||||
vm.initView()
|
||||
vm.setupAvPlayer()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
vm.shouldAnimate = false
|
||||
vm.centerLiveTVViewHorizontally()
|
||||
if let player = vm.avPlayer{
|
||||
player.pause()
|
||||
}
|
||||
@@ -237,6 +238,9 @@ extension ThemeOneVC{
|
||||
|
||||
switch vm.reachability?.isReachable{
|
||||
case true:
|
||||
vm.avPlayerStatus = .buffering
|
||||
vm.avPlayerBufferTimestamp = Date()
|
||||
print("Net is connected")
|
||||
break
|
||||
case false:
|
||||
/*
|
||||
@@ -253,9 +257,14 @@ extension ThemeOneVC{
|
||||
case .playing:
|
||||
print("Theme 1 Player Playing")
|
||||
vm.startStopActivity(isStart: false)
|
||||
vm.avPlayerStatus = .playing
|
||||
vm.avPlayerBufferTimestamp = nil
|
||||
case .paused:
|
||||
print("Theme 1 Player Paused")
|
||||
|
||||
vm.avPlayerStatus = .paused
|
||||
vm.avPlayerBufferTimestamp = nil
|
||||
|
||||
// check if app is in background return it
|
||||
if UIApplication.shared.applicationState == .background {return}
|
||||
if let rootViewController = UIApplication.shared.mainKeyWindow?.rootViewController {
|
||||
|
||||
@@ -30,6 +30,9 @@ class ThemeOneVM{
|
||||
let queue = DispatchQueue.global(qos: .background)
|
||||
var isNetworkMonitored = false
|
||||
|
||||
var avPlayerStatus = PlayerStatusEnum.none
|
||||
var avPlayerBufferTimestamp : Date?
|
||||
|
||||
func requestIDFA() {
|
||||
ATTrackingManager.requestTrackingAuthorization { status in
|
||||
switch status {
|
||||
@@ -219,18 +222,25 @@ class ThemeOneVM{
|
||||
@objc func appWillEnterForeground() {
|
||||
// Code to execute when the app enters the foreground
|
||||
print("App will enter foreground")
|
||||
self.centerLiveTVViewHorizontally()
|
||||
if let rootViewController = UIApplication.shared.mainKeyWindow?.rootViewController {
|
||||
if let topVC = topVC(in: rootViewController) {
|
||||
if topVC is HomeVC || topVC is WokaFMVC{
|
||||
shouldAnimate = true
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
||||
guard let self else{return}
|
||||
moveLiveTVView()
|
||||
moveCloudView()
|
||||
}
|
||||
if let player = avPlayer{
|
||||
player.play()
|
||||
}
|
||||
Timer.scheduledTimer(withTimeInterval: 1.3, repeats: false) { [weak self] _ in
|
||||
guard let self else{return}
|
||||
self.moveLiveTVView()
|
||||
self.moveCloudView()
|
||||
}
|
||||
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
||||
// guard let self else{return}
|
||||
// moveLiveTVView()
|
||||
// moveCloudView()
|
||||
// }
|
||||
|
||||
handleBackground()
|
||||
} else {
|
||||
print("The top view controller is not HomeVC")
|
||||
@@ -389,6 +399,7 @@ class ThemeOneVM{
|
||||
Av Player Setup
|
||||
*/
|
||||
guard let data = AuthFunc.shareInstance.staticURLs , let liveStreamData = data.liveData?.first else{
|
||||
AuthFunc.shareInstance.getStaticURLs()
|
||||
self.vc.toast(msg: "Issue with live streaming", time: 2)
|
||||
return
|
||||
}
|
||||
@@ -469,7 +480,10 @@ class ThemeOneVM{
|
||||
guard let self = self else { return }
|
||||
self.isMovingRight.toggle() // Toggle the direction for the next iteration
|
||||
// DispatchQueue.main.async { // Ensure the recursive call is made on the main thread
|
||||
// self.moveLiveTVView()
|
||||
if self.shouldAnimate {
|
||||
self.moveLiveTVView() // Recursively call moveLiveTVView to create a continuous animation
|
||||
}
|
||||
// }
|
||||
})
|
||||
}
|
||||
@@ -607,6 +621,32 @@ class ThemeOneVM{
|
||||
// MARK: - Handle Time Change
|
||||
|
||||
@objc func handleBackground(){
|
||||
|
||||
/*
|
||||
check if the player is stuck on buffering and also if its 2 minutes or more, setup av player again.
|
||||
*/
|
||||
if let timeStamp = avPlayerBufferTimestamp, avPlayerStatus == .buffering{
|
||||
/*
|
||||
check if timestamp difference is equal and greater than 2 minutes i.e 120 seconds
|
||||
*/
|
||||
let duration = DateFormatterLib.dateDifferenceINT(date1: timeStamp, date2: Date())
|
||||
print("Player paused seconds:- ",duration)
|
||||
|
||||
// if from 2 minutes its showing buffering then load it again.
|
||||
if duration >= 120{
|
||||
// setup av player again
|
||||
if CheckReachability.reachability?.isReachable == true{
|
||||
setupAvPlayer()
|
||||
|
||||
// make the timestamp nil and status to none
|
||||
avPlayerBufferTimestamp = nil
|
||||
avPlayerStatus = .none
|
||||
}
|
||||
}
|
||||
}else{
|
||||
print("No Buffer")
|
||||
}
|
||||
|
||||
let currentTime = Date()
|
||||
|
||||
for period in AuthFunc.shareInstance.timePeriods {
|
||||
|
||||
@@ -207,7 +207,7 @@ class WokaFMVM{
|
||||
// UIApplication.shared.open(url)
|
||||
// }
|
||||
// }
|
||||
}else{
|
||||
}else if fmAd.googleAd != nil{
|
||||
/*
|
||||
Show google ads with dispatch queue.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user