-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ABW-2735] AppsFlyer integration (#1073)
Co-authored-by: Duje Begonja RDX <108268552+duje-begonja-rdx@users.noreply.github.com>
- Loading branch information
1 parent
9523d0e
commit 6a66d1a
Showing
13 changed files
with
245 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>APPS_FLYER_APP_ID</key> | ||
<string>placeholder</string> | ||
<key>APPS_FLYER_DEV_KEY</key> | ||
<string>placeholder</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Interface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// MARK: - AppsFlyerClient | ||
struct AppsFlyerClient: Sendable { | ||
var start: Start | ||
} | ||
|
||
// MARK: AppsFlyerClient.Start | ||
extension AppsFlyerClient { | ||
typealias Start = @Sendable () -> Void | ||
} | ||
|
||
extension DependencyValues { | ||
var appsFlyerClient: AppsFlyerClient { | ||
get { self[AppsFlyerClient.self] } | ||
set { self[AppsFlyerClient.self] = newValue } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
RadixWallet/Clients/AppsFlyerClient/AppsFlyerClient+Live.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import AppsFlyerLib | ||
|
||
extension AppsFlyerClient: DependencyKey { | ||
static var liveValue: AppsFlyerClient { | ||
@Dependency(\.sensitiveInfoClient) var sensitiveInfoClient | ||
|
||
return .init( | ||
start: { | ||
guard | ||
let devKey = sensitiveInfoClient.read(.appsFlyerDevKey), | ||
let appId = sensitiveInfoClient.read(.appsFlyerAppId) | ||
else { | ||
return | ||
} | ||
AppsFlyerLib.shared().appsFlyerDevKey = devKey | ||
AppsFlyerLib.shared().appleAppID = appId | ||
|
||
#if DEBUG | ||
AppsFlyerLib.shared().isDebug = true | ||
#endif | ||
|
||
AppsFlyerLib.shared().start() | ||
} | ||
) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
RadixWallet/Clients/SensitiveInfoClient/SensitiveInfoClient+Interface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// MARK: - SensitiveInfoClient | ||
struct SensitiveInfoClient: Sendable { | ||
var read: Read | ||
} | ||
|
||
// MARK: SensitiveInfoClient.Read | ||
extension SensitiveInfoClient { | ||
typealias Read = @Sendable (_ key: Key) -> String? | ||
} | ||
|
||
extension DependencyValues { | ||
var sensitiveInfoClient: SensitiveInfoClient { | ||
get { self[SensitiveInfoClient.self] } | ||
set { self[SensitiveInfoClient.self] = newValue } | ||
} | ||
} | ||
|
||
// MARK: - SensitiveInfoClient.Key | ||
extension SensitiveInfoClient { | ||
enum Key: String { | ||
case appsFlyerAppId = "APPS_FLYER_APP_ID" | ||
case appsFlyerDevKey = "APPS_FLYER_DEV_KEY" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
RadixWallet/Clients/SensitiveInfoClient/SensitiveInfoClient+Live.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extension SensitiveInfoClient: DependencyKey { | ||
static var liveValue: SensitiveInfoClient { | ||
.init( | ||
read: { key in | ||
guard let filePath = Bundle.main.path(forResource: "SensitiveInfo", ofType: "plist") else { | ||
assertionFailure("Couldn't find file 'SensitiveInfo.plist'") | ||
return nil | ||
} | ||
let plist = NSDictionary(contentsOfFile: filePath) | ||
guard let value = plist?.object(forKey: key.rawValue) as? String else { | ||
assertionFailure("Couldn't find value for key '\(key.rawValue)' in 'SensitiveInfo.plist'.") | ||
return nil | ||
} | ||
if value.starts(with: "placeholder") { | ||
loggerGlobal.warning("Please set up your sensitive info tokens in 'SensitiveInfo.plist'") | ||
} | ||
return value | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.