Updated on 2026-08-14
This commit is contained in:
parent
21a3e1edce
commit
93f7f4b424
7 changed files with 58 additions and 20 deletions
|
|
@ -21,8 +21,9 @@ sealed class AnalyticsParam {
|
|||
sealed class CardBalanceState(val value: String) {
|
||||
object Empty : CardBalanceState("Empty")
|
||||
object Full : CardBalanceState("Full")
|
||||
object CustomToken : CardBalanceState("Custom token")
|
||||
object BlockchainError : CardBalanceState("Blockchain error")
|
||||
object CustomToken : CardBalanceState("Custom Token")
|
||||
object BlockchainError : CardBalanceState("Blockchain Error")
|
||||
object NoRate : CardBalanceState("No Rate")
|
||||
companion object
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ sealed class Settings(
|
|||
|
||||
object ButtonEnableBiometricAuthentication : AppSettings(event = "Button - Enable Biometric Authentication")
|
||||
|
||||
class MainCurrencyChanged(currencyType: String) : MainScreen(
|
||||
class MainCurrencyChanged(currencyType: String) : AppSettings(
|
||||
event = "Main Currency Changed",
|
||||
params = mapOf("Currency Type" to currencyType),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ class TopUpController(
|
|||
DataSourceTopupInfo.CardBalanceState.Empty
|
||||
AnalyticsParam.CardBalanceState.Full ->
|
||||
DataSourceTopupInfo.CardBalanceState.Full
|
||||
AnalyticsParam.CardBalanceState.NoRate ->
|
||||
DataSourceTopupInfo.CardBalanceState.NoRate
|
||||
},
|
||||
)
|
||||
topupWalletStorage.save(topupInfo)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ sealed class AnalyticsParam {
|
|||
sealed class CardBalanceState(val value: String) {
|
||||
object Empty : CardBalanceState("Empty")
|
||||
object Full : CardBalanceState("Full")
|
||||
object CustomToken : CardBalanceState("Custom token")
|
||||
object BlockchainError : CardBalanceState("Blockchain error")
|
||||
object CustomToken : CardBalanceState("Custom Token")
|
||||
object BlockchainError : CardBalanceState("Blockchain Error")
|
||||
object NoRate : CardBalanceState("No Rate")
|
||||
companion object
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ data class DataSourceTopupInfo(
|
|||
Full(serializedName = "Full"),
|
||||
CustomToken(serializedName = "Custom token"),
|
||||
BlockchainError(serializedName = "Blockchain error"),
|
||||
NoRate(serializedName = "No rate"),
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,10 @@ import com.tangem.domain.settings.*
|
|||
import com.tangem.domain.tokens.*
|
||||
import com.tangem.domain.tokens.error.TokenListError
|
||||
import com.tangem.domain.tokens.legacy.TradeCryptoAction
|
||||
import com.tangem.domain.tokens.model.*
|
||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.domain.tokens.model.NetworkGroup
|
||||
import com.tangem.domain.tokens.model.TokenList
|
||||
import com.tangem.domain.tokens.models.analytics.TokenReceiveAnalyticsEvent
|
||||
import com.tangem.domain.tokens.models.analytics.TokenScreenAnalyticsEvent
|
||||
import com.tangem.domain.txhistory.usecase.GetExplorerTransactionUrlUseCase
|
||||
|
|
@ -1118,7 +1121,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
uiState = stateFactory.getStateByTokensList(maybeTokenList.getTokenListWithWallet(wallet))
|
||||
|
||||
maybeTokenList.onRight {
|
||||
analyticsEventsHandler.sendBalanceLoadedEvent(fiatBalance = it.totalFiatBalance)
|
||||
analyticsEventsHandler.sendBalanceLoadedEvent(it)
|
||||
checkMultiWalletWithFunds(it)
|
||||
}
|
||||
|
||||
|
|
@ -1221,15 +1224,31 @@ internal class WalletViewModel @Inject constructor(
|
|||
|
||||
maybeCryptoCurrencyStatus.onRight { status ->
|
||||
val fiatAmount = status.value.fiatAmount
|
||||
analyticsEventsHandler.send(
|
||||
event = WalletScreenAnalyticsEvent.Basic.BalanceLoaded(
|
||||
balance = when {
|
||||
fiatAmount == null -> AnalyticsParam.CardBalanceState.BlockchainError
|
||||
|
||||
val cardBalanceState = when (status.value) {
|
||||
is CryptoCurrencyStatus.Loaded,
|
||||
is CryptoCurrencyStatus.NoAccount,
|
||||
is CryptoCurrencyStatus.NoAmount,
|
||||
-> {
|
||||
when {
|
||||
fiatAmount == null -> null
|
||||
fiatAmount.isZero() -> AnalyticsParam.CardBalanceState.Empty
|
||||
else -> AnalyticsParam.CardBalanceState.Full
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
is CryptoCurrencyStatus.NoQuote -> AnalyticsParam.CardBalanceState.NoRate
|
||||
is CryptoCurrencyStatus.Unreachable -> AnalyticsParam.CardBalanceState.BlockchainError
|
||||
is CryptoCurrencyStatus.MissedDerivation,
|
||||
is CryptoCurrencyStatus.Loading,
|
||||
is CryptoCurrencyStatus.Custom,
|
||||
-> null
|
||||
}
|
||||
|
||||
cardBalanceState?.let {
|
||||
analyticsEventsHandler.send(
|
||||
event = WalletScreenAnalyticsEvent.Basic.BalanceLoaded(balance = it),
|
||||
)
|
||||
}
|
||||
|
||||
singleWalletCryptoCurrencyStatus = status
|
||||
|
||||
|
|
@ -1261,7 +1280,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
uiState = stateFactory.getStateByTokensList(maybeTokenList.getTokenListWithWallet(wallet))
|
||||
|
||||
maybeTokenList.onRight { tokenList ->
|
||||
analyticsEventsHandler.sendBalanceLoadedEvent(tokenList.totalFiatBalance)
|
||||
analyticsEventsHandler.sendBalanceLoadedEvent(tokenList)
|
||||
checkMultiWalletWithFunds(tokenList)
|
||||
}
|
||||
|
||||
|
|
@ -1275,9 +1294,23 @@ internal class WalletViewModel @Inject constructor(
|
|||
.saveIn(tokensJobHolder)
|
||||
}
|
||||
|
||||
private fun AnalyticsEventHandler.sendBalanceLoadedEvent(fiatBalance: TokenList.FiatBalance) {
|
||||
val cardBalanceState = when (fiatBalance) {
|
||||
is TokenList.FiatBalance.Failed -> AnalyticsParam.CardBalanceState.BlockchainError
|
||||
private fun AnalyticsEventHandler.sendBalanceLoadedEvent(tokenList: TokenList) {
|
||||
val cardBalanceState = when (val fiatBalance = tokenList.totalFiatBalance) {
|
||||
is TokenList.FiatBalance.Failed -> {
|
||||
val currenciesStatuses = when (tokenList) {
|
||||
is TokenList.Empty -> emptyList()
|
||||
is TokenList.GroupedByNetwork -> tokenList.groups.flatMap(NetworkGroup::currencies)
|
||||
is TokenList.Ungrouped -> tokenList.currencies
|
||||
}
|
||||
|
||||
when {
|
||||
currenciesStatuses.isEmpty() -> AnalyticsParam.CardBalanceState.Empty
|
||||
currenciesStatuses.any { it.value is CryptoCurrencyStatus.NoQuote } -> {
|
||||
AnalyticsParam.CardBalanceState.NoRate
|
||||
}
|
||||
else -> AnalyticsParam.CardBalanceState.BlockchainError
|
||||
}
|
||||
}
|
||||
is TokenList.FiatBalance.Loaded -> {
|
||||
if (fiatBalance.amount > BigDecimal.ZERO) {
|
||||
AnalyticsParam.CardBalanceState.Full
|
||||
|
|
@ -1287,7 +1320,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
null
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
TokenList.FiatBalance.Loading -> null
|
||||
}
|
||||
|
||||
cardBalanceState?.let {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ spr-client = "3.6.2"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "release-app_5.0-368"
|
||||
tangemBlockchainSdk = "release-app_5.0-369"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "release-app_5.0-309"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue