Commit 1cc18a84 by Demid Merzlyakov

Merge branch 'feature/IOS-74-apps-flyer' into develop

parents 64065d75 aa68175d
...@@ -20,4 +20,5 @@ public enum AnalyticsParameter: String { ...@@ -20,4 +20,5 @@ public enum AnalyticsParameter: String {
case ANALYTICS_KEY_AD_ADAPTER = "AD_ADAPTER" case ANALYTICS_KEY_AD_ADAPTER = "AD_ADAPTER"
case ANALYTICS_KEY_PUSH_NOTIFICATION_SOURCE = "source" case ANALYTICS_KEY_PUSH_NOTIFICATION_SOURCE = "source"
case ANALYTICS_KEY_THEME_CHANGE_NAME = "themeName" case ANALYTICS_KEY_THEME_CHANGE_NAME = "themeName"
case ANALYTICS_KEY_FIST_OPEN_SOURCE = "Source"
} }
...@@ -24,30 +24,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -24,30 +24,23 @@ 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 initializeAppsFlyer() { private enum FirstOpenSource: String {
appsFlyerLog.info("AppsFlyer initialize with AppsFlyerId: \(kAppsFlyerId), Apple App ID: \(kAppsFlyerAppId)") case icon = "Icon"
appsFlyer.appsFlyerDevKey = kAppsFlyerId case url = "Push Notification"
appsFlyer.appleAppID = kAppsFlyerAppId case pushNotification = "Share Deeplink"
appsFlyer.delegate = self
appsFlyer.deepLinkDelegate = self
#if DEBUG
appsFlyer.isDebug = true
#else
appsFlyer.isDebug = false
#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 { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ThemeManager.refreshAppearance() ThemeManager.refreshAppearance()
if let launchOptions = launchOptions {
log.debug("Launch options: \(launchOptions)")
}
else {
log.debug("Launch options: -")
}
// WDT radar setup // WDT radar setup
SwarmManager.sharedManager.authentication = SkywiseAuthentication( SwarmManager.sharedManager.authentication = SkywiseAuthentication(
app_id: WDT_APP_ID, app_id: WDT_APP_ID,
...@@ -60,7 +53,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -60,7 +53,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// So, make sure this call happens after the // So, make sure this call happens after the
CCPAHelper.shared.onAppLaunch() CCPAHelper.shared.onAppLaunch()
if CCPAHelper.shared.isNewUser && Settings.shared.firstOpenDate == nil { if CCPAHelper.shared.isNewUser && Settings.shared.firstOpenDate == nil {
analytics(log: .ANALYTICS_FIRST_OPEN) var firstOpenSource = FirstOpenSource.icon
if launchOptions?[.remoteNotification] != nil {
firstOpenSource = .pushNotification
}
else if launchOptions?[.url] != nil {
firstOpenSource = .url
}
analytics(log: .ANALYTICS_FIRST_OPEN, params: [.ANALYTICS_KEY_FIST_OPEN_SOURCE: firstOpenSource.rawValue])
Settings.shared.firstOpenDate = Date() Settings.shared.firstOpenDate = Date()
} }
...@@ -136,6 +137,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -136,6 +137,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
PushNotificationsManager.shared.set(pushToken: deviceToken) PushNotificationsManager.shared.set(pushToken: deviceToken)
} }
func initializeAppsFlyer() {
appsFlyerLog.info("AppsFlyer initialize with AppsFlyerId: \(kAppsFlyerId), Apple App ID: \(kAppsFlyerAppId)")
appsFlyer.appsFlyerDevKey = kAppsFlyerId
appsFlyer.appleAppID = kAppsFlyerAppId
appsFlyer.delegate = self
appsFlyer.deepLinkDelegate = self
#if DEBUG
appsFlyer.isDebug = true
#else
appsFlyer.isDebug = false
#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)")
}
}
}
} }
extension AppDelegate: AppsFlyerLibDelegate { extension AppDelegate: AppsFlyerLibDelegate {
......
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