Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-04 15:36:48 +03:00
commit 46c3f635f9
4 changed files with 25 additions and 12 deletions

View file

@ -2,16 +2,17 @@ package com.tangem.tap.common.analytics.handlers.appsflyer
import android.content.Context
import com.appsflyer.AppsFlyerLib
import com.appsflyer.attribution.AppsFlyerRequestListener
import com.tangem.core.analytics.api.EventLogger
import com.tangem.core.analytics.api.UserIdHolder
import com.tangem.tap.common.analytics.handlers.firebase.UnderscoreAnalyticsEventConverter
import timber.log.Timber
interface AppsFlyerAnalyticsClient : EventLogger, UserIdHolder
internal class AppsFlyerClient(
private val context: Context,
key: String,
appId: String,
) : AppsFlyerAnalyticsClient {
private val appsFlyerLib: AppsFlyerLib = AppsFlyerLib.getInstance()
@ -19,8 +20,15 @@ internal class AppsFlyerClient(
init {
appsFlyerLib.init(key, null, context)
appsFlyerLib.setAppId(appId)
appsFlyerLib.start(context)
appsFlyerLib.start(context, key, object : AppsFlyerRequestListener {
override fun onSuccess() {
Timber.d("AppsFlyer initialized successfully")
}
override fun onError(p0: Int, p1: String) {
Timber.e("AppsFlyer initialization error: $p0, $p1")
}
})
}
override fun setUserId(userId: String) {

View file

@ -40,10 +40,12 @@ class AppsFlyerAnalyticsHandler(
}
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.isAppsflyerLogEnabled -> AppsFlyerLogClient(data.jsonConverter)
else -> null
}?.let { AppsFlyerAnalyticsHandler(it) }
override fun build(data: AnalyticsHandlerBuilder.Data): AnalyticsHandler = AppsFlyerAnalyticsHandler(
client = if (data.logConfig.isAppsflyerLogEnabled) {
AppsFlyerLogClient(data.jsonConverter)
} else {
AppsFlyerClient(data.application, data.config.appsFlyerApiKey)
},
)
}
}

View file

@ -10,6 +10,7 @@ import com.tangem.domain.pay.repository.OnboardingRepository
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.features.tangempay.TangemPayFeatureToggles
import com.tangem.hot.sdk.model.HotWalletId
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.collectLatest
@ -87,7 +88,7 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
private fun UserWallet.isCompatible(): Boolean = when (this) {
is UserWallet.Cold ->
scanResponse.card.firmwareVersion >= FirmwareVersion.HDWalletAvailable
is UserWallet.Hot -> true
is UserWallet.Hot -> hotWalletId.authType != HotWalletId.AuthType.NoPassword
}
private suspend fun List<UserWallet>.addPaeraCustomersData(): List<UserWalletData> {

View file

@ -116,9 +116,11 @@ internal class AskBiometryModel @Inject constructor(
walletsRepository.setUseBiometricAuthentication(value = true)
walletsRepository.setRequireAccessCode(value = false)
setBiometryLockForAllWallets()
cardSdkConfigRepository.setAccessCodeRequestPolicy(
isBiometricsRequestPolicy = walletsRepository.requireAccessCode().not(),
)
if (userWallet is UserWallet.Cold) {
cardSdkConfigRepository.setAccessCodeRequestPolicy(
isBiometricsRequestPolicy = userWallet.hasAccessCode,
)
}
} else {
settingsRepository.setShouldSaveAccessCodes(value = true)
if (userWallet is UserWallet.Cold) {