Commit d88342a7 by Demid Merzlyakov

IOS-74: Delay AppsFlyer initialization until privacy notice. Disable AppsFlyer if CCPA opt out.

parent ae4ff033
...@@ -23,17 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -23,17 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private let appsFlyerLog = Logger(componentName: "AppsFlyer") private let appsFlyerLog = Logger(componentName: "AppsFlyer")
private let log = Logger(componentName: "AppDelegate") private let log = Logger(componentName: "AppDelegate")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func initializeAppsFlyer() {
ThemeManager.refreshAppearance()
// WDT radar setup
SwarmManager.sharedManager.authentication = SkywiseAuthentication(
app_id: WDT_APP_ID,
app_key: WDT_APP_KEY
)
self.window = UIWindow(frame: UIScreen.main.bounds)
appsFlyerLog.info("AppsFlyer initialize with AppsFlyerId: \(kAppsFlyerId), Apple App ID: \(kAppsFlyerAppId)") appsFlyerLog.info("AppsFlyer initialize with AppsFlyerId: \(kAppsFlyerId), Apple App ID: \(kAppsFlyerAppId)")
appsFlyer.appsFlyerDevKey = kAppsFlyerId appsFlyer.appsFlyerDevKey = kAppsFlyerId
appsFlyer.appleAppID = kAppsFlyerAppId appsFlyer.appleAppID = kAppsFlyerAppId
...@@ -44,6 +34,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -44,6 +34,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#else #else
appsFlyer.isDebug = false appsFlyer.isDebug = false
#endif #endif
appsFlyer.start { [weak self] dictionary, error in
if let error = error {
self?.appsFlyerLog.error("AppsFlyer start error: \(error)")
}
else {
self?.appsFlyerLog.info("AppsFlyer start result: \(dictionary)")
}
}
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ThemeManager.refreshAppearance()
// WDT radar setup
SwarmManager.sharedManager.authentication = SkywiseAuthentication(
app_id: WDT_APP_ID,
app_key: WDT_APP_KEY
)
self.window = UIWindow(frame: UIScreen.main.bounds)
// Note that the Amazon SDK will get assigned a proper value for consent status inside CCPAHelper.onAppLaunch // 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 // So, make sure this call happens after the
...@@ -120,14 +130,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -120,14 +130,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(_ application: UIApplication) { func applicationDidBecomeActive(_ application: UIApplication) {
LocationManager.shared.updateEverythingIfNeeded() LocationManager.shared.updateEverythingIfNeeded()
appsFlyer.start { [weak self] dictionary, error in
if let error = error {
self?.appsFlyerLog.error("AppsFlyer start error: \(error)")
}
else {
self?.appsFlyerLog.info("AppsFlyer start result: \(dictionary)")
}
}
} }
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
......
...@@ -19,6 +19,7 @@ import CryptoKit ...@@ -19,6 +19,7 @@ import CryptoKit
import FBAudienceNetwork import FBAudienceNetwork
import PSMLocationSDK import PSMLocationSDK
import DTBiOSSDK import DTBiOSSDK
import AppsFlyerLib
fileprivate let APP_NAME = "ONE_WEATHER" fileprivate let APP_NAME = "ONE_WEATHER"
fileprivate let DEVICE_TYPE = "IOS" fileprivate let DEVICE_TYPE = "IOS"
...@@ -156,6 +157,12 @@ class CCPAHelper { ...@@ -156,6 +157,12 @@ class CCPAHelper {
// MoEngage // MoEngage
MoEngage.sharedInstance().optOut(ofDataTracking: !canCollectData) MoEngage.sharedInstance().optOut(ofDataTracking: !canCollectData)
AppsFlyerLib.shared().isStopped = !canCollectData
if canCollectData {
let appDelegate = UIApplication.shared.delegate as? AppDelegate
appDelegate?.initializeAppsFlyer()
}
} }
private func registerApp(reason: String) { private func registerApp(reason: String) {
......
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