Commit 710d5e60 by Demid Merzlyakov

Amazon SDK: initialize on startup to fix the UI freeze.

parent 51822aec
...@@ -110,8 +110,9 @@ public class AdManager { ...@@ -110,8 +110,9 @@ public class AdManager {
} }
private func initializeA9(a9AppKey: String) { private func initializeA9(a9AppKey: String) {
DTBAds.sharedInstance().setAppKey(a9AppKey) // As of DTB 3.4.6 the Amazon SDK freezes the main thread on startup for a couple of seconds, which got us rejected during an AppStore Review. We're going to move this initialization to the AppDelegate for now. The consent status is going to be set earlier within CCPAHelper.shared.onAppLaunch(), so make sure CCPAHelper's onAppLaunch is called before Amazon's setAppKey
DTBAds.sharedInstance().mraidPolicy = MOPUB_MRAID // DTBAds.sharedInstance().setAppKey(a9AppKey)
DTBAds.sharedInstance().setCmpFlavor(.GOOGLE_CMP) DTBAds.sharedInstance().setCmpFlavor(.GOOGLE_CMP)
DTBAds.sharedInstance().mraidPolicy = DFP_MRAID DTBAds.sharedInstance().mraidPolicy = DFP_MRAID
updateAmazonTestMode(for: EnvironmentManager.shared.environment) updateAmazonTestMode(for: EnvironmentManager.shared.environment)
......
...@@ -12,6 +12,7 @@ import Flurry_iOS_SDK ...@@ -12,6 +12,7 @@ import Flurry_iOS_SDK
import MoEngage import MoEngage
import GoogleMobileAds import GoogleMobileAds
import Swarm import Swarm
import DTBiOSSDK
private let WDT_APP_ID = "e3b73414" private let WDT_APP_ID = "e3b73414"
private let WDT_APP_KEY = "25e8d6b72de3bcd528f7769b073cc335" private let WDT_APP_KEY = "25e8d6b72de3bcd528f7769b073cc335"
...@@ -30,7 +31,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -30,7 +31,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
) )
self.window = UIWindow(frame: UIScreen.main.bounds) self.window = UIWindow(frame: UIScreen.main.bounds)
// Note that the Amazon SDK will get assigned a proper value for consent status inside CCPAHelper.onAppLaunch
// So, make sure this call happens after the
CCPAHelper.shared.onAppLaunch() CCPAHelper.shared.onAppLaunch()
// As of DTB 3.4.6 the Amazon SDK freezes the main thread on startup for a couple of seconds, which got us rejected during an AppStore Review. We're going to move this initialization to the AppDelegate for now. The consent status is going to be set earlier within CCPAHelper.shared.onAppLaunch(), so make sure CCPAHelper's onAppLaunch is called before Amazon's setAppKey
// TODO: remove setAppKey from here, if Amazon has fixed the freeze on startup.
Logger(componentName: "Amazon A9").info("Amazon SDK initialization start")
DTBAds.sharedInstance().setAppKey(a9AppKey)
FirebaseApp.configure() FirebaseApp.configure()
ConfigManager.shared.updateConfig() ConfigManager.shared.updateConfig()
......
...@@ -17,6 +17,7 @@ import CommonCrypto ...@@ -17,6 +17,7 @@ import CommonCrypto
import CryptoKit import CryptoKit
import FBAudienceNetwork import FBAudienceNetwork
import PSMLocationSDK import PSMLocationSDK
import DTBiOSSDK
fileprivate let APP_NAME = "ONE_WEATHER" fileprivate let APP_NAME = "ONE_WEATHER"
fileprivate let DEVICE_TYPE = "IOS" fileprivate let DEVICE_TYPE = "IOS"
...@@ -129,9 +130,13 @@ class CCPAHelper { ...@@ -129,9 +130,13 @@ class CCPAHelper {
// https://ams.amazon.com/webpublisher/uam/docs/web-integration-documentation/integration-guide/uam-ccpa.html?source=menu // https://ams.amazon.com/webpublisher/uam/docs/web-integration-documentation/integration-guide/uam-ccpa.html?source=menu
if self.canCollectData == nil { if self.canCollectData == nil {
A9Cache.shared.ccpaPrivacyString = "1Y-" A9Cache.shared.ccpaPrivacyString = "1Y-"
log.debug("Amazon A9: set consent status UNKNOWN")
DTBAds.sharedInstance().setConsentStatus(.UNKNOWN)
} }
else { else {
A9Cache.shared.ccpaPrivacyString = canCollectData ? "1YN" : "1YY" A9Cache.shared.ccpaPrivacyString = canCollectData ? "1YN" : "1YY"
DTBAds.sharedInstance().setConsentStatus( canCollectData ? .EXPLICIT_YES : .EXPLICIT_NO)
log.debug("Amazon A9: set consent status \(canCollectData ? "EXPLICIT_YES" : "EXPLICIT_NO")")
} }
//Google AdMob Settings - https://developers.google.com/admob/ios/ccpa //Google AdMob Settings - https://developers.google.com/admob/ios/ccpa
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment