Updated on 2026-08-14
This commit is contained in:
parent
978d7c1da4
commit
03691635a2
2 changed files with 46 additions and 0 deletions
|
|
@ -40,6 +40,27 @@ internal sealed class SendWithSwapAnalyticEvents(
|
|||
},
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
data class OnSendClick(
|
||||
val providerName: String,
|
||||
val feeType: AnalyticsParam.FeeType,
|
||||
val fromToken: CryptoCurrency,
|
||||
val toToken: CryptoCurrency,
|
||||
val fromDerivationIndex: Int?,
|
||||
val toDerivationIndex: Int?,
|
||||
) : SendWithSwapAnalyticEvents(
|
||||
event = "Button - Send with Swap",
|
||||
params = buildMap {
|
||||
put(PROVIDER, providerName)
|
||||
put(FEE_TYPE, if (feeType is AnalyticsParam.FeeType.Normal) "Market" else "Fast")
|
||||
put(SEND_TOKEN, fromToken.symbol)
|
||||
put(RECEIVE_TOKEN, toToken.symbol)
|
||||
put(SEND_BLOCKCHAIN, fromToken.network.name)
|
||||
put(RECEIVE_BLOCKCHAIN, toToken.network.name)
|
||||
if (fromDerivationIndex != null) put(ACCOUNT_DERIVATION_FROM, fromDerivationIndex.toString())
|
||||
if (toDerivationIndex != null) put(ACCOUNT_DERIVATION_TO, toDerivationIndex.toString())
|
||||
},
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
data class NoticeCanNotSwapToken(
|
||||
val fromToken: CryptoCurrency,
|
||||
val toTokenSymbol: String,
|
||||
|
|
|
|||
|
|
@ -305,6 +305,7 @@ internal class SendWithSwapConfirmModel @Inject constructor(
|
|||
modelScope.launch {
|
||||
uiState.transformerUpdate(SendWithSwapConfirmSendingStateTransformer(true))
|
||||
val feeExtended = feeUMV2?.feeExtraInfo?.transactionFeeExtended
|
||||
modelScope.launch(dispatchers.default) { sendClickAnalytics() }
|
||||
swapTransactionSender.sendTransaction(
|
||||
feeExtended = feeExtended,
|
||||
confirmData = confirmData,
|
||||
|
|
@ -494,6 +495,30 @@ internal class SendWithSwapConfirmModel @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private suspend fun sendClickAnalytics() {
|
||||
val selectedProvider = confirmData.quote?.provider ?: return
|
||||
val fromCurrency = confirmData.fromCryptoCurrencyStatus?.currency ?: return
|
||||
val toCurrency = confirmData.toCryptoCurrencyStatus?.currency ?: return
|
||||
val feeSelectorUM = uiState.value.feeSelectorUM as? FeeSelectorUM.Content ?: return
|
||||
val feeType = feeSelectorUM.toAnalyticType()
|
||||
val fromDerivationIndex = confirmData.fromAccount?.derivationIndex?.value
|
||||
val destination = destinationUM?.addressTextField?.actualAddress ?: return
|
||||
val destinationAccount = getAccountCurrencyByAddressUseCase(destination)
|
||||
.getOrNull()?.account
|
||||
val toDerivationIndex = destinationAccount?.derivationIndex?.value
|
||||
|
||||
analyticsEventHandler.send(
|
||||
SendWithSwapAnalyticEvents.OnSendClick(
|
||||
providerName = selectedProvider.name,
|
||||
feeType = feeType,
|
||||
fromToken = fromCurrency,
|
||||
toToken = toCurrency,
|
||||
fromDerivationIndex = fromDerivationIndex,
|
||||
toDerivationIndex = toDerivationIndex,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun getSelectedFeeToken(): CryptoCurrency {
|
||||
val feeUMV2 = uiState.value.feeSelectorUM as? FeeSelectorUMRedesigned.Content
|
||||
val feeExtended = feeUMV2?.feeExtraInfo?.transactionFeeExtended
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue