From 6ecb1c9e24de2bfe2c5d59ceca149864c2e9837f Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 17 Jun 2024 12:29:06 +0200 Subject: [PATCH 01/16] WIP --- Aux/Radix-Wallet--iOS--Info.plist | 25 +++++++++++++++++ .../Features/AppFeature/App+View.swift | 4 +++ .../Features/AppFeature/AppDelegate.swift | 27 +++++++++++++++++++ .../DebugSettingsCoordinator+View.swift | 14 ++++++++++ 4 files changed, 70 insertions(+) diff --git a/Aux/Radix-Wallet--iOS--Info.plist b/Aux/Radix-Wallet--iOS--Info.plist index 018c289ac7..9df45aacf3 100644 --- a/Aux/Radix-Wallet--iOS--Info.plist +++ b/Aux/Radix-Wallet--iOS--Info.plist @@ -2,6 +2,31 @@ + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLIconFile + + CFBundleURLName + com.radixpublishing.radixwallet.ios.pre-alpha + CFBundleURLSchemes + + radixwallet + + + + CFBundleTypeRole + Editor + CFBundleURLName + com.radixpublishing.radixwallet.ios.dev + CFBundleURLSchemes + + radixwallet + + + ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/RadixWallet/Features/AppFeature/App+View.swift b/RadixWallet/Features/AppFeature/App+View.swift index 00b8c29284..8499d3ae26 100644 --- a/RadixWallet/Features/AppFeature/App+View.swift +++ b/RadixWallet/Features/AppFeature/App+View.swift @@ -41,6 +41,10 @@ extension App { .task { @MainActor in await store.send(.view(.task)).finish() } + .onOpenURL { url in + print("M- Url: \(url.absoluteString)") + DebugInfo.shared.add("onOpenUrl: \(url.absoluteString)") + } } } } diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index b6df8d74cf..ad6d5fbb91 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -1,6 +1,8 @@ +import AppsFlyerLib import ComposableArchitecture import SwiftUI +// MARK: - AppDelegate public final class AppDelegate: NSObject, UIApplicationDelegate { public func application( _ application: UIApplication, @@ -14,8 +16,33 @@ public final class AppDelegate: NSObject, UIApplicationDelegate { public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { @Dependency(\.appsFlyerClient) var appsFlyerClient + + AppsFlyerLib.shared().delegate = self + AppsFlyerLib.shared().deepLinkDelegate = self + appsFlyerClient.start() return true } } + +// MARK: AppsFlyerLibDelegate +extension AppDelegate: AppsFlyerLibDelegate { + public func onConversionDataSuccess(_ conversionInfo: [AnyHashable: Any]) { + // Invoked when conversion data resolution succeeds + DebugInfo.shared.add("onConversionDataSuccess \(conversionInfo)") + } + + public func onConversionDataFail(_ error: any Error) { + // Invoked when conversion data resolution fails + DebugInfo.shared.add("onConversionDataFail") + } +} + +// MARK: DeepLinkDelegate +extension AppDelegate: DeepLinkDelegate { + public func didResolveDeepLink(_ result: DeepLinkResult) { + print("M- did resolve deep link: \(String(describing: result.deepLink))") + DebugInfo.shared.add("did resolve deep link: \(String(describing: result.deepLink))") + } +} diff --git a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift index f12b2d6970..5e5f30e232 100644 --- a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift +++ b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift @@ -1,6 +1,19 @@ import ComposableArchitecture import SwiftUI +// MARK: - DebugInfo +class DebugInfo { + static let shared = DebugInfo() + + private(set) var content = "" + private init() {} + + func add(_ msg: String) { + content.append(msg) + content.append("\n") + } +} + // MARK: - DebugSettingsCoordinator.View extension DebugSettingsCoordinator { public struct ViewState: Equatable {} @@ -19,6 +32,7 @@ extension DebugSettingsCoordinator.View { public var body: some View { ScrollView { VStack(spacing: .zero) { + Text(DebugInfo.shared.content) ForEachStatic(rows) { kind in SettingsRow(kind: kind, store: store) } From 3dd05cdd56c9aedf8667565a5f1cfdc7f5b27e04 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 17 Jun 2024 12:38:29 +0200 Subject: [PATCH 02/16] Update fastfile desc --- fastlane/Fastfile | 2 +- fastlane/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 636b960866..a6c525af26 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -97,7 +97,7 @@ platform :ios do end desc "Installs distribution certificates" - desc "Usage `bundle exec fastlane ios install_distribution_certificate --env ios.`" + desc "Usage `bundle exec fastlane ios install_distribution_certificates --env ios.`" lane :install_distribution_certificates do code_signing(type: "appstore") end diff --git a/fastlane/README.md b/fastlane/README.md index bb5963b630..7003ec4773 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -73,7 +73,7 @@ Archive and export the iOS app Installs distribution certificates -Usage `bundle exec fastlane ios install_distribution_certificate --env ios.` +Usage `bundle exec fastlane ios install_distribution_certificates --env ios.` ### ios install_development_certificates From 4cd4fb81dfcfb66f5845673c58d7f13d789447bd Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 17 Jun 2024 16:10:03 +0200 Subject: [PATCH 03/16] Add debug info on Home --- RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift b/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift index 9dff733956..97e0ef9b12 100644 --- a/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift +++ b/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift @@ -50,6 +50,7 @@ extension Home { } VStack(spacing: .medium3) { + Text(DebugInfo.shared.content) ForEachStore( store.scope( state: \.accountRows, From fc1d9f0a943efb7d476152c2ec0025b0ce189f69 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 17 Jun 2024 16:59:22 +0200 Subject: [PATCH 04/16] print error to resolve deeplink --- RadixWallet/Features/AppFeature/AppDelegate.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index ad6d5fbb91..ae342ea383 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -42,7 +42,10 @@ extension AppDelegate: AppsFlyerLibDelegate { // MARK: DeepLinkDelegate extension AppDelegate: DeepLinkDelegate { public func didResolveDeepLink(_ result: DeepLinkResult) { - print("M- did resolve deep link: \(String(describing: result.deepLink))") - DebugInfo.shared.add("did resolve deep link: \(String(describing: result.deepLink))") + if let deepLink = result.deepLink { + DebugInfo.shared.add("did resolve deep link: \(deepLink)") + } else { + DebugInfo.shared.add("fail to resolve deep link: \(result.error?.localizedDescription ?? "no error")") + } } } From 68aefebae03c41f395398df74507375d8f2870a7 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 17 Jun 2024 18:44:30 +0200 Subject: [PATCH 05/16] More logic and helper methods --- .../AppsFlyerClient+Live.swift | 9 +++ .../Features/AppFeature/App+View.swift | 9 ++- .../Features/AppFeature/AppDelegate.swift | 6 +- .../Startup/OnboardingStartup+View.swift | 67 ++++++++++--------- .../DebugSettingsCoordinator+View.swift | 3 +- RadixWallet/RadixWalletDebug-Dev.entitlements | 4 ++ .../RadixWalletDebug-PreAlpha.entitlements | 4 ++ 7 files changed, 63 insertions(+), 39 deletions(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index a1eacf94da..0c7662673e 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -1,5 +1,6 @@ import AppsFlyerLib +// MARK: - AppsFlyerClient + DependencyKey extension AppsFlyerClient: DependencyKey { static var liveValue: AppsFlyerClient { @Dependency(\.sensitiveInfoClient) var sensitiveInfoClient @@ -24,3 +25,11 @@ extension AppsFlyerClient: DependencyKey { ) } } + +extension URL { + // TODO: Implement better solution + var isAppsFlyerUrl: Bool { + guard let host = host() else { return false } + return host.contains("onelink.me") + } +} diff --git a/RadixWallet/Features/AppFeature/App+View.swift b/RadixWallet/Features/AppFeature/App+View.swift index 8499d3ae26..2f06f9d583 100644 --- a/RadixWallet/Features/AppFeature/App+View.swift +++ b/RadixWallet/Features/AppFeature/App+View.swift @@ -1,3 +1,4 @@ +import AppsFlyerLib import ComposableArchitecture import SwiftUI @@ -42,8 +43,12 @@ extension App { await store.send(.view(.task)).finish() } .onOpenURL { url in - print("M- Url: \(url.absoluteString)") - DebugInfo.shared.add("onOpenUrl: \(url.absoluteString)") + if url.isAppsFlyerUrl { + DebugInfo.shared.add("Will resolve url with AF") + AppsFlyerLib.shared().handleOpen(url) + } else { + // Handle deeplinks that don't come from AppsFlyer + } } } } diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index ae342ea383..27afe29a55 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -43,9 +43,9 @@ extension AppDelegate: AppsFlyerLibDelegate { extension AppDelegate: DeepLinkDelegate { public func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { - DebugInfo.shared.add("did resolve deep link: \(deepLink)") - } else { - DebugInfo.shared.add("fail to resolve deep link: \(result.error?.localizedDescription ?? "no error")") + DebugInfo.shared.add("did resolve deep link: \(deepLink)\nClick events: \(deepLink.clickEvent)") + } else if let error = result.error { + DebugInfo.shared.add("fail to resolve deep link: \(error.localizedDescription)") } } } diff --git a/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift b/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift index ead5939bf4..5888eb6d3f 100644 --- a/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift +++ b/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift @@ -17,39 +17,42 @@ extension OnboardingStartup { extension OnboardingStartup.View { public var body: some View { NavigationStack { - WithViewStore(store, observe: { $0 }, send: { .view($0) }) { viewStore in - VStack(spacing: 0) { - Text(L10n.Onboarding.Step1.title) - .foregroundColor(.app.gray1) - .textStyle(.sheetTitle) - .padding(.top, .large1) - .padding(.horizontal, .large1) - .padding(.bottom, .medium3) - - Text(L10n.Onboarding.Step1.subtitle) - .foregroundColor(.app.gray2) - .textStyle(.secondaryHeader) - .padding(.horizontal, .huge3) - - Spacer(minLength: 0) - - SplashGraphic() - - Spacer(minLength: 0) - } - .multilineTextAlignment(.center) - .footer { - Button(L10n.Onboarding.newUser) { - viewStore.send(.selectedNewWalletUser) - } - .buttonStyle(.primaryRectangular) - .padding(.bottom, .small2) - - Button(L10n.Onboarding.restoreFromBackup) { - viewStore.send(.selectedRestoreFromBackup) - } - .buttonStyle(.primaryText()) + WithViewStore(store, observe: { $0 }, send: { .view($0) }) { _ in + ScrollView { + Text(DebugInfo.shared.content) } +// VStack(spacing: 0) { +// Text(L10n.Onboarding.Step1.title) +// .foregroundColor(.app.gray1) +// .textStyle(.sheetTitle) +// .padding(.top, .large1) +// .padding(.horizontal, .large1) +// .padding(.bottom, .medium3) +// +// Text(L10n.Onboarding.Step1.subtitle) +// .foregroundColor(.app.gray2) +// .textStyle(.secondaryHeader) +// .padding(.horizontal, .huge3) +// +// Spacer(minLength: 0) +// +// SplashGraphic() +// +// Spacer(minLength: 0) +// } +// .multilineTextAlignment(.center) +// .footer { +// Button(L10n.Onboarding.newUser) { +// viewStore.send(.selectedNewWalletUser) +// } +// .buttonStyle(.primaryRectangular) +// .padding(.bottom, .small2) +// +// Button(L10n.Onboarding.restoreFromBackup) { +// viewStore.send(.selectedRestoreFromBackup) +// } +// .buttonStyle(.primaryText()) +// } } .destinations(with: store) } diff --git a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift index 5e5f30e232..98bf6b0cfd 100644 --- a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift +++ b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift @@ -9,8 +9,7 @@ class DebugInfo { private init() {} func add(_ msg: String) { - content.append(msg) - content.append("\n") + content.append("\nšŸ†• \(msg)") } } diff --git a/RadixWallet/RadixWalletDebug-Dev.entitlements b/RadixWallet/RadixWalletDebug-Dev.entitlements index f59455673f..ee59082e66 100644 --- a/RadixWallet/RadixWalletDebug-Dev.entitlements +++ b/RadixWallet/RadixWalletDebug-Dev.entitlements @@ -4,6 +4,10 @@ aps-environment development + com.apple.developer.associated-domains + + applinks:radixdlt.onelink.me + com.apple.developer.icloud-container-identifiers iCloud.com.radixpublishing.radixwallet.ios.dev diff --git a/RadixWallet/RadixWalletDebug-PreAlpha.entitlements b/RadixWallet/RadixWalletDebug-PreAlpha.entitlements index 53b195b1a6..a5db9181b7 100644 --- a/RadixWallet/RadixWalletDebug-PreAlpha.entitlements +++ b/RadixWallet/RadixWalletDebug-PreAlpha.entitlements @@ -4,6 +4,10 @@ aps-environment development + com.apple.developer.associated-domains + + applinks:radixdlt.onelink.me + com.apple.developer.icloud-container-identifiers iCloud.com.radixpublishing.radixwallet.ios.pre-alpha From dfdbb9ab1b8f31f2cc34d6f657afd53a9ed35be1 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Tue, 18 Jun 2024 12:26:52 +0200 Subject: [PATCH 06/16] Add appdelegate methods --- RadixWallet/Features/AppFeature/AppDelegate.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index 27afe29a55..f0f0d26ed6 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -24,6 +24,17 @@ public final class AppDelegate: NSObject, UIApplicationDelegate { return true } + + public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { + AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) + return true + } + + public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + DebugInfo.shared.add("app open \(url.absoluteString)") + AppsFlyerLib.shared().handleOpen(url, options: options) + return true + } } // MARK: AppsFlyerLibDelegate From 36dddeb1ec1386a1d058ec027d34ea11df9e0b71 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Tue, 18 Jun 2024 12:33:58 +0200 Subject: [PATCH 07/16] Add more logs --- RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift | 1 + RadixWallet/Features/AppFeature/AppDelegate.swift | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 0c7662673e..3a160acba7 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -20,6 +20,7 @@ extension AppsFlyerClient: DependencyKey { AppsFlyerLib.shared().isDebug = true #endif + DebugInfo.shared.add("AppsFlyerLib started") AppsFlyerLib.shared().start() } ) diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index f0f0d26ed6..9cfc4cc950 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -26,12 +26,13 @@ public final class AppDelegate: NSObject, UIApplicationDelegate { } public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { + DebugInfo.shared.add("AppsFlyerLib.continue called") AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) return true } public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { - DebugInfo.shared.add("app open \(url.absoluteString)") + DebugInfo.shared.add("AppsFlyierLib.handleOpen called \(url.absoluteString)") AppsFlyerLib.shared().handleOpen(url, options: options) return true } From bf795498aa2ac190bbab44ad41767170efac3af6 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Tue, 18 Jun 2024 12:40:45 +0200 Subject: [PATCH 08/16] Enable AF logs always --- .../Clients/AppsFlyerClient/AppsFlyerClient+Live.swift | 5 +++-- RadixWallet/Features/AppFeature/AppDelegate.swift | 8 +++++++- .../Coordinator/DebugSettingsCoordinator+View.swift | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 3a160acba7..8d3d261d59 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -11,14 +11,15 @@ extension AppsFlyerClient: DependencyKey { let devKey = sensitiveInfoClient.read(.appsFlyerDevKey), let appId = sensitiveInfoClient.read(.appsFlyerAppId) else { + loggerGlobal.info("Skipping AppsFlyer start as keys are missing") return } AppsFlyerLib.shared().appsFlyerDevKey = devKey AppsFlyerLib.shared().appleAppID = appId - #if DEBUG +// #if DEBUG AppsFlyerLib.shared().isDebug = true - #endif +// #endif DebugInfo.shared.add("AppsFlyerLib started") AppsFlyerLib.shared().start() diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index 9cfc4cc950..2c72a81f97 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -36,6 +36,12 @@ public final class AppDelegate: NSObject, UIApplicationDelegate { AppsFlyerLib.shared().handleOpen(url, options: options) return true } + + public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { + DebugInfo.shared.add("AppsFlyierLib.handleOpen called \(url.absoluteString)") + AppsFlyerLib.shared().handleOpen(url, sourceApplication: sourceApplication, withAnnotation: annotation) + return true + } } // MARK: AppsFlyerLibDelegate @@ -57,7 +63,7 @@ extension AppDelegate: DeepLinkDelegate { if let deepLink = result.deepLink { DebugInfo.shared.add("did resolve deep link: \(deepLink)\nClick events: \(deepLink.clickEvent)") } else if let error = result.error { - DebugInfo.shared.add("fail to resolve deep link: \(error.localizedDescription)") + DebugInfo.shared.add("fail to resolve deep link. Status: \(result.status), Error: \(error)") } } } diff --git a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift index 98bf6b0cfd..e236d9c442 100644 --- a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift +++ b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift @@ -10,6 +10,7 @@ class DebugInfo { func add(_ msg: String) { content.append("\nšŸ†• \(msg)") + loggerGlobal.info("šŸ†• \(msg)") } } From 1627ece0f40dea33d3b7c483b18ccd3d6255587c Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Tue, 18 Jun 2024 18:52:55 +0200 Subject: [PATCH 09/16] Remove entitlments tto support universal links and URL schemet --- Aux/Radix-Wallet--iOS--Info.plist | 25 ------------------- .../AppsFlyerClient+Live.swift | 8 ------ .../Features/AppFeature/App+View.swift | 9 ------- .../Features/AppFeature/SceneDelegate.swift | 15 +++++++++++ RadixWallet/RadixWalletDebug-Dev.entitlements | 4 --- .../RadixWalletDebug-PreAlpha.entitlements | 4 --- 6 files changed, 15 insertions(+), 50 deletions(-) diff --git a/Aux/Radix-Wallet--iOS--Info.plist b/Aux/Radix-Wallet--iOS--Info.plist index 9df45aacf3..018c289ac7 100644 --- a/Aux/Radix-Wallet--iOS--Info.plist +++ b/Aux/Radix-Wallet--iOS--Info.plist @@ -2,31 +2,6 @@ - CFBundleURLTypes - - - CFBundleTypeRole - Editor - CFBundleURLIconFile - - CFBundleURLName - com.radixpublishing.radixwallet.ios.pre-alpha - CFBundleURLSchemes - - radixwallet - - - - CFBundleTypeRole - Editor - CFBundleURLName - com.radixpublishing.radixwallet.ios.dev - CFBundleURLSchemes - - radixwallet - - - ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 8d3d261d59..24714b7a53 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -27,11 +27,3 @@ extension AppsFlyerClient: DependencyKey { ) } } - -extension URL { - // TODO: Implement better solution - var isAppsFlyerUrl: Bool { - guard let host = host() else { return false } - return host.contains("onelink.me") - } -} diff --git a/RadixWallet/Features/AppFeature/App+View.swift b/RadixWallet/Features/AppFeature/App+View.swift index 2f06f9d583..00b8c29284 100644 --- a/RadixWallet/Features/AppFeature/App+View.swift +++ b/RadixWallet/Features/AppFeature/App+View.swift @@ -1,4 +1,3 @@ -import AppsFlyerLib import ComposableArchitecture import SwiftUI @@ -42,14 +41,6 @@ extension App { .task { @MainActor in await store.send(.view(.task)).finish() } - .onOpenURL { url in - if url.isAppsFlyerUrl { - DebugInfo.shared.add("Will resolve url with AF") - AppsFlyerLib.shared().handleOpen(url) - } else { - // Handle deeplinks that don't come from AppsFlyer - } - } } } } diff --git a/RadixWallet/Features/AppFeature/SceneDelegate.swift b/RadixWallet/Features/AppFeature/SceneDelegate.swift index 78fd242de6..d586b1c47b 100644 --- a/RadixWallet/Features/AppFeature/SceneDelegate.swift +++ b/RadixWallet/Features/AppFeature/SceneDelegate.swift @@ -1,3 +1,4 @@ +import AppsFlyerLib import ComposableArchitecture import SwiftUI @@ -20,6 +21,20 @@ public final class SceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObj } } + public func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { + DebugInfo.shared.add("[SceneDelegate] AppsFlyerLib.continue called") + AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) + } + + public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { + if let url = URLContexts.first?.url { + DebugInfo.shared.add("[SceneDelegate] AppsFlyierLib.handleOpen called \(url.absoluteString)") + AppsFlyerLib.shared().handleOpen(url) + } else { + DebugInfo.shared.add("[SceneDelegate] openURLContexts without url") + } + } + func overlayWindow(in scene: UIWindowScene) { let overlayView = OverlayReducer.View( store: .init( diff --git a/RadixWallet/RadixWalletDebug-Dev.entitlements b/RadixWallet/RadixWalletDebug-Dev.entitlements index ee59082e66..f59455673f 100644 --- a/RadixWallet/RadixWalletDebug-Dev.entitlements +++ b/RadixWallet/RadixWalletDebug-Dev.entitlements @@ -4,10 +4,6 @@ aps-environment development - com.apple.developer.associated-domains - - applinks:radixdlt.onelink.me - com.apple.developer.icloud-container-identifiers iCloud.com.radixpublishing.radixwallet.ios.dev diff --git a/RadixWallet/RadixWalletDebug-PreAlpha.entitlements b/RadixWallet/RadixWalletDebug-PreAlpha.entitlements index a5db9181b7..53b195b1a6 100644 --- a/RadixWallet/RadixWalletDebug-PreAlpha.entitlements +++ b/RadixWallet/RadixWalletDebug-PreAlpha.entitlements @@ -4,10 +4,6 @@ aps-environment development - com.apple.developer.associated-domains - - applinks:radixdlt.onelink.me - com.apple.developer.icloud-container-identifiers iCloud.com.radixpublishing.radixwallet.ios.pre-alpha From bc1012c2f04f5c5e76383b04a3ab00b7737d6e6f Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 10:41:27 +0200 Subject: [PATCH 10/16] Working version for onConversionDataSuccess --- RadixWallet/Features/AppFeature/AppDelegate.swift | 2 +- RadixWallet/Features/AppFeature/SceneDelegate.swift | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index 2c72a81f97..80eeaea3b6 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -61,7 +61,7 @@ extension AppDelegate: AppsFlyerLibDelegate { extension AppDelegate: DeepLinkDelegate { public func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { - DebugInfo.shared.add("did resolve deep link: \(deepLink)\nClick events: \(deepLink.clickEvent)") + DebugInfo.shared.add("did resolve deep link: \(deepLink). Is deferred: \(deepLink.isDeferred)\nClick events: \(deepLink.clickEvent)") } else if let error = result.error { DebugInfo.shared.add("fail to resolve deep link. Status: \(result.status), Error: \(error)") } diff --git a/RadixWallet/Features/AppFeature/SceneDelegate.swift b/RadixWallet/Features/AppFeature/SceneDelegate.swift index d586b1c47b..cd9fdab496 100644 --- a/RadixWallet/Features/AppFeature/SceneDelegate.swift +++ b/RadixWallet/Features/AppFeature/SceneDelegate.swift @@ -12,6 +12,13 @@ public final class SceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObj options connectionOptions: UIScene.ConnectionOptions ) { windowScene = scene as? UIWindowScene + + if let userActivity = connectionOptions.userActivities.first { + AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) + } else if let url = connectionOptions.urlContexts.first?.url { + AppsFlyerLib.shared().handleOpen(url, options: nil) + } + if let windowScene, // avoids unimplemented("OverlayWindowClient.isUserInteractionEnabled") From 67c3c7c94d8272237b33eb637eea90cbedcc74d1 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 12:13:52 +0200 Subject: [PATCH 11/16] Working version for defferred deep links --- .../AppsFlyerClient+Interface.swift | 10 ++++ .../AppsFlyerClient+Live.swift | 25 ++++++++-- .../Features/AppFeature/AppDelegate.swift | 47 ++----------------- .../Features/AppFeature/SceneDelegate.swift | 13 +---- 4 files changed, 37 insertions(+), 58 deletions(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Interface.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Interface.swift index 966062c118..4f36078f82 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Interface.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Interface.swift @@ -1,11 +1,21 @@ // MARK: - AppsFlyerClient struct AppsFlyerClient: Sendable { + /// Method to be called once on app start. var start: Start + + /// Method to be called every time the `AppDelegate`/`SceneDelegate` is called to continue + /// with a user activity. + /// + /// Note: such methods aren't actually called right now on neither of those classes. However, given AppsFlyer documentation + /// indicates that we should delegate the call to their lib (so that it can resolves deferred deep links), I am adding support for it + /// in case the situation changes in the future. + var `continue`: Continue } // MARK: AppsFlyerClient.Start extension AppsFlyerClient { typealias Start = @Sendable () -> Void + typealias Continue = @Sendable (NSUserActivity) -> Void } extension DependencyValues { diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 24714b7a53..9566e3db50 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -4,6 +4,11 @@ import AppsFlyerLib extension AppsFlyerClient: DependencyKey { static var liveValue: AppsFlyerClient { @Dependency(\.sensitiveInfoClient) var sensitiveInfoClient + let state = State() + + actor State { + let delegate = Delegate() + } return .init( start: { @@ -17,13 +22,27 @@ extension AppsFlyerClient: DependencyKey { AppsFlyerLib.shared().appsFlyerDevKey = devKey AppsFlyerLib.shared().appleAppID = appId -// #if DEBUG + AppsFlyerLib.shared().deepLinkDelegate = state.delegate + + #if DEBUG AppsFlyerLib.shared().isDebug = true -// #endif + #endif - DebugInfo.shared.add("AppsFlyerLib started") AppsFlyerLib.shared().start() + }, + continue: { userActivity in + AppsFlyerLib.shared().continue(userActivity) } ) } + + private class Delegate: NSObject, DeepLinkDelegate, @unchecked Sendable { + func didResolveDeepLink(_ result: DeepLinkResult) { + if let deepLink = result.deepLink { + print("M- did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") + } else if let error = result.error { + print("M- failed to resolve deep link. Status: \(result.status), Error: \(error)") + } + } + } } diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index 80eeaea3b6..1e18cbed34 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -4,6 +4,8 @@ import SwiftUI // MARK: - AppDelegate public final class AppDelegate: NSObject, UIApplicationDelegate { + @Dependency(\.appsFlyerClient) var appsFlyerClient + public func application( _ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, @@ -15,55 +17,12 @@ public final class AppDelegate: NSObject, UIApplicationDelegate { } public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - @Dependency(\.appsFlyerClient) var appsFlyerClient - - AppsFlyerLib.shared().delegate = self - AppsFlyerLib.shared().deepLinkDelegate = self - appsFlyerClient.start() - return true } public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { - DebugInfo.shared.add("AppsFlyerLib.continue called") - AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) - return true - } - - public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { - DebugInfo.shared.add("AppsFlyierLib.handleOpen called \(url.absoluteString)") - AppsFlyerLib.shared().handleOpen(url, options: options) - return true - } - - public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { - DebugInfo.shared.add("AppsFlyierLib.handleOpen called \(url.absoluteString)") - AppsFlyerLib.shared().handleOpen(url, sourceApplication: sourceApplication, withAnnotation: annotation) + appsFlyerClient.continue(userActivity) return true } } - -// MARK: AppsFlyerLibDelegate -extension AppDelegate: AppsFlyerLibDelegate { - public func onConversionDataSuccess(_ conversionInfo: [AnyHashable: Any]) { - // Invoked when conversion data resolution succeeds - DebugInfo.shared.add("onConversionDataSuccess \(conversionInfo)") - } - - public func onConversionDataFail(_ error: any Error) { - // Invoked when conversion data resolution fails - DebugInfo.shared.add("onConversionDataFail") - } -} - -// MARK: DeepLinkDelegate -extension AppDelegate: DeepLinkDelegate { - public func didResolveDeepLink(_ result: DeepLinkResult) { - if let deepLink = result.deepLink { - DebugInfo.shared.add("did resolve deep link: \(deepLink). Is deferred: \(deepLink.isDeferred)\nClick events: \(deepLink.clickEvent)") - } else if let error = result.error { - DebugInfo.shared.add("fail to resolve deep link. Status: \(result.status), Error: \(error)") - } - } -} diff --git a/RadixWallet/Features/AppFeature/SceneDelegate.swift b/RadixWallet/Features/AppFeature/SceneDelegate.swift index cd9fdab496..bdf527b466 100644 --- a/RadixWallet/Features/AppFeature/SceneDelegate.swift +++ b/RadixWallet/Features/AppFeature/SceneDelegate.swift @@ -29,17 +29,8 @@ public final class SceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObj } public func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { - DebugInfo.shared.add("[SceneDelegate] AppsFlyerLib.continue called") - AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) - } - - public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { - if let url = URLContexts.first?.url { - DebugInfo.shared.add("[SceneDelegate] AppsFlyierLib.handleOpen called \(url.absoluteString)") - AppsFlyerLib.shared().handleOpen(url) - } else { - DebugInfo.shared.add("[SceneDelegate] openURLContexts without url") - } + @Dependency(\.appsFlyerClient) var appsFlyerClient + appsFlyerClient.continue(userActivity) } func overlayWindow(in scene: UIWindowScene) { From 7cf7dd215980a5284145e59f6e811919672c0a4e Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 14:45:29 +0200 Subject: [PATCH 12/16] Lint --- .../AppsFlyerClient+Live.swift | 4 +- .../Features/AppFeature/AppDelegate.swift | 1 - .../Features/AppFeature/SceneDelegate.swift | 7 -- .../HomeFeature/Coordinator/Home+View.swift | 1 - .../Startup/OnboardingStartup+View.swift | 67 +++++++++---------- .../DebugSettingsCoordinator+View.swift | 14 ---- 6 files changed, 34 insertions(+), 60 deletions(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 9566e3db50..0b90d60d73 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -39,9 +39,9 @@ extension AppsFlyerClient: DependencyKey { private class Delegate: NSObject, DeepLinkDelegate, @unchecked Sendable { func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { - print("M- did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") + loggerGlobal.info("did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") } else if let error = result.error { - print("M- failed to resolve deep link. Status: \(result.status), Error: \(error)") + loggerGlobal.info("failed to resolve deep link. Status: \(result.status), Error: \(error.localizedDescription)") } } } diff --git a/RadixWallet/Features/AppFeature/AppDelegate.swift b/RadixWallet/Features/AppFeature/AppDelegate.swift index 1e18cbed34..4d49989af0 100644 --- a/RadixWallet/Features/AppFeature/AppDelegate.swift +++ b/RadixWallet/Features/AppFeature/AppDelegate.swift @@ -1,4 +1,3 @@ -import AppsFlyerLib import ComposableArchitecture import SwiftUI diff --git a/RadixWallet/Features/AppFeature/SceneDelegate.swift b/RadixWallet/Features/AppFeature/SceneDelegate.swift index bdf527b466..ae1e62ce12 100644 --- a/RadixWallet/Features/AppFeature/SceneDelegate.swift +++ b/RadixWallet/Features/AppFeature/SceneDelegate.swift @@ -1,4 +1,3 @@ -import AppsFlyerLib import ComposableArchitecture import SwiftUI @@ -13,12 +12,6 @@ public final class SceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObj ) { windowScene = scene as? UIWindowScene - if let userActivity = connectionOptions.userActivities.first { - AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil) - } else if let url = connectionOptions.urlContexts.first?.url { - AppsFlyerLib.shared().handleOpen(url, options: nil) - } - if let windowScene, // avoids unimplemented("OverlayWindowClient.isUserInteractionEnabled") diff --git a/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift b/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift index 97e0ef9b12..9dff733956 100644 --- a/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift +++ b/RadixWallet/Features/HomeFeature/Coordinator/Home+View.swift @@ -50,7 +50,6 @@ extension Home { } VStack(spacing: .medium3) { - Text(DebugInfo.shared.content) ForEachStore( store.scope( state: \.accountRows, diff --git a/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift b/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift index 5888eb6d3f..ead5939bf4 100644 --- a/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift +++ b/RadixWallet/Features/OnboardingFeature/Children/Startup/OnboardingStartup+View.swift @@ -17,42 +17,39 @@ extension OnboardingStartup { extension OnboardingStartup.View { public var body: some View { NavigationStack { - WithViewStore(store, observe: { $0 }, send: { .view($0) }) { _ in - ScrollView { - Text(DebugInfo.shared.content) + WithViewStore(store, observe: { $0 }, send: { .view($0) }) { viewStore in + VStack(spacing: 0) { + Text(L10n.Onboarding.Step1.title) + .foregroundColor(.app.gray1) + .textStyle(.sheetTitle) + .padding(.top, .large1) + .padding(.horizontal, .large1) + .padding(.bottom, .medium3) + + Text(L10n.Onboarding.Step1.subtitle) + .foregroundColor(.app.gray2) + .textStyle(.secondaryHeader) + .padding(.horizontal, .huge3) + + Spacer(minLength: 0) + + SplashGraphic() + + Spacer(minLength: 0) + } + .multilineTextAlignment(.center) + .footer { + Button(L10n.Onboarding.newUser) { + viewStore.send(.selectedNewWalletUser) + } + .buttonStyle(.primaryRectangular) + .padding(.bottom, .small2) + + Button(L10n.Onboarding.restoreFromBackup) { + viewStore.send(.selectedRestoreFromBackup) + } + .buttonStyle(.primaryText()) } -// VStack(spacing: 0) { -// Text(L10n.Onboarding.Step1.title) -// .foregroundColor(.app.gray1) -// .textStyle(.sheetTitle) -// .padding(.top, .large1) -// .padding(.horizontal, .large1) -// .padding(.bottom, .medium3) -// -// Text(L10n.Onboarding.Step1.subtitle) -// .foregroundColor(.app.gray2) -// .textStyle(.secondaryHeader) -// .padding(.horizontal, .huge3) -// -// Spacer(minLength: 0) -// -// SplashGraphic() -// -// Spacer(minLength: 0) -// } -// .multilineTextAlignment(.center) -// .footer { -// Button(L10n.Onboarding.newUser) { -// viewStore.send(.selectedNewWalletUser) -// } -// .buttonStyle(.primaryRectangular) -// .padding(.bottom, .small2) -// -// Button(L10n.Onboarding.restoreFromBackup) { -// viewStore.send(.selectedRestoreFromBackup) -// } -// .buttonStyle(.primaryText()) -// } } .destinations(with: store) } diff --git a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift index e236d9c442..f12b2d6970 100644 --- a/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift +++ b/RadixWallet/Features/SettingsFeature/DebugSettings/Coordinator/DebugSettingsCoordinator+View.swift @@ -1,19 +1,6 @@ import ComposableArchitecture import SwiftUI -// MARK: - DebugInfo -class DebugInfo { - static let shared = DebugInfo() - - private(set) var content = "" - private init() {} - - func add(_ msg: String) { - content.append("\nšŸ†• \(msg)") - loggerGlobal.info("šŸ†• \(msg)") - } -} - // MARK: - DebugSettingsCoordinator.View extension DebugSettingsCoordinator { public struct ViewState: Equatable {} @@ -32,7 +19,6 @@ extension DebugSettingsCoordinator.View { public var body: some View { ScrollView { VStack(spacing: .zero) { - Text(DebugInfo.shared.content) ForEachStatic(rows) { kind in SettingsRow(kind: kind, store: store) } From fe7c0c3b074e1d7ef289d4cb8f6375be26983891 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 15:18:38 +0200 Subject: [PATCH 13/16] Lint --- RadixWallet/Features/AppFeature/SceneDelegate.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/RadixWallet/Features/AppFeature/SceneDelegate.swift b/RadixWallet/Features/AppFeature/SceneDelegate.swift index ae1e62ce12..e71e29aea0 100644 --- a/RadixWallet/Features/AppFeature/SceneDelegate.swift +++ b/RadixWallet/Features/AppFeature/SceneDelegate.swift @@ -11,7 +11,6 @@ public final class SceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObj options connectionOptions: UIScene.ConnectionOptions ) { windowScene = scene as? UIWindowScene - if let windowScene, // avoids unimplemented("OverlayWindowClient.isUserInteractionEnabled") From 05fc60efbfaa99c9a5582f43490fd0f035f3407f Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 16:40:58 +0200 Subject: [PATCH 14/16] Add conversionDataSuccess --- .../AppsFlyerClient/AppsFlyerClient+Live.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 0b90d60d73..94828387b1 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -23,6 +23,7 @@ extension AppsFlyerClient: DependencyKey { AppsFlyerLib.shared().appleAppID = appId AppsFlyerLib.shared().deepLinkDelegate = state.delegate + AppsFlyerLib.shared().delegate = state.delegate #if DEBUG AppsFlyerLib.shared().isDebug = true @@ -36,7 +37,15 @@ extension AppsFlyerClient: DependencyKey { ) } - private class Delegate: NSObject, DeepLinkDelegate, @unchecked Sendable { + private class Delegate: NSObject, DeepLinkDelegate, AppsFlyerLibDelegate, @unchecked Sendable { + func onConversionDataSuccess(_ conversionInfo: [AnyHashable: Any]) { + loggerGlobal.info("onConversionDataSuccess \(conversionInfo)") + } + + func onConversionDataFail(_ error: any Error) { + loggerGlobal.info("onConversionDataFail \(error.localizedDescription)") + } + func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { loggerGlobal.info("did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") From 914c225a6f69a4aa2fef78a3bb1031daee787e59 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Wed, 19 Jun 2024 16:42:31 +0200 Subject: [PATCH 15/16] Revert "Add conversionDataSuccess" This reverts commit 05fc60efbfaa99c9a5582f43490fd0f035f3407f. --- .../AppsFlyerClient/AppsFlyerClient+Live.swift | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 94828387b1..0b90d60d73 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -23,7 +23,6 @@ extension AppsFlyerClient: DependencyKey { AppsFlyerLib.shared().appleAppID = appId AppsFlyerLib.shared().deepLinkDelegate = state.delegate - AppsFlyerLib.shared().delegate = state.delegate #if DEBUG AppsFlyerLib.shared().isDebug = true @@ -37,15 +36,7 @@ extension AppsFlyerClient: DependencyKey { ) } - private class Delegate: NSObject, DeepLinkDelegate, AppsFlyerLibDelegate, @unchecked Sendable { - func onConversionDataSuccess(_ conversionInfo: [AnyHashable: Any]) { - loggerGlobal.info("onConversionDataSuccess \(conversionInfo)") - } - - func onConversionDataFail(_ error: any Error) { - loggerGlobal.info("onConversionDataFail \(error.localizedDescription)") - } - + private class Delegate: NSObject, DeepLinkDelegate, @unchecked Sendable { func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { loggerGlobal.info("did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") From 1a1961d5287274e1e7ff4abe07039201585b1135 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Fri, 28 Jun 2024 12:56:16 +0200 Subject: [PATCH 16/16] Track event when resolving deferred DL --- .../Clients/AppsFlyerClient/AppsFlyerClient+Live.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift index 0b90d60d73..1628b8999f 100644 --- a/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift +++ b/RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift @@ -40,6 +40,14 @@ extension AppsFlyerClient: DependencyKey { func didResolveDeepLink(_ result: DeepLinkResult) { if let deepLink = result.deepLink { loggerGlobal.info("did resolve deep link. Is deferred: \(deepLink.isDeferred). Click events: \(deepLink.clickEvent)") + if deepLink.isDeferred { + let message = if let deepLinkValue = deepLink.clickEvent["deep_link_value"] as? String { + "Resolved deferred DL with value \(deepLinkValue)" + } else { + "Resolved deferred DL without value" + } + AppsFlyerLib.shared().logEvent(message, withValues: deepLink.clickEvent) + } } else if let error = result.error { loggerGlobal.info("failed to resolve deep link. Status: \(result.status), Error: \(error.localizedDescription)") }