diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenReceiveNewAnalyticsEvent.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenReceiveNewAnalyticsEvent.kt index 424ac7f642..cf752c7e38 100644 --- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenReceiveNewAnalyticsEvent.kt +++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenReceiveNewAnalyticsEvent.kt @@ -4,6 +4,7 @@ import com.tangem.core.analytics.models.AnalyticsEvent import com.tangem.core.analytics.models.AnalyticsParam import com.tangem.core.analytics.models.AnalyticsParam.Key.BLOCKCHAIN import com.tangem.core.analytics.models.AnalyticsParam.Key.ENS +import com.tangem.core.analytics.models.AnalyticsParam.Key.SOURCE import com.tangem.core.analytics.models.AnalyticsParam.Key.TOKEN_PARAM sealed class TokenReceiveNewAnalyticsEvent( @@ -27,11 +28,13 @@ sealed class TokenReceiveNewAnalyticsEvent( class ButtonCopyAddress( token: String, blockchainName: String, + tokenReceiveSource: TokenReceiveCopyActionSource, ) : TokenReceiveNewAnalyticsEvent( event = "Button - Copy Address", params = mapOf( TOKEN_PARAM to token, BLOCKCHAIN to blockchainName, + SOURCE to tokenReceiveSource.name, ), ) @@ -56,4 +59,8 @@ sealed class TokenReceiveNewAnalyticsEvent( BLOCKCHAIN to blockchainName, ), ) +} + +enum class TokenReceiveCopyActionSource { + Main, Token, Receive, QR } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticEvents.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticEvents.kt index c486cce7a4..acaf93aac4 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticEvents.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticEvents.kt @@ -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(), ), ) diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticHelper.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticHelper.kt index ad01b7a5c9..ab9490ce77 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticHelper.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/analytics/SendAnalyticHelper.kt @@ -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 - } - } } \ No newline at end of file diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveAssetsComponent.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveAssetsComponent.kt index 7ece6e356d..692e3ae990 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveAssetsComponent.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveAssetsComponent.kt @@ -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( diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveQrCodeComponent.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveQrCodeComponent.kt index 3eef391fc6..c33bcca97f 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveQrCodeComponent.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/component/TokenReceiveQrCodeComponent.kt @@ -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) } diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt index fb162c4c53..5790e3e692 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt @@ -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 field = MutableStateFlow( ReceiveAssetsUM( - onCopyClick = params.callback::onCopyClick, + onCopyClick = { + params.callback.onCopyClick( + id = it, + source = TokenReceiveCopyActionSource.Receive, + ) + }, onOpenQrCodeClick = params.callback::onQrCodeClick, addresses = params.addresses, showMemoDisclaimer = params.showMemoDisclaimer, diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt index 0c7e6de0bf..6ae1b86f6e 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt @@ -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 -> { diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt index 0a1f5ccddd..92bcd28bc0 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt @@ -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, ), ) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt index ddba4024a8..d0e4d0f29c 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt @@ -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) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt index 8e7103d993..e7876af2a1 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt @@ -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) {