no message
This commit is contained in:
parent
ec995a1fd0
commit
98191889a0
@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
self.registThirdparty(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
|
||||
self.requestAPNS()
|
||||
// self.requestAPNS()
|
||||
|
||||
|
||||
return true
|
||||
|
@ -12,8 +12,13 @@ import FirebaseCore
|
||||
extension AppDelegate {
|
||||
///是否展示过通知提示
|
||||
static var haveBeenShownAPNS = false
|
||||
///是否请求过通知权限
|
||||
static var isRequestApnsAuthorization = false
|
||||
|
||||
func requestAPNS() {
|
||||
guard !Self.isRequestApnsAuthorization else { return }
|
||||
Self.isRequestApnsAuthorization = true
|
||||
|
||||
FirebaseApp.configure()
|
||||
Messaging.messaging().delegate = self
|
||||
|
||||
|
@ -128,11 +128,13 @@ extension SceneDelegate {
|
||||
}
|
||||
window?.rootViewController = guideVc
|
||||
window?.makeKeyAndVisible()
|
||||
VPAppTool.appDelegate?.requestAPNS()
|
||||
} else if !self.isOpenApp, hasOpenApp == true, VPNetworkReachabilityManager.manager.isReachable == true, VPLoginManager.manager.userInfo?.user_level == .ad {
|
||||
|
||||
let vc = VPAppOpenAdViewController()
|
||||
vc.didEndBlock = { [weak self] in
|
||||
self?.setTabBarController()
|
||||
VPAppTool.appDelegate?.requestAPNS()
|
||||
self?.vp_retryHandleOpenAppMessage()
|
||||
}
|
||||
window?.rootViewController = vc
|
||||
@ -140,6 +142,7 @@ extension SceneDelegate {
|
||||
|
||||
} else {
|
||||
setTabBarController()
|
||||
VPAppTool.appDelegate?.requestAPNS()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,7 @@ class VPAdAPI {
|
||||
|
||||
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<VPAdDataModel>) in
|
||||
if response.code != VPNetworkCodeSucceed || response.data?.ad?.platform_key == nil {
|
||||
let adInfo = VPAdInfo()
|
||||
adInfo.platform_key = .google
|
||||
adInfo.ads_id = VPAdManager.google_rewardedAdUnitID
|
||||
let adInfo = VPAdInfo.createNormalAdInfo()
|
||||
completer?(adInfo)
|
||||
} else {
|
||||
completer?(response.data?.ad)
|
||||
|
@ -100,13 +100,8 @@ class VPRewardedAdManager: NSObject {
|
||||
|
||||
self.isLoadingAd = true
|
||||
|
||||
VPAdAPI.requestShowAdInfo { [weak self] adInfo in
|
||||
self.getAdInfo { [weak self] adInfo in
|
||||
guard let self = self else { return }
|
||||
guard let adInfo = adInfo else {
|
||||
self.isLoadingAd = false
|
||||
return
|
||||
}
|
||||
self.adInfo = adInfo
|
||||
|
||||
switch adInfo.platform_key {
|
||||
case .google:
|
||||
@ -124,6 +119,7 @@ class VPRewardedAdManager: NSObject {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func showAd(delegate: VPRewardedAdManagerDelegate? = nil) {
|
||||
@ -146,7 +142,6 @@ class VPRewardedAdManager: NSObject {
|
||||
|
||||
private func clean() {
|
||||
self.rewardedAd = nil
|
||||
self.adInfo = nil
|
||||
self.statScene = nil
|
||||
self.videoInfo = nil
|
||||
self.delegate = nil
|
||||
@ -271,6 +266,27 @@ extension VPRewardedAdManager {
|
||||
|
||||
self.requestStatAd(type: "Interrupt", seconds: 0, errorMsg: nil)
|
||||
}
|
||||
|
||||
|
||||
private func getAdInfo(completer: ((_ adInfo: VPAdInfo) -> Void)?) {
|
||||
|
||||
if let adInfo = self.adInfo {
|
||||
completer?(adInfo)
|
||||
}
|
||||
VPAdAPI.requestShowAdInfo { [weak self] adInfo in
|
||||
guard let self = self else { return }
|
||||
|
||||
if let adInfo = adInfo {
|
||||
self.adInfo = adInfo
|
||||
completer?(adInfo)
|
||||
} else {
|
||||
let adInfo = VPAdInfo.createNormalAdInfo()
|
||||
self.adInfo = adInfo
|
||||
completer?(adInfo)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,4 +26,12 @@ class VPAdInfo: VPModel, SmartCodable {
|
||||
var status: String?
|
||||
var platform_key: VPAdPlatformKey?
|
||||
|
||||
|
||||
static func createNormalAdInfo() -> VPAdInfo {
|
||||
let adInfo = VPAdInfo()
|
||||
adInfo.platform_key = .applovin
|
||||
adInfo.ads_id = VPAdManager.applovin_rewardedAdUnitID
|
||||
return adInfo
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,6 +82,11 @@ extension VPAdManager {
|
||||
#endif
|
||||
}
|
||||
|
||||
///激励广告的单元ID
|
||||
static var applovin_rewardedAdUnitID: String {
|
||||
return "39bf981e27728eae"
|
||||
}
|
||||
|
||||
///开屏广告的单元ID
|
||||
static var applovin_appOpenAdUnitID: String {
|
||||
return "d587df0fd75ff03b"
|
||||
|
Loading…
x
Reference in New Issue
Block a user