Day_Count_Memory_Days/anniversary_Project/Main/AV_LaunchLimitesVC.swift
2024-08-08 13:50:34 +08:00

190 lines
6.2 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

////
//// AV_LaunchLimitesVC.swift
//// anniversary_Project
////
//// Created by 16 on 2024/7/11.
////
//
//import UIKit
//import SVProgressHUD
//import Photos
//import Alamofire
////import AppLovinSDK
////import FirebaseAnalytics
//import FirebaseRemoteConfig
//
//class AV_LaunchLimitesVC: AV_RootVC {
// let activityView = UIActivityIndicatorView()
//// var interstitialAd: MAInterstitialAd!
// var retryAttempt = 0.0
//
// var adCheckTimer: Timer?
// var adCheckStartTime: Date?
// var adLoadTime: Int = 0
//
// var idad:String?
//// var remoteConfig: RemoteConfig!
//
// var failureCount = 0
//
// private var retryTimer: Timer?
// private var retryAttempts = 0
// private let maxRetryAttempts = 3
// private let retryInterval: TimeInterval = 3
// override func viewDidLoad() {
// super.viewDidLoad()
//
//
//
//
// activityView.center = CGPoint(x: self.view.center.x + 10, y: self.view.bounds.size.height - 100 )
// //
// activityView.hidesWhenStopped = true
// activityView.color = .black;
// activityView.style = UIActivityIndicatorView.Style.whiteLarge
//
// self.view.addSubview(activityView)
// self.activityView.startAnimating()
//
//
// }
//
// override func viewWillAppear(_ animated: Bool) {
// super.viewWillAppear(animated)
// navigationController?.navigationBar.isHidden = true
// // createInterstitialAd()
// DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
// //
// requestTrackingAuthorization { idfa in
// if let idfa = idfa {
// print("IDFA: \(idfa)")
// StartManager.shared.idfaid = idfa
// print("Stored IDFA: \(StartManager.shared.idfaid ?? "N/A")")
// } else {
// print("IDFA is not available or tracking authorization denied.")
// }
// }
// }
// }
//
//
//
//
//
// func fetchIDFAUntilSuccess() {
// DispatchQueue.global(qos: .background).async {
// var idfaObtained = false
//
// while !idfaObtained {
// let semaphore = DispatchSemaphore(value: 0)
//
// requestIDFA { idfa in
// if let idfa = idfa {
// print("Got IDFA: \(idfa)")
// // IDFA
// // self.performActionWithIDFA(idfa)
// StartManager.shared.idfaid = idfa
// self.setPostSHOW()
// idfaObtained = true
// } else {
// print("Failed to get IDFA, retrying...")
// DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + 1.0) {
// semaphore.signal()
// }
// }
// }
//
// semaphore.wait()
// }
// }
// }
//
//}
//extension AV_LaunchLimitesVC: MAAdDelegate
//{
// func createInterstitialAd() {
//
// let randomString = getRandomString()
//
// if StartManager.shared.adId == nil{
// StartManager.shared.adId = randomString ?? "bee9f7039e56cc7a"
// interstitialAd = MAInterstitialAd(adUnitIdentifier: StartManager.shared.adId!)
// print("adid-----\(StartManager.shared.adId ?? "gggg")")
// }else{
// interstitialAd = MAInterstitialAd(adUnitIdentifier: StartManager.shared.adId!)
// print("adid-----\(StartManager.shared.adId ?? "gggg")")
// }
//
// interstitialAd.delegate = self
// self.idad = randomString
//
// // Load the first ad
// interstitialAd.load()
// }
//
//
// // MARK: MAAdDelegate Protocol
//
// /// 广
// func didLoad(_ ad: MAAd) {
// // 0
// retryAttempt = 0
// // 广
// // StartManager.shared.shelfNumber = ""
// StartManager.shared.succeed = true
// StartManager.shared.loadTime = self.adLoadTime
// StartManager.shared.adPlatform = "MAX"
// StartManager.shared.countryCode = ALSdk.shared().configuration.countryCode
// StartManager.shared.adId = self.idad
// StartManager.shared.platformResponseTime = ad.requestLatency
// StartManager.shared.ecpm = Float(ad.revenue)
// StartManager.shared.dsp = ad.dspName
// StartManager.shared.network = ad.networkName
//
// self.setPostload()
//
// }
//
// /// 广
// func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
// // 广
// // 使 64
// retryAttempt += 1
// let delaySec = pow(2.0, min(6.0, retryAttempt))
// DispatchQueue.main.asyncAfter(deadline: .now() + delaySec) {
// self.interstitialAd.load()
// }
// }
//
// /// 广
// func didDisplay(_ ad: MAAd) {
// //
// }
//
// /// 广
// func didClick(_ ad: MAAd) {
// // 广
// }
//
// /// 广
// func didHide(_ ad: MAAd) {
// //
// // 广广
// interstitialAd.load()
// let appDelegate = UIApplication.shared.delegate
// appDelegate?.window??.rootViewController = AV_NAVVC(rootViewController: AV_WaterHomeVC())
// }
//
//
// /// 广
// func didFail(toDisplay ad: MAAd, withError error: MAError) {
// // 广广
// interstitialAd.load()
// }
//
//
//
//
//}
//