diff --git a/SodaLive-dev.entitlements b/SodaLive-dev.entitlements index cc78b75..4ff4c63 100644 --- a/SodaLive-dev.entitlements +++ b/SodaLive-dev.entitlements @@ -5,6 +5,8 @@ aps-environment development com.apple.developer.associated-domains - + + applinks:voiceon-test.onelink.me + diff --git a/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6e55257..2bfd41b 100644 --- a/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "7e8c8a802e9b50376703e11841c54f22c1f47d510e9210bd5c4a9d52ea36c5db", + "originHash" : "e2b266c250e8dfef68a5b39f94cb7106349e1dc72b7b5f653706ce88e5d8bba3", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -46,6 +46,15 @@ "version" : "10.19.1" } }, + { + "identity" : "appsflyerframework-static", + "kind" : "remoteSourceControl", + "location" : "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Static", + "state" : { + "revision" : "2369fd501848792ec268dd47d3105bc42f9203da", + "version" : "6.16.1" + } + }, { "identity" : "facebook-ios-sdk", "kind" : "remoteSourceControl", diff --git a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist index 02df047..1b3130e 100644 --- a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist +++ b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist @@ -2,6 +2,33 @@ + NSAdvertisingAttributionReportEndpoint + https://appsflyer-skadnetwork.com/ + CFBundleURLTypes + + + CFBundleURLSchemes + + fb608674328645232 + + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + voiceon-test + + + + FacebookAppID + 608674328645232 + FacebookAutoLogAppEventsEnabled + + FacebookClientToken + 3775e6ea83236a685d264b6c5a1bbb4d + FacebookDisplayName + 보이스온 - Test1 FirebaseAppDelegateProxyEnabled GADApplicationIdentifier @@ -222,22 +249,5 @@ fetch remote-notification - CFBundleURLTypes - - - CFBundleURLSchemes - - fb608674328645232 - - - - FacebookAppID - 608674328645232 - FacebookClientToken - 3775e6ea83236a685d264b6c5a1bbb4d - FacebookDisplayName - 보이스온 - Test1 - FacebookAutoLogAppEventsEnabled - diff --git a/SodaLive/Resources/Info.plist b/SodaLive/Resources/Info.plist index 5da97b9..2cf3c09 100644 --- a/SodaLive/Resources/Info.plist +++ b/SodaLive/Resources/Info.plist @@ -2,6 +2,33 @@ + NSAdvertisingAttributionReportEndpoint + https://appsflyer-skadnetwork.com/ + CFBundleURLTypes + + + CFBundleURLSchemes + + fb612448298237287 + + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + voiceon + + + + FacebookAppID + 612448298237287 + FacebookAutoLogAppEventsEnabled + + FacebookClientToken + 32af760f4a7b7cb7e3b1e7ffd0b0da70 + FacebookDisplayName + 보이스온 FirebaseAppDelegateProxyEnabled GADApplicationIdentifier @@ -222,22 +249,5 @@ fetch remote-notification - CFBundleURLTypes - - - CFBundleURLSchemes - - fb612448298237287 - - - - FacebookAppID - 612448298237287 - FacebookClientToken - 32af760f4a7b7cb7e3b1e7ffd0b0da70 - FacebookDisplayName - 보이스온 - FacebookAutoLogAppEventsEnabled - diff --git a/SodaLive/SodaLive.entitlements b/SodaLive/SodaLive.entitlements index 72566a9..2eb4e93 100644 --- a/SodaLive/SodaLive.entitlements +++ b/SodaLive/SodaLive.entitlements @@ -6,7 +6,7 @@ development com.apple.developer.associated-domains - applinks:sodalive.page.link + applinks:voiceon.onelink.me diff --git a/SodaLive/Sources/App/AppDelegate.swift b/SodaLive/Sources/App/AppDelegate.swift index f4ae81a..8b205c9 100644 --- a/SodaLive/Sources/App/AppDelegate.swift +++ b/SodaLive/Sources/App/AppDelegate.swift @@ -7,6 +7,7 @@ import UIKit +import AppsFlyerLib import FBSDKCoreKit import FirebaseCore import FirebaseMessaging @@ -33,6 +34,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) AppEvents.shared.activateApp() + setupAppsFlyer() + return true } @@ -56,6 +59,65 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { } + + func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { + AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) + return true + } + + private func setupAppsFlyer() { + if let infoDic = Bundle.main.infoDictionary, let devKey = infoDic["AppsFlyerDevKey"] as? String, let appId = infoDic["AppsFlyerAppID"] as? String { + AppsFlyerLib.shared().appsFlyerDevKey = devKey + AppsFlyerLib.shared().appleAppID = appId + } else { + AppsFlyerLib.shared().appsFlyerDevKey = "tWF2wbJ5nSkya5Ru9mGcPU" + AppsFlyerLib.shared().appleAppID = "6461721697" + } + + AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60) + + AppsFlyerLib.shared().delegate = self + AppsFlyerLib.shared().deepLinkDelegate = self + } +} + +extension AppDelegate: AppsFlyerLibDelegate { + func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]) { + DEBUG_LOG("AppsFlyer Conversion Data: \(conversionInfo)") + } + + func onConversionDataFail(_ error: any Error) { + DEBUG_LOG("AppsFlyer Conversion Data Failed: \(error.localizedDescription)") + } +} + +extension AppDelegate: DeepLinkDelegate { + func didResolveDeepLink(_ result: DeepLinkResult) { + switch result.status { + case .notFound: + DEBUG_LOG("[AFSDK] Deep link not found") + return + case .failure: + DEBUG_LOG("Error \(result.error!)") + return + case .found: + DEBUG_LOG("[AFSDK] Deep link found") + } + + guard let deepLinkObj:DeepLink = result.deepLink else { + DEBUG_LOG("[AFSDK] Could not extract deep link object") + return + } + + if(deepLinkObj.isDeferred == true) { + DEBUG_LOG("[AFSDK] This is a deferred deep link") + } + else { + DEBUG_LOG("[AFSDK] This is a direct deep link") + } + + DEBUG_LOG("deepLinkValue: \(deepLinkObj.deeplinkValue ?? "")") + } } extension AppDelegate: MessagingDelegate { diff --git a/SodaLive/Sources/App/SodaLiveApp.swift b/SodaLive/Sources/App/SodaLiveApp.swift index fc6b650..70e47ef 100644 --- a/SodaLive/Sources/App/SodaLiveApp.swift +++ b/SodaLive/Sources/App/SodaLiveApp.swift @@ -9,6 +9,7 @@ import SwiftUI import AppTrackingTransparency import FBSDKCoreKit +import AppsFlyerLib @main struct SodaLiveApp: App { @@ -24,11 +25,13 @@ struct SodaLiveApp: App { .onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in UIApplication.shared.applicationIconBadgeNumber = 0 + AppsFlyerLib.shared().start() ATTrackingManager.requestTrackingAuthorization { _ in } } .onOpenURL { url in DEBUG_LOG("I have received a URL through a custom scheme! \(url.absoluteString)") ApplicationDelegate.shared.application(UIApplication.shared, open: url, options: [:]) + AppsFlyerLib.shared().handleOpen(url) } } }