- Updated ADs api, Changed the whole response. - Made changes on webseries for local ads and google ads, improvised the logic. - Added logic on theme 2 to show google ad - Karaoke updated for google ads and normal ads. - Audio Books updated for google ads and normal ads. - FM updated for google ads. - Karaoke Player updated for google ads. - Games WebView updated for google ads. - Games Details Interstitial AD updated for google ads. - Games List updated for google and local ads.
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
//
|
|
// GoogleInterstistialADSetup.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 23/09/24.
|
|
//
|
|
|
|
import GoogleMobileAds
|
|
import Alamofire
|
|
|
|
class GoogleInterstistialADSetup{
|
|
|
|
static let shareInstance = GoogleInterstistialADSetup()
|
|
let reachability = NetworkReachabilityManager()
|
|
|
|
private init(){}
|
|
var interstitial: GADInterstitialAd?
|
|
|
|
func setupGoogleIntersitialAD(){
|
|
GADInterstitialAd.load(withAdUnitID: K.GoogleAdIDs.gamesDetailsInterStial, request: GADRequest()) { [weak self] ad, error in
|
|
if let error = error {
|
|
print("Failed to load interstitial ad with error: \(error.localizedDescription)")
|
|
|
|
// If internet is reachable, try to load the ad again
|
|
if self?.reachability?.isReachable == true {
|
|
self?.setupGoogleIntersitialAD()
|
|
}
|
|
return
|
|
}
|
|
|
|
// Successfully loaded the interstitial ad
|
|
self?.interstitial = ad
|
|
print("Interstitial ad loaded successfully.")
|
|
}
|
|
}
|
|
}
|