Updated on 2026-08-14
This commit is contained in:
parent
8aa158cdb6
commit
40e24712d5
6 changed files with 7 additions and 11 deletions
|
|
@ -107,6 +107,6 @@ internal object TokenDetailsPreviewData {
|
||||||
pullToRefreshConfig = pullToRefreshConfig,
|
pullToRefreshConfig = pullToRefreshConfig,
|
||||||
bottomSheetConfig = null,
|
bottomSheetConfig = null,
|
||||||
isBalanceHidden = false,
|
isBalanceHidden = false,
|
||||||
isCustomToken = false,
|
isMarketPriceAvailable = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue