Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-28 16:11:48 +02:00
parent a374c65a4e
commit ad6d1d5b1e
10 changed files with 57 additions and 30 deletions

View file

@ -24,7 +24,6 @@ internal sealed class SendAnalyticEvents(
val feeType: AnalyticsParam.FeeType,
val blockchain: String,
val nonceNotEmpty: Boolean,
private val ensStatus: AnalyticsParam.EnsStatus,
) : SendAnalyticEvents(
event = "Transaction Sent Screen Opened",
params = mapOf(
@ -32,10 +31,7 @@ internal sealed class SendAnalyticEvents(
FEE_TYPE to feeType.value,
BLOCKCHAIN to blockchain,
NONCE to nonceNotEmpty.toString().capitalize(),
ENS_ADDRESS to when (ensStatus) {
AnalyticsParam.EnsStatus.EMPTY -> false.toString()
AnalyticsParam.EnsStatus.FULL -> true.toString()
},
ENS_ADDRESS to (blockchain == "Ethereum").toString(),
),
)

View file

@ -28,7 +28,6 @@ internal class SendAnalyticHelper @Inject constructor(
feeType = feeType,
blockchain = cryptoCurrency.network.name,
nonceNotEmpty = feeSelectorUM.nonce != null,
ensStatus = getEnsStatus(sendUM),
),
)
analyticsEventHandler.send(
@ -53,14 +52,4 @@ internal class SendAnalyticHelper @Inject constructor(
else -> Basic.TransactionSent.MemoType.Null
}
}
private fun getEnsStatus(sendUM: SendUM): AnalyticsParam.EnsStatus {
val blockchainAddressForEns =
(sendUM.destinationUM as? DestinationUM.Content)?.addressTextField?.blockchainAddress
return if (blockchainAddressForEns != null) {
AnalyticsParam.EnsStatus.FULL
} else {
AnalyticsParam.EnsStatus.EMPTY
}
}
}

View file

@ -8,6 +8,7 @@ import com.tangem.common.ui.notifications.NotificationUM
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.features.tokenreceive.entity.ReceiveAddress
import com.tangem.features.tokenreceive.model.TokenReceiveAssetsModel
import com.tangem.features.tokenreceive.ui.TokenReceiveAssetsContent
@ -29,7 +30,7 @@ internal class TokenReceiveAssetsComponent(
internal interface TokenReceiveAssetsModelCallback {
fun onQrCodeClick(id: Int)
fun onCopyClick(id: Int)
fun onCopyClick(id: Int, source: TokenReceiveCopyActionSource)
}
data class TokenReceiveAssetsParams(

View file

@ -8,6 +8,7 @@ import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.features.tokenreceive.entity.ReceiveAddress
import com.tangem.features.tokenreceive.model.TokenReceiveQrCodeModel
import com.tangem.features.tokenreceive.ui.TokenReceiveQrCodeContent
@ -26,7 +27,7 @@ internal class TokenReceiveQrCodeComponent(
}
internal interface TokenReceiveQrCodeModelCallback {
fun onCopyClick(id: Int)
fun onCopyClick(id: Int, source: TokenReceiveCopyActionSource)
fun onShareClick(address: String)
}

View file

@ -6,6 +6,7 @@ import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.domain.tokens.model.analytics.TokenReceiveNewAnalyticsEvent
import com.tangem.features.tokenreceive.component.TokenReceiveAssetsComponent
import com.tangem.features.tokenreceive.entity.ReceiveAddress
@ -38,7 +39,12 @@ internal class TokenReceiveAssetsModel @Inject constructor(
internal val state: StateFlow<ReceiveAssetsUM>
field = MutableStateFlow<ReceiveAssetsUM>(
ReceiveAssetsUM(
onCopyClick = params.callback::onCopyClick,
onCopyClick = {
params.callback.onCopyClick(
id = it,
source = TokenReceiveCopyActionSource.Receive,
)
},
onOpenQrCodeClick = params.callback::onQrCodeClick,
addresses = params.addresses,
showMemoDisclaimer = params.showMemoDisclaimer,

View file

@ -20,6 +20,7 @@ import com.tangem.domain.models.ReceiveAddressModel
import com.tangem.domain.models.ens.EnsAddress
import com.tangem.domain.models.network.Network
import com.tangem.domain.tokens.SaveViewedTokenReceiveWarningUseCase
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.domain.tokens.model.analytics.TokenReceiveNewAnalyticsEvent
import com.tangem.domain.transaction.usecase.GetReverseResolvedEnsAddressUseCase
import com.tangem.features.tokenreceive.TokenReceiveComponent
@ -76,9 +77,9 @@ internal class TokenReceiveModel @Inject constructor(
stackNavigation.push(configuration = TokenReceiveRoutes.QrCode(addressId = id))
}
override fun onCopyClick(id: Int) {
override fun onCopyClick(id: Int, source: TokenReceiveCopyActionSource) {
val addressToCopy = state.value.addresses[id] ?: return
sendCopyActionAnalytic(addressToCopy)
sendCopyActionAnalytic(addressToCopy, source)
clipboardManager.setText(text = addressToCopy.value, isSensitive = true)
}
@ -228,12 +229,13 @@ internal class TokenReceiveModel @Inject constructor(
)
}
private fun sendCopyActionAnalytic(receiveAddress: ReceiveAddress) {
private fun sendCopyActionAnalytic(receiveAddress: ReceiveAddress, source: TokenReceiveCopyActionSource) {
val event = when (receiveAddress.type) {
is Primary -> {
TokenReceiveNewAnalyticsEvent.ButtonCopyAddress(
token = getTokenName(),
blockchainName = params.config.cryptoCurrency.network.name,
tokenReceiveSource = source,
)
}
Ens -> {

View file

@ -5,6 +5,7 @@ import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.features.tokenreceive.component.TokenReceiveQrCodeComponent
import com.tangem.features.tokenreceive.ui.state.QrCodeUM
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
@ -27,7 +28,12 @@ internal class TokenReceiveQrCodeModel @Inject constructor(
network = params.cryptoCurrency.network.name,
addressValue = params.address.value,
addressName = TextReference.Str("${params.cryptoCurrency.name} (${params.cryptoCurrency.symbol})"),
onCopyClick = { params.callback.onCopyClick(params.id) },
onCopyClick = {
params.callback.onCopyClick(
id = params.id,
source = TokenReceiveCopyActionSource.QR,
)
},
onShareClick = params.callback::onShareClick,
),
)

View file

@ -58,6 +58,8 @@ import com.tangem.domain.tokens.legacy.TradeCryptoAction
import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason
import com.tangem.domain.tokens.model.TokenActionsState
import com.tangem.domain.tokens.model.analytics.TokenReceiveAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.domain.tokens.model.analytics.TokenReceiveNewAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent.Companion.toReasonAnalyticsText
import com.tangem.domain.tokens.model.analytics.TokenSwapPromoAnalyticsEvent
@ -876,7 +878,13 @@ internal class TokenDetailsModel @Inject constructor(
vibratorHapticManager.performOneTime(TangemHapticEffect.OneTime.Click)
clipboardManager.setText(text = defaultAddress, isSensitive = true)
analyticsEventsHandler.send(TokenReceiveAnalyticsEvent.ButtonCopyAddress(cryptoCurrency.symbol))
analyticsEventsHandler.send(
TokenReceiveNewAnalyticsEvent.ButtonCopyAddress(
token = cryptoCurrency.symbol,
blockchainName = cryptoCurrency.network.name,
tokenReceiveSource = TokenReceiveCopyActionSource.Token,
),
)
return resourceReference(R.string.wallet_notification_address_copied)
}

View file

@ -49,6 +49,8 @@ import com.tangem.domain.tokens.RemoveCurrencyUseCase
import com.tangem.domain.tokens.legacy.TradeCryptoAction
import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason
import com.tangem.domain.tokens.model.analytics.TokenReceiveAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenReceiveCopyActionSource
import com.tangem.domain.tokens.model.analytics.TokenReceiveNewAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent.Companion.AVAILABLE
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent.Companion.toReasonAnalyticsText
@ -174,10 +176,6 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor(
),
)
analyticsEventHandler.send(
event = TokenReceiveAnalyticsEvent.ReceiveScreenOpened(cryptoCurrencyStatus.currency.symbol),
)
event?.let { analyticsEventHandler.send(it) }
if (tokenReceiveFeatureToggle.isNewTokenReceiveEnabled) {
@ -188,6 +186,9 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor(
}
}
} else {
analyticsEventHandler.send(
event = TokenReceiveAnalyticsEvent.ReceiveScreenOpened(cryptoCurrencyStatus.currency.symbol),
)
stateHolder.showBottomSheet(
createReceiveBottomSheetContent(
currency = cryptoCurrencyStatus.currency,
@ -206,7 +207,13 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor(
vibratorHapticManager.performOneTime(TangemHapticEffect.OneTime.Click)
clipboardManager.setText(text = defaultAddress, isSensitive = true)
analyticsEventHandler.send(TokenReceiveAnalyticsEvent.ButtonCopyAddress(cryptoCurrency.symbol))
analyticsEventHandler.send(
TokenReceiveNewAnalyticsEvent.ButtonCopyAddress(
token = cryptoCurrency.symbol,
blockchainName = cryptoCurrency.network.name,
tokenReceiveSource = TokenReceiveCopyActionSource.Main,
),
)
return resourceReference(R.string.wallet_notification_address_copied)
}
@ -235,7 +242,11 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor(
override fun onCopyAddressClick(cryptoCurrencyStatus: CryptoCurrencyStatus) {
analyticsEventHandler.send(
event = TokenScreenAnalyticsEvent.ButtonCopyAddress(cryptoCurrencyStatus.currency.symbol),
event = TokenReceiveNewAnalyticsEvent.ButtonCopyAddress(
token = cryptoCurrencyStatus.currency.symbol,
blockchainName = cryptoCurrencyStatus.currency.network.name,
tokenReceiveSource = TokenReceiveCopyActionSource.Main,
),
)
modelScope.launch(dispatchers.main) {