Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-18 18:17:03 +05:00
parent 8aa158cdb6
commit 40e24712d5
6 changed files with 7 additions and 11 deletions

View file

@ -107,6 +107,6 @@ internal object TokenDetailsPreviewData {
pullToRefreshConfig = pullToRefreshConfig, pullToRefreshConfig = pullToRefreshConfig,
bottomSheetConfig = null, bottomSheetConfig = null,
isBalanceHidden = false, isBalanceHidden = false,
isCustomToken = false, isMarketPriceAvailable = false,
) )
} }

View file

@ -22,5 +22,5 @@ internal data class TokenDetailsState(
val pullToRefreshConfig: TokenDetailsPullToRefreshConfig, val pullToRefreshConfig: TokenDetailsPullToRefreshConfig,
val bottomSheetConfig: TangemBottomSheetConfig?, val bottomSheetConfig: TangemBottomSheetConfig?,
val isBalanceHidden: Boolean, val isBalanceHidden: Boolean,
val isCustomToken: Boolean, val isMarketPriceAvailable: Boolean,
) )

View file

@ -29,7 +29,7 @@ internal class TokenDetailsIconStateConverter : Converter<CryptoCurrency, TokenI
val background = token.tryGetBackgroundForTokenIcon(isGrayscale) val background = token.tryGetBackgroundForTokenIcon(isGrayscale)
val tint = getTintForTokenIcon(background) val tint = getTintForTokenIcon(background)
return if (token.isCustom) { return if (token.isCustom && token.iconUrl == null) {
TokenInfoBlockState.IconState.CustomTokenIcon( TokenInfoBlockState.IconState.CustomTokenIcon(
tint = tint, tint = tint,
background = background, background = background,

View file

@ -61,19 +61,15 @@ internal class TokenDetailsLoadedBalanceConverter(
return when (status.value) { return when (status.value) {
is CryptoCurrencyStatus.NoQuote, is CryptoCurrencyStatus.NoQuote,
is CryptoCurrencyStatus.Loaded, is CryptoCurrencyStatus.Loaded,
is CryptoCurrencyStatus.NoAccount,
is CryptoCurrencyStatus.Custom,
-> TokenDetailsBalanceBlockState.Content( -> TokenDetailsBalanceBlockState.Content(
actionButtons = currentState.actionButtons, actionButtons = currentState.actionButtons,
fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()), fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()),
cryptoBalance = formatCryptoAmount(status), cryptoBalance = formatCryptoAmount(status),
) )
is CryptoCurrencyStatus.NoAccount -> TokenDetailsBalanceBlockState.Content(
actionButtons = currentState.actionButtons,
fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()),
cryptoBalance = formatCryptoAmount(status),
)
is CryptoCurrencyStatus.Loading -> TokenDetailsBalanceBlockState.Loading(currentState.actionButtons) is CryptoCurrencyStatus.Loading -> TokenDetailsBalanceBlockState.Loading(currentState.actionButtons)
is CryptoCurrencyStatus.MissedDerivation, is CryptoCurrencyStatus.MissedDerivation,
is CryptoCurrencyStatus.Custom,
is CryptoCurrencyStatus.Unreachable, is CryptoCurrencyStatus.Unreachable,
is CryptoCurrencyStatus.NoAmount, is CryptoCurrencyStatus.NoAmount,
-> TokenDetailsBalanceBlockState.Error(currentState.actionButtons) -> TokenDetailsBalanceBlockState.Error(currentState.actionButtons)

View file

@ -53,7 +53,7 @@ internal class TokenDetailsSkeletonStateConverter(
pullToRefreshConfig = createPullToRefresh(), pullToRefreshConfig = createPullToRefresh(),
bottomSheetConfig = null, bottomSheetConfig = null,
isBalanceHidden = true, isBalanceHidden = true,
isCustomToken = value is CryptoCurrency.Token && value.isCustom, isMarketPriceAvailable = value.id.rawCurrencyId != null,
) )
} }

View file

@ -105,7 +105,7 @@ internal fun TokenDetailsScreen(state: TokenDetailsState) {
) )
}, },
) )
if (!state.isCustomToken) { if (state.isMarketPriceAvailable) {
item( item(
key = MarketPriceBlockState::class.java, key = MarketPriceBlockState::class.java,
contentType = MarketPriceBlockState::class.java, contentType = MarketPriceBlockState::class.java,