- made theme 2 banner dynamic, if ad loads then only it will be shown

- made radio ad dynamic, now ad will show up only if ad is received
- added a retry count to fm, it will try 4 times to connect to the server if not then showing the reload btn
This commit is contained in:
Bilal
2024-09-19 01:22:04 +05:30
parent 3a499281c2
commit dcbbfc3417
11 changed files with 306 additions and 172 deletions

View File

@@ -9,6 +9,7 @@ import UIKit
import AVFoundation
import JWPlayerKit
import Alamofire
import GoogleMobileAds
struct Theme2Struct{
let imageName : String
@@ -27,6 +28,7 @@ class ThemeTwoVM{
let monitor = NWPathMonitor()
let queue = DispatchQueue.global(qos: .background)
var isNetworkMonitored = false
var bannerView = GADBannerView()
/*
Static cell data
@@ -50,6 +52,12 @@ class ThemeTwoVM{
guard let self else{return}
self.playLiveTV()
}
// configuring the google ads.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: { [weak self] in
guard let self else{return}
AdReusable.sharedInstance.setupBannerAd(bannerView: bannerView, in: vc.adView, adUnitID: K.GoogleAdIDs.splashBanner1, viewController: self.vc, height: 8, width: 15)
})
}
private func handleNotificationCenter(){
@@ -58,7 +66,6 @@ class ThemeTwoVM{
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.viewPush(notification:)), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.themeTwoPush), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleRouteChange(_:)), name: AVAudioSession.routeChangeNotification, object: nil)
}
// MARK: - This will handle all clicks for modules