Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-15 14:59:31 +07:00
parent b316ef4d87
commit 370690a359
42 changed files with 486 additions and 35 deletions

View file

@ -88,10 +88,17 @@ internal class DefaultSendComponent @AssistedInject constructor(
componentScope.launch {
when (val activeComponent = stack.active.instance) {
is SendConfirmComponent -> {
val fromCurrency = params.currency
val fromDerivationIndex = model.accountFlow.value?.derivationIndex?.value
.takeIf { model.isAccountModeFlow.value }
analyticsEventHandler.send(
CommonSendAnalyticEvents.ConfirmationScreenOpened(
categoryName = model.analyticCategoryName,
source = model.analyticsSendSource,
sendBlockchain = fromCurrency.network.name,
sendToken = fromCurrency.symbol,
fromDerivationIndex = fromDerivationIndex,
toDerivationIndex = null,
),
)
if (model.currentRoute.value.isEditMode) {

View file

@ -2,6 +2,7 @@ package com.tangem.features.send.v2.send.analytics
import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.analytics.models.AnalyticsParam.Key.ACCOUNT_DERIVATION_FROM
import com.tangem.core.analytics.models.AnalyticsParam.Key.BLOCKCHAIN
import com.tangem.core.analytics.models.AnalyticsParam.Key.ENS_ADDRESS
import com.tangem.core.analytics.models.AnalyticsParam.Key.FEE_TYPE
@ -25,18 +26,21 @@ internal sealed class SendAnalyticEvents(
val blockchain: String,
val isNonceNotEmpty: Boolean,
private val ensStatus: AnalyticsParam.EmptyFull,
val derivationIndex: Int?,
) : SendAnalyticEvents(
event = "Transaction Sent Screen Opened",
params = mapOf(
TOKEN_PARAM to token,
FEE_TYPE to feeType.value,
BLOCKCHAIN to blockchain,
NONCE to isNonceNotEmpty.toString().capitalize(),
ENS_ADDRESS to when (ensStatus) {
params = buildMap {
put(TOKEN_PARAM, token)
put(FEE_TYPE, feeType.value)
put(BLOCKCHAIN, blockchain)
if (derivationIndex != null) put(ACCOUNT_DERIVATION_FROM, derivationIndex.toString())
put(NONCE, isNonceNotEmpty.toString().capitalize())
val ensAddress = when (ensStatus) {
AnalyticsParam.EmptyFull.Empty -> false.toString().capitalize()
AnalyticsParam.EmptyFull.Full -> true.toString().capitalize()
},
),
}
put(ENS_ADDRESS, ensAddress)
},
)
data class ConvertTokenButtonClicked(

View file

@ -4,6 +4,7 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.analytics.models.Basic
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.features.send.v2.api.entity.FeeNonce
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
@ -17,10 +18,12 @@ internal class SendAnalyticHelper @Inject constructor(
private val analyticsEventHandler: AnalyticsEventHandler,
) {
fun sendSuccessAnalytics(cryptoCurrency: CryptoCurrency, sendUM: SendUM) {
fun sendSuccessAnalytics(cryptoCurrency: CryptoCurrency, sendUM: SendUM, account: Account.CryptoPortfolio?) {
val destinationUM = sendUM.destinationUM as? DestinationUM.Content
val feeSelectorUM = sendUM.feeSelectorUM as? FeeSelectorUM.Content ?: return
val feeType = feeSelectorUM.toAnalyticType()
val isNotMainAccount = account != null && !account.isMainAccount
val derivationIndex = if (isNotMainAccount) account.derivationIndex.value else null
analyticsEventHandler.send(
SendAnalyticEvents.TransactionScreenOpened(
token = cryptoCurrency.symbol,
@ -28,6 +31,7 @@ internal class SendAnalyticHelper @Inject constructor(
blockchain = cryptoCurrency.network.name,
isNonceNotEmpty = feeSelectorUM.feeNonce is FeeNonce.Nonce,
ensStatus = getEnsStatus(sendUM),
derivationIndex = derivationIndex,
),
)
analyticsEventHandler.send(

View file

@ -416,7 +416,11 @@ internal class SendConfirmModel @Inject constructor(
updateTransactionStatus(txData)
addTokenToWalletIfNeeded()
sendBalanceUpdater.scheduleUpdates()
sendAnalyticHelper.sendSuccessAnalytics(cryptoCurrency, uiState.value)
sendAnalyticHelper.sendSuccessAnalytics(
cryptoCurrency = cryptoCurrency,
sendUM = uiState.value,
account = params.accountFlow.value,
)
params.callback.onResult(uiState.value)
params.onSendTransaction()
},

View file

@ -79,10 +79,17 @@ internal class DefaultNFTSendComponent @AssistedInject constructor(
componentScope.launch {
when (val activeComponent = stack.active.instance) {
is NFTSendConfirmComponent -> {
val fromCurrency = model.cryptoCurrency
val fromDerivationIndex = model.account?.derivationIndex?.value
.takeIf { model.isAccountsMode }
analyticsEventHandler.send(
CommonSendAnalyticEvents.ConfirmationScreenOpened(
categoryName = analyticsCategoryName,
source = analyticsSendSource,
sendBlockchain = fromCurrency.network.name,
sendToken = fromCurrency.symbol,
fromDerivationIndex = fromDerivationIndex,
toDerivationIndex = null,
),
)
if (model.currentRouteFlow.value.isEditMode) {