ios12
This commit is contained in:
parent
60384ccb94
commit
088617646f
@ -21,3 +21,6 @@ def install_all():
|
|||||||
|
|
||||||
install_all()
|
install_all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# apt.cydiakk.touchflow
|
||||||
@ -842,7 +842,9 @@ class YL_NetWorkManager{
|
|||||||
platformResponseTime: TimeInterval,
|
platformResponseTime: TimeInterval,
|
||||||
dsp: String,
|
dsp: String,
|
||||||
loadTime: Int,
|
loadTime: Int,
|
||||||
retryCount: Int = 3 // 默认重试3次
|
retryCount: Int = 3,
|
||||||
|
succeed:Bool = true,
|
||||||
|
errorMsg:String = ""
|
||||||
) {
|
) {
|
||||||
var mdic: [String: Any] = [:]
|
var mdic: [String: Any] = [:]
|
||||||
|
|
||||||
@ -862,7 +864,8 @@ class YL_NetWorkManager{
|
|||||||
mdic["dataId"] = BbbAdManager.config.dataId
|
mdic["dataId"] = BbbAdManager.config.dataId
|
||||||
mdic["linkId"] = BbbAdManager.config.linkId
|
mdic["linkId"] = BbbAdManager.config.linkId
|
||||||
mdic["loadTime"] = loadTime
|
mdic["loadTime"] = loadTime
|
||||||
mdic["succeed"] = true
|
mdic["succeed"] = succeed
|
||||||
|
mdic["errorMsg"] = errorMsg
|
||||||
mdic["network"] = network
|
mdic["network"] = network
|
||||||
mdic["online"] = false
|
mdic["online"] = false
|
||||||
mdic["washParam"] = BbbAdManager.config.washParam
|
mdic["washParam"] = BbbAdManager.config.washParam
|
||||||
@ -1012,36 +1015,6 @@ class YL_NetWorkManager{
|
|||||||
static func showAd(adId: String,
|
static func showAd(adId: String,
|
||||||
ecpm: Double?,
|
ecpm: Double?,
|
||||||
ad: Bool) {
|
ad: Bool) {
|
||||||
|
|
||||||
var mdic = [String: Any]()
|
|
||||||
mdic["appid"] = appId()
|
|
||||||
mdic["idfa"] = getIdfa()
|
|
||||||
mdic["ecpm"] = ecpm ?? 0
|
|
||||||
mdic["ad"] = ad
|
|
||||||
mdic["id"] = adId
|
|
||||||
|
|
||||||
let client:XUDPClient = XUDPClient.sharedInstance()
|
|
||||||
client.hintBlock = { (t:String?) in
|
|
||||||
guard let jsonStr = t else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let result = convertStringToDictionary(text: jsonStr)
|
|
||||||
guard let status = result?["status"] as? String,
|
|
||||||
let time = result!["close"] as? NSNumber else {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
closeAD.removeADVC(byDelayTime: time.intValue)
|
|
||||||
// closeWindows.removeADVCByDelayTime(time.intValue)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
client.onShow(mdic,toPort:UInt16(BbbAdManager.config.udp_port));
|
|
||||||
|
|
||||||
closeAD.removeADVC(byDelayTime:5000)
|
closeAD.removeADVC(byDelayTime:5000)
|
||||||
}
|
}
|
||||||
static func loadend(max_ecpm:Double){
|
static func loadend(max_ecpm:Double){
|
||||||
|
|||||||
@ -107,6 +107,14 @@ class AdItem :NSObject,MAAdDelegate{
|
|||||||
YL_NetWorkManager.loadend(max_ecpm: 0)
|
YL_NetWorkManager.loadend(max_ecpm: 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func getLoadTime() -> Int {
|
||||||
|
var time = 0
|
||||||
|
if let startTime = startLoadTime {
|
||||||
|
let loadDuration = calculateElapsedTime(since: startTime)
|
||||||
|
time = loadDuration
|
||||||
|
}
|
||||||
|
return time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func loadInterstitialAd(){
|
func loadInterstitialAd(){
|
||||||
@ -154,17 +162,27 @@ class AdItem :NSObject,MAAdDelegate{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
|
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
|
||||||
|
failLoad(forAdUnitIdentifier: adUnitIdentifier, withError: error.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
func failLoad(forAdUnitIdentifier adUnitIdentifier: String, withError error: String) {
|
||||||
NSLog("XS didFailToLoadAd 1 \(self.interstitialAdID)")
|
NSLog("XS didFailToLoadAd 1 \(self.interstitialAdID)")
|
||||||
BbbAdManager.config.loadcount += 1
|
BbbAdManager.config.loadcount += 1
|
||||||
NSLog("XS didFailToLoadAd 2 \(self.interstitialAdID) \(error)")
|
NSLog("XS didFailToLoadAd 2 \(self.interstitialAdID) \(error)")
|
||||||
NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "加载:\(adUnitIdentifier ) 失败"])
|
NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "加载:\(adUnitIdentifier ) 失败"])
|
||||||
NSLog("XS didFailToLoadAd 3 \(self.interstitialAdID)")
|
var time = 0
|
||||||
// NotificationCenter.default.post(name: .adDidFailToLoad, object: nil, userInfo: ["adId": adUnitIdentifier])
|
if let startTime = startLoadTime {
|
||||||
|
let loadDuration = calculateElapsedTime(since: startTime)
|
||||||
|
print("广告 \(adUnitIdentifier) 加载时间: \(loadDuration) ms")
|
||||||
|
time = loadDuration
|
||||||
|
}
|
||||||
|
DispatchQueue.global(qos: .utility).async { [weak self] in
|
||||||
|
guard self != nil else { return }
|
||||||
|
YL_NetWorkManager.uploadAD_Load(adid: adUnitIdentifier, ecpm: 0.0, network: "", countryCode: "", platformResponseTime:0.0 , dsp: "", loadTime: time,succeed:false,errorMsg: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NSLog("XS didFailToLoadAd 4 \(self.interstitialAdID)")
|
|
||||||
changeStatus(st: 5)
|
changeStatus(st: 5)
|
||||||
NSLog("XS didFailToLoadAd 5 \(self.interstitialAdID)")
|
NSLog("XS didFailToLoadAd 5 \(self.interstitialAdID)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func didDisplay(_ ad: MAAd) {
|
func didDisplay(_ ad: MAAd) {
|
||||||
@ -360,6 +378,10 @@ class BbbAdManager: NSObject {
|
|||||||
}
|
}
|
||||||
for (_, ad) in BbbAdManager.shared.adItems {
|
for (_, ad) in BbbAdManager.shared.adItems {
|
||||||
if(ad.status <= 1) {
|
if(ad.status <= 1) {
|
||||||
|
let loadTime = ad.getLoadTime()
|
||||||
|
if (loadTime > 15000) {
|
||||||
|
ad.failLoad(forAdUnitIdentifier: ad.interstitialAdID, withError: "load ad time out > 15s")
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (ad.status == 2 && BbbAdManager.config.washParam) {
|
if (ad.status == 2 && BbbAdManager.config.washParam) {
|
||||||
@ -371,6 +393,7 @@ class BbbAdManager: NSObject {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func showAd() {
|
func showAd() {
|
||||||
guard !self.isshow else { return }
|
guard !self.isshow else { return }
|
||||||
for (_, ad) in BbbAdManager.shared.adItems {
|
for (_, ad) in BbbAdManager.shared.adItems {
|
||||||
|
|||||||
@ -1018,38 +1018,7 @@ class YL_NetWorkManager{
|
|||||||
ecpm: Double?,
|
ecpm: Double?,
|
||||||
ad: Bool,
|
ad: Bool,
|
||||||
callback: @escaping () -> Void) {
|
callback: @escaping () -> Void) {
|
||||||
|
initializationTopOn.removeADVC(byDelayTime: 6000, onclose:{
|
||||||
var mdic = [String: Any]()
|
|
||||||
mdic["appid"] = appId()
|
|
||||||
mdic["idfa"] = getIdfa()
|
|
||||||
mdic["ecpm"] = ecpm ?? 0
|
|
||||||
mdic["ad"] = ad
|
|
||||||
mdic["id"] = adId
|
|
||||||
|
|
||||||
let client:XUDPClient = XUDPClient.sharedInstance()
|
|
||||||
client.hintBlock = { (t:String?) in
|
|
||||||
guard let jsonStr = t else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let result = convertStringToDictionary(text: jsonStr)
|
|
||||||
guard let status = result?["status"] as? String,
|
|
||||||
let time = result!["close"] as? NSNumber else {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if status == "Success" && ad {
|
|
||||||
|
|
||||||
initializationTopOn.removeADVC(byDelayTime: time.intValue, onclose:{
|
|
||||||
callback();
|
|
||||||
} )
|
|
||||||
// closeWindows.removeADVCByDelayTime(time.intValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
client.onShow(mdic,toPort:UInt16(BbbAdManager.config.udp_port));
|
|
||||||
initializationTopOn.removeADVC(byDelayTime: 5000, onclose:{
|
|
||||||
callback();
|
callback();
|
||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,6 @@ class bConfig: NSObject {
|
|||||||
|
|
||||||
class AdItem :NSObject, ATInterstitialDelegate {
|
class AdItem :NSObject, ATInterstitialDelegate {
|
||||||
|
|
||||||
|
|
||||||
func didFinishLoadingAD(withPlacementID placementID: String!) {
|
func didFinishLoadingAD(withPlacementID placementID: String!) {
|
||||||
BbbAdManager.config.loadcount1 += 1
|
BbbAdManager.config.loadcount1 += 1
|
||||||
NSLog("XS- didFinishLoadingAD\(String(describing: placementID))")
|
NSLog("XS- didFinishLoadingAD\(String(describing: placementID))")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user