Updated on 2026-08-14
This commit is contained in:
parent
29f55aae33
commit
9678c49b37
17 changed files with 151 additions and 57 deletions
|
|
@ -5,6 +5,7 @@ import com.tangem.core.analytics.models.AnalyticsParam.Key.ACCOUNT_DERIVATION_FR
|
|||
import com.tangem.core.analytics.models.AnalyticsParam.Key.ACCOUNT_DERIVATION_TO
|
||||
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
|
||||
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
|
||||
|
|
@ -103,6 +104,7 @@ sealed class SwapEvents(
|
|||
val sendToken: String,
|
||||
val receiveToken: String,
|
||||
val feeToken: String,
|
||||
val feeAssetType: AnalyticsParam.FeeAssetType,
|
||||
val fromDerivationIndex: Int?,
|
||||
val toDerivationIndex: Int?,
|
||||
val referralId: String?,
|
||||
|
|
@ -118,6 +120,7 @@ sealed class SwapEvents(
|
|||
if (fromDerivationIndex != null) put(ACCOUNT_DERIVATION_FROM, fromDerivationIndex.toString())
|
||||
if (toDerivationIndex != null) put(ACCOUNT_DERIVATION_TO, toDerivationIndex.toString())
|
||||
put(FEE_TOKEN, feeToken)
|
||||
put(AnalyticsParam.Key.FEE_ASSET_TYPE, feeAssetType.value)
|
||||
putAll(getReferralParams(referralId))
|
||||
},
|
||||
), AppsFlyerIncludedEvent
|
||||
|
|
|
|||
|
|
@ -1093,7 +1093,7 @@ internal class SwapModel @Inject constructor(
|
|||
}
|
||||
},
|
||||
)
|
||||
sendSuccessEvent()
|
||||
sendSwapInProgressEvent()
|
||||
|
||||
router.replaceAll(SwapRoute.Success)
|
||||
}
|
||||
|
|
@ -1169,7 +1169,7 @@ internal class SwapModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun sendSuccessEvent() {
|
||||
private suspend fun sendSwapInProgressEvent() {
|
||||
val provider = dataState.selectedProvider ?: return
|
||||
val fee = (getSelectedFee() as? TxFee.Legacy)?.feeType ?: FeeType.NORMAL
|
||||
val fromSwapCurrencyStatus = dataState.fromSwapCurrencyStatus ?: return
|
||||
|
|
@ -1177,6 +1177,12 @@ internal class SwapModel @Inject constructor(
|
|||
val fromDerivationIndex = fromSwapCurrencyStatus.account.derivationIndex?.value
|
||||
val toDerivationIndex = toSwapCurrencyStatus.account.derivationIndex?.value
|
||||
|
||||
val feeToken = getFeeToken()
|
||||
val feeAssetType = if (feeToken is CryptoCurrency.Coin) {
|
||||
AnalyticsParam.FeeAssetType.Coin
|
||||
} else {
|
||||
AnalyticsParam.FeeAssetType.Token
|
||||
}
|
||||
analyticsEventHandler.send(
|
||||
SwapEvents.SwapInProgressScreen(
|
||||
provider = provider,
|
||||
|
|
@ -1185,7 +1191,8 @@ internal class SwapModel @Inject constructor(
|
|||
receiveBlockchain = toSwapCurrencyStatus.currency.network.name,
|
||||
sendToken = fromSwapCurrencyStatus.currency.symbol,
|
||||
receiveToken = toSwapCurrencyStatus.currency.symbol,
|
||||
feeToken = getFeeToken().symbol,
|
||||
feeToken = feeToken.symbol,
|
||||
feeAssetType = feeAssetType,
|
||||
fromDerivationIndex = fromDerivationIndex,
|
||||
toDerivationIndex = toDerivationIndex,
|
||||
referralId = appsFlyerStore.get()?.refcode,
|
||||
|
|
@ -1558,11 +1565,18 @@ internal class SwapModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun sendSuccessSwapEvent(fromToken: CryptoCurrency, feeType: FeeType) {
|
||||
val feeToken = getFeeToken()
|
||||
val feeAssetType = if (feeToken is CryptoCurrency.Coin) {
|
||||
AnalyticsParam.FeeAssetType.Coin
|
||||
} else {
|
||||
AnalyticsParam.FeeAssetType.Token
|
||||
}
|
||||
val event = AnalyticsParam.TxSentFrom.Swap(
|
||||
blockchain = fromToken.network.name,
|
||||
token = fromToken.symbol,
|
||||
feeType = AnalyticsParam.FeeType.fromString(feeType.getNameForAnalytics()),
|
||||
feeToken = getFeeToken().symbol,
|
||||
feeToken = feeToken.symbol,
|
||||
feeAssetType = feeAssetType,
|
||||
)
|
||||
analyticsEventHandler.send(
|
||||
Basic.TransactionSent(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue