Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-15 11:22:40 +03:00
commit c2cd7e6b4c
675 changed files with 9577 additions and 4375 deletions

View file

@ -23,7 +23,7 @@ sealed class SwapEvents(
params = mapOf("Token" to token),
)
data object SendTokenBalanceClicked : SwapEvents(event = "Send Token Balance Clicked")
class SendTokenBalanceClicked : SwapEvents(event = "Send Token Balance Clicked")
data class ChooseTokenScreenOpened(val availableTokens: Boolean) : SwapEvents(
event = "Choose Token Screen Opened",
@ -43,7 +43,7 @@ sealed class SwapEvents(
params = mapOf("Send Token" to sendToken, "Receive Token" to receiveToken),
)
data object ButtonGivePermissionClicked : SwapEvents(event = "Button - Give permission")
class ButtonGivePermissionClicked : SwapEvents(event = "Button - Give permission")
data class ButtonPermissionApproveClicked(
val sendToken: String,
@ -58,10 +58,11 @@ sealed class SwapEvents(
),
)
data object ButtonPermissionCancelClicked : SwapEvents(event = "Button - Permission Cancel")
class ButtonPermissionCancelClicked : SwapEvents(event = "Button - Permission Cancel")
data object ButtonSwipeClicked : SwapEvents(event = "Button - Swipe")
class ButtonSwipeClicked : SwapEvents(event = "Button - Swipe")
@Suppress("NullableToStringCall")
data class SwapInProgressScreen(
val provider: SwapProvider,
val commission: FeeType, // Market / Fast
@ -69,6 +70,8 @@ sealed class SwapEvents(
val receiveBlockchain: String,
val sendToken: String,
val receiveToken: String,
val fromDerivationIndex: Int?,
val toDerivationIndex: Int?,
) : SwapEvents(
event = "Swap in Progress Screen Opened",
params = mapOf(
@ -78,10 +81,11 @@ sealed class SwapEvents(
"Receive Token" to receiveToken,
"Send Blockchain" to sendBlockchain,
"Receive Blockchain" to receiveBlockchain,
"Account Derivation From or To (optional)" to "$fromDerivationIndex, $toDerivationIndex",
),
)
data object ProviderClicked : SwapEvents("Provider Clicked")
class ProviderClicked : SwapEvents("Provider Clicked")
data class ProviderChosen(val provider: SwapProvider) : SwapEvents(
event = "Provider Chosen",
@ -98,7 +102,7 @@ sealed class SwapEvents(
params = mapOf("Token" to token),
)
data object NoticeNoAvailableTokensToSwap : SwapEvents("Notice - No Available Tokens To Swap")
class NoticeNoAvailableTokensToSwap : SwapEvents("Notice - No Available Tokens To Swap")
data class NoticeNotEnoughFee(val token: String, val blockchain: String) : SwapEvents(
event = "Notice - Not Enough Fee",

View file

@ -375,7 +375,7 @@ internal class SwapModel @Inject constructor(
) {
// exceptional case
if (selectedCurrency == null) {
analyticsEventHandler.send(SwapEvents.NoticeNoAvailableTokensToSwap)
analyticsEventHandler.send(SwapEvents.NoticeNoAvailableTokensToSwap())
uiState = stateBuilder.createNoAvailableTokensToSwapState(
uiStateHolder = uiState,
fromToken = initialFromStatus,
@ -847,6 +847,8 @@ internal class SwapModel @Inject constructor(
val fee = dataState.selectedFee?.feeType ?: return
val fromCurrency = dataState.fromCryptoCurrency?.currency ?: return
val toCurrency = dataState.toCryptoCurrency?.currency ?: return
val fromDerivationIndex = dataState.fromAccount?.derivationIndex?.value
val toDerivationIndex = dataState.toAccount?.derivationIndex?.value
analyticsEventHandler.send(
SwapEvents.SwapInProgressScreen(
@ -856,6 +858,8 @@ internal class SwapModel @Inject constructor(
receiveBlockchain = toCurrency.network.name,
sendToken = fromCurrency.symbol,
receiveToken = toCurrency.symbol,
fromDerivationIndex = fromDerivationIndex,
toDerivationIndex = toDerivationIndex,
),
)
}
@ -1271,7 +1275,7 @@ internal class SwapModel @Inject constructor(
private fun onAmountSelected(selected: Boolean) {
if (selected) {
analyticsEventHandler.send(SwapEvents.SendTokenBalanceClicked)
analyticsEventHandler.send(SwapEvents.SendTokenBalanceClicked())
}
}
@ -1312,7 +1316,7 @@ internal class SwapModel @Inject constructor(
},
onChangeCardsClicked = {
onChangeCardsClicked()
analyticsEventHandler.send(SwapEvents.ButtonSwipeClicked)
analyticsEventHandler.send(SwapEvents.ButtonSwipeClicked())
},
onBackClicked = {
val bottomSheet = uiState.bottomSheetConfig
@ -1331,10 +1335,10 @@ internal class SwapModel @Inject constructor(
onReduceByAmount = ::onReduceAmountClicked,
openPermissionBottomSheet = {
singleTaskScheduler.cancelTask()
analyticsEventHandler.send(SwapEvents.ButtonGivePermissionClicked)
analyticsEventHandler.send(SwapEvents.ButtonGivePermissionClicked())
uiState = stateBuilder.showPermissionBottomSheet(uiState) {
startLoadingQuotesFromLastState(isSilent = true)
analyticsEventHandler.send(SwapEvents.ButtonPermissionCancelClicked)
analyticsEventHandler.send(SwapEvents.ButtonPermissionCancelClicked())
uiState = stateBuilder.dismissBottomSheet(uiState)
}
},
@ -1362,7 +1366,7 @@ internal class SwapModel @Inject constructor(
}
},
onProviderClick = { providerId ->
analyticsEventHandler.send(SwapEvents.ProviderClicked)
analyticsEventHandler.send(SwapEvents.ProviderClicked())
val states = dataState.lastLoadedSwapStates.getLastLoadedSuccessStates()
val pricesLowerBest = getPricesLowerBest(providerId, states)
uiState = stateBuilder.showSelectProviderBottomSheet(