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 {
case ANALYTICS_KEY_AD_ADAPTER = "AD_ADAPTER"
case ANALYTICS_KEY_PUSH_NOTIFICATION_SOURCE = "source"
case ANALYTICS_KEY_THEME_CHANGE_NAME = "themeName"
case ANALYTICS_KEY_FIST_OPEN_SOURCE = "Source"
}
......@@ -24,30 +24,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private let appsFlyerLog = Logger(componentName: "AppsFlyer")
private let log = Logger(componentName: "AppDelegate")
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)")
}
}
private enum FirstOpenSource: String {
case icon = "Icon"
case url = "Push Notification"
case pushNotification = "Share Deeplink"
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ThemeManager.refreshAppearance()
if let launchOptions = launchOptions {
log.debug("Launch options: \(launchOptions)")
}
else {
log.debug("Launch options: -")
}
// WDT radar setup
SwarmManager.sharedManager.authentication = SkywiseAuthentication(
app_id: WDT_APP_ID,
......@@ -60,7 +53,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// So, make sure this call happens after the
CCPAHelper.shared.onAppLaunch()
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()
}
......@@ -136,6 +137,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
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 {
......
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