Updated on 2026-08-14
This commit is contained in:
parent
b08892762c
commit
f095f3a508
24 changed files with 184 additions and 26 deletions
|
|
@ -88,7 +88,7 @@ internal class DefaultSwapComponent @AssistedInject constructor(
|
|||
sendingCryptoCurrencyStatus = config.sendingCurrencyStatus,
|
||||
feeCryptoCurrencyStatus = config.feeCurrencyStatus,
|
||||
analyticsParams = SwapFeeSelectorBlockComponent.AnalyticsParams(
|
||||
analyticsCategoryName = CommonSendAnalyticEvents.SEND_CATEGORY,
|
||||
analyticsCategoryName = CommonSendAnalyticEvents.SWAP_CATEGORY,
|
||||
analyticsSendSource = CommonSendAnalyticEvents.CommonSendSource.Swap,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.tangem.common.ui.bottomsheet.permission.state.ApproveType
|
|||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.ERROR_CODE
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.ERROR_MESSAGE
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.FEE_TOKEN
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.PROVIDER
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.RECEIVE_TOKEN
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.SEND_TOKEN
|
||||
|
|
@ -84,6 +85,7 @@ sealed class SwapEvents(
|
|||
val receiveBlockchain: String,
|
||||
val sendToken: String,
|
||||
val receiveToken: String,
|
||||
val feeToken: String,
|
||||
val fromDerivationIndex: Int?,
|
||||
val toDerivationIndex: Int?,
|
||||
) : SwapEvents(
|
||||
|
|
@ -96,6 +98,7 @@ sealed class SwapEvents(
|
|||
"Send Blockchain" to sendBlockchain,
|
||||
"Receive Blockchain" to receiveBlockchain,
|
||||
"Account Derivation From or To (optional)" to "$fromDerivationIndex, $toDerivationIndex",
|
||||
FEE_TOKEN to feeToken,
|
||||
),
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ import java.text.DecimalFormat
|
|||
import java.text.NumberFormat
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.filter
|
||||
|
||||
typealias SuccessLoadedSwapData = Map<SwapProvider, SwapState.QuotesLoadedState>
|
||||
|
||||
|
|
@ -1098,6 +1097,7 @@ internal class SwapModel @Inject constructor(
|
|||
receiveBlockchain = toCurrency.network.name,
|
||||
sendToken = fromCurrency.symbol,
|
||||
receiveToken = toCurrency.symbol,
|
||||
feeToken = getFeeToken().symbol,
|
||||
fromDerivationIndex = fromDerivationIndex,
|
||||
toDerivationIndex = toDerivationIndex,
|
||||
),
|
||||
|
|
@ -1713,6 +1713,7 @@ internal class SwapModel @Inject constructor(
|
|||
blockchain = fromToken.network.name,
|
||||
token = fromToken.symbol,
|
||||
feeType = AnalyticsParam.FeeType.fromString(feeType.getNameForAnalytics()),
|
||||
feeToken = getFeeToken().symbol,
|
||||
)
|
||||
analyticsEventHandler.send(
|
||||
Basic.TransactionSent(
|
||||
|
|
@ -1722,12 +1723,26 @@ internal class SwapModel @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun getFeeToken(): CryptoCurrency {
|
||||
val fromToken = requireNotNull(dataState.fromCryptoCurrency) {
|
||||
"fromCryptoCurrency should not be null"
|
||||
}
|
||||
return when (val fee = getSelectedFee()) {
|
||||
is TxFee.FeeComponent -> fee.selectedToken?.currency ?: fromToken.currency
|
||||
is TxFee.Legacy,
|
||||
null,
|
||||
-> fromToken.currency
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendApproveSuccessEvent(fromToken: CryptoCurrency, feeType: FeeType, approveType: SwapApproveType) {
|
||||
val feeToken = getFeeToken().symbol
|
||||
val event = AnalyticsParam.TxSentFrom.Approve(
|
||||
blockchain = fromToken.network.name,
|
||||
token = fromToken.symbol,
|
||||
feeType = AnalyticsParam.FeeType.fromString(feeType.getNameForAnalytics()),
|
||||
permissionType = approveType.getNameForAnalytics(),
|
||||
feeToken = feeToken,
|
||||
)
|
||||
analyticsEventHandler.send(
|
||||
Basic.TransactionSent(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue