Updated on 2026-08-14
This commit is contained in:
parent
99400590a6
commit
3b9107f73f
13 changed files with 111 additions and 1 deletions
|
|
@ -354,6 +354,7 @@ dependencies {
|
||||||
implementation(deps.coil.gif)
|
implementation(deps.coil.gif)
|
||||||
implementation(deps.coil.svg)
|
implementation(deps.coil.svg)
|
||||||
implementation(deps.amplitude)
|
implementation(deps.amplitude)
|
||||||
|
implementation(deps.appsflyer)
|
||||||
implementation(deps.spongecastle.core)
|
implementation(deps.spongecastle.core)
|
||||||
implementation(deps.lottie)
|
implementation(deps.lottie)
|
||||||
implementation(deps.compose.accompanist.appCompatTheme)
|
implementation(deps.compose.accompanist.appCompatTheme)
|
||||||
|
|
|
||||||
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
|
|
@ -213,3 +213,7 @@
|
||||||
-keep class **.R$* {
|
-keep class **.R$* {
|
||||||
<fields>;
|
<fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# appsflyer
|
||||||
|
-keep class com.appsflyer.** { *; }
|
||||||
|
-keep class kotlin.jvm.internal.** { *; }
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
<application
|
<application
|
||||||
android:name="com.tangem.tap.TangemHiltApplication"
|
android:name="com.tangem.tap.TangemHiltApplication"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:enableOnBackInvokedCallback="true"
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:fullBackupContent="false"
|
android:fullBackupContent="false"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
|
@ -45,7 +46,7 @@
|
||||||
android:roundIcon="@mipmap/ic_launcher"
|
android:roundIcon="@mipmap/ic_launcher"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning"
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
tools:replace="android:allowBackup, android:fullBackupContent, android:label, android:largeHeap">
|
tools:replace="android:allowBackup, android:dataExtractionRules, android:fullBackupContent, android:label, android:largeHeap">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
property to make the "android:screenOrientation" work on API <37
|
property to make the "android:screenOrientation" work on API <37
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ import com.tangem.tap.common.analytics.AnalyticsFactory
|
||||||
import com.tangem.tap.common.analytics.api.AnalyticsHandlerBuilder
|
import com.tangem.tap.common.analytics.api.AnalyticsHandlerBuilder
|
||||||
import com.tangem.tap.common.analytics.handlers.BlockchainExceptionHandler
|
import com.tangem.tap.common.analytics.handlers.BlockchainExceptionHandler
|
||||||
import com.tangem.tap.common.analytics.handlers.amplitude.AmplitudeAnalyticsHandler
|
import com.tangem.tap.common.analytics.handlers.amplitude.AmplitudeAnalyticsHandler
|
||||||
|
import com.tangem.tap.common.analytics.handlers.appsflyer.AppsFlyerAnalyticsHandler
|
||||||
import com.tangem.tap.common.analytics.handlers.firebase.FirebaseAnalyticsHandler
|
import com.tangem.tap.common.analytics.handlers.firebase.FirebaseAnalyticsHandler
|
||||||
import com.tangem.tap.common.images.createCoilImageLoader
|
import com.tangem.tap.common.images.createCoilImageLoader
|
||||||
import com.tangem.tap.common.log.TangemAppLoggerInitializer
|
import com.tangem.tap.common.log.TangemAppLoggerInitializer
|
||||||
|
|
@ -405,6 +406,7 @@ abstract class TangemApplication : Application(), ImageLoaderFactory, Configurat
|
||||||
val factory = AnalyticsFactory()
|
val factory = AnalyticsFactory()
|
||||||
factory.addHandlerBuilder(AmplitudeAnalyticsHandler.Builder())
|
factory.addHandlerBuilder(AmplitudeAnalyticsHandler.Builder())
|
||||||
factory.addHandlerBuilder(FirebaseAnalyticsHandler.Builder())
|
factory.addHandlerBuilder(FirebaseAnalyticsHandler.Builder())
|
||||||
|
factory.addHandlerBuilder(AppsFlyerAnalyticsHandler.Builder())
|
||||||
|
|
||||||
factory.addFilter(oneTimeEventFilter)
|
factory.addFilter(oneTimeEventFilter)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.tangem.tap.common.analytics.handlers.appsflyer
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.appsflyer.AppsFlyerLib
|
||||||
|
import com.tangem.core.analytics.api.EventLogger
|
||||||
|
|
||||||
|
interface AppsFlyerAnalyticsClient : EventLogger
|
||||||
|
|
||||||
|
internal class AppsFlyerClient(
|
||||||
|
private val context: Context,
|
||||||
|
key: String,
|
||||||
|
appId: String,
|
||||||
|
) : AppsFlyerAnalyticsClient {
|
||||||
|
|
||||||
|
private val appsFlyerLib: AppsFlyerLib = AppsFlyerLib.getInstance()
|
||||||
|
|
||||||
|
init {
|
||||||
|
appsFlyerLib.init(key, null, context)
|
||||||
|
appsFlyerLib.setAppId(appId)
|
||||||
|
appsFlyerLib.start(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun logEvent(event: String, params: Map<String, String>) {
|
||||||
|
appsFlyerLib.logEvent(context, event, params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.tangem.tap.common.analytics.handlers.appsflyer
|
||||||
|
|
||||||
|
import com.tangem.core.analytics.api.AnalyticsHandler
|
||||||
|
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||||
|
import com.tangem.tap.common.analytics.api.AnalyticsHandlerBuilder
|
||||||
|
|
||||||
|
class AppsFlyerAnalyticsHandler(
|
||||||
|
private val client: AppsFlyerAnalyticsClient,
|
||||||
|
) : AnalyticsHandler {
|
||||||
|
|
||||||
|
override fun id(): String = ID
|
||||||
|
|
||||||
|
override fun send(eventId: String, params: Map<String, String>) {
|
||||||
|
client.logEvent(eventId, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun send(event: AnalyticsEvent) {
|
||||||
|
super.send(event)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val ID = "AppsFlyer"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : AnalyticsHandlerBuilder {
|
||||||
|
override fun build(data: AnalyticsHandlerBuilder.Data): AnalyticsHandler? = when {
|
||||||
|
!data.isDebug -> AppsFlyerClient(data.application, data.config.appsFlyerApiKey, data.config.appsAppId)
|
||||||
|
data.isDebug && data.logConfig.appsflyer -> AppsFlyerLogClient(data.jsonConverter)
|
||||||
|
else -> null
|
||||||
|
}?.let { AppsFlyerAnalyticsHandler(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.tangem.tap.common.analytics.handlers.appsflyer
|
||||||
|
|
||||||
|
import com.tangem.common.json.MoshiJsonConverter
|
||||||
|
import com.tangem.tap.common.analytics.AnalyticsEventsLogger
|
||||||
|
|
||||||
|
internal class AppsFlyerLogClient(
|
||||||
|
jsonConverter: MoshiJsonConverter,
|
||||||
|
) : AppsFlyerAnalyticsClient {
|
||||||
|
|
||||||
|
private val logger = AnalyticsEventsLogger(AppsFlyerAnalyticsHandler.ID, jsonConverter)
|
||||||
|
|
||||||
|
override fun logEvent(event: String, params: Map<String, String>) {
|
||||||
|
logger.logEvent(event, params)
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/src/main/res/xml/data_extraction_rules.xml
Normal file
13
app/src/main/res/xml/data_extraction_rules.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<exclude
|
||||||
|
domain="sharedpref"
|
||||||
|
path="appsflyer-data" />
|
||||||
|
</cloud-backup>
|
||||||
|
<device-transfer>
|
||||||
|
<exclude
|
||||||
|
domain="sharedpref"
|
||||||
|
path="appsflyer-data" />
|
||||||
|
</device-transfer>
|
||||||
|
</data-extraction-rules>
|
||||||
|
|
@ -9,6 +9,8 @@ data class EnvironmentConfig(
|
||||||
val mercuryoWidgetId: String = "",
|
val mercuryoWidgetId: String = "",
|
||||||
val mercuryoSecret: String = "",
|
val mercuryoSecret: String = "",
|
||||||
val amplitudeApiKey: String = "",
|
val amplitudeApiKey: String = "",
|
||||||
|
val appsFlyerApiKey: String = "",
|
||||||
|
val appsAppId: String = "",
|
||||||
val blockchainSdkConfig: BlockchainSdkConfig = BlockchainSdkConfig(),
|
val blockchainSdkConfig: BlockchainSdkConfig = BlockchainSdkConfig(),
|
||||||
val walletConnectProjectId: String = "",
|
val walletConnectProjectId: String = "",
|
||||||
val express: ExpressModel? = null,
|
val express: ExpressModel? = null,
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ internal object EnvironmentConfigConverter : Converter<EnvironmentConfigModel, E
|
||||||
mercuryoSecret = value.mercuryoSecret,
|
mercuryoSecret = value.mercuryoSecret,
|
||||||
blockchainSdkConfig = BlockchainSDKConfigConverter.convert(value = value),
|
blockchainSdkConfig = BlockchainSDKConfigConverter.convert(value = value),
|
||||||
amplitudeApiKey = value.amplitudeApiKey,
|
amplitudeApiKey = value.amplitudeApiKey,
|
||||||
|
appsFlyerApiKey = value.appsFlyer.appsFlyerDevKey,
|
||||||
|
appsAppId = value.appsFlyer.appsFlyerAppID,
|
||||||
walletConnectProjectId = value.walletConnectProjectId,
|
walletConnectProjectId = value.walletConnectProjectId,
|
||||||
express = value.express,
|
express = value.express,
|
||||||
devExpress = value.devExpress,
|
devExpress = value.devExpress,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class EnvironmentConfigModel(
|
||||||
@Json(name = "infuraProjectId") val infuraProjectId: String?,
|
@Json(name = "infuraProjectId") val infuraProjectId: String?,
|
||||||
@Json(name = "tronGridApiKey") val tronGridApiKey: String,
|
@Json(name = "tronGridApiKey") val tronGridApiKey: String,
|
||||||
@Json(name = "amplitudeApiKey") val amplitudeApiKey: String,
|
@Json(name = "amplitudeApiKey") val amplitudeApiKey: String,
|
||||||
|
@Json(name = "appsFlyer") val appsFlyer: AppsFlyerModel,
|
||||||
@Json(name = "kaspaSecondaryApiUrl") val kaspaSecondaryApiUrl: String,
|
@Json(name = "kaspaSecondaryApiUrl") val kaspaSecondaryApiUrl: String,
|
||||||
@Json(name = "walletConnectProjectId") val walletConnectProjectId: String,
|
@Json(name = "walletConnectProjectId") val walletConnectProjectId: String,
|
||||||
@Json(name = "chiaFireAcademyApiKey") val chiaFireAcademyApiKey: String?,
|
@Json(name = "chiaFireAcademyApiKey") val chiaFireAcademyApiKey: String?,
|
||||||
|
|
@ -102,4 +103,12 @@ data class ExpressModel(
|
||||||
val apiKey: String,
|
val apiKey: String,
|
||||||
@Json(name = "signVerifierPublicKey")
|
@Json(name = "signVerifierPublicKey")
|
||||||
val signVerifierPublicKey: String,
|
val signVerifierPublicKey: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = true)
|
||||||
|
data class AppsFlyerModel(
|
||||||
|
@Json(name = "appsFlyerDevKey")
|
||||||
|
val appsFlyerDevKey: String,
|
||||||
|
@Json(name = "appsFlyerAppID")
|
||||||
|
val appsFlyerAppID: String,
|
||||||
)
|
)
|
||||||
|
|
@ -21,4 +21,5 @@ object NetworkLogConfig {
|
||||||
object AnalyticsHandlersLogConfig {
|
object AnalyticsHandlersLogConfig {
|
||||||
val firebase: Boolean = BuildConfig.LOG_ENABLED
|
val firebase: Boolean = BuildConfig.LOG_ENABLED
|
||||||
val amplitude: Boolean = BuildConfig.LOG_ENABLED
|
val amplitude: Boolean = BuildConfig.LOG_ENABLED
|
||||||
|
val appsflyer: Boolean = BuildConfig.LOG_ENABLED
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +46,7 @@ compose-lifecycle-runtime = "2.7.0"
|
||||||
# endregion Compose
|
# endregion Compose
|
||||||
|
|
||||||
# region Other libraries
|
# region Other libraries
|
||||||
|
appsflyer = "6.17.3"
|
||||||
amplitude = "2.36.1"
|
amplitude = "2.36.1"
|
||||||
armadillo = "0.9.0"
|
armadillo = "0.9.0"
|
||||||
coil = "2.1.0"
|
coil = "2.1.0"
|
||||||
|
|
@ -233,6 +234,7 @@ test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "orch
|
||||||
# endregion Test
|
# endregion Test
|
||||||
|
|
||||||
# region Other
|
# region Other
|
||||||
|
appsflyer = { module = "com.appsflyer:af-android-sdk", version.ref = "appsflyer" }
|
||||||
amplitude = { module = "com.amplitude:android-sdk", version.ref = "amplitude" }
|
amplitude = { module = "com.amplitude:android-sdk", version.ref = "amplitude" }
|
||||||
armadillo = { module = "at.favre.lib:armadillo", version.ref = "armadillo" }
|
armadillo = { module = "at.favre.lib:armadillo", version.ref = "armadillo" }
|
||||||
coil = { module = "io.coil-kt:coil", version.ref = "coil" }
|
coil = { module = "io.coil-kt:coil", version.ref = "coil" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue