Updated on 2026-08-14
This commit is contained in:
parent
294c7139ee
commit
fd29bcdc08
12 changed files with 29 additions and 23 deletions
|
|
@ -70,7 +70,7 @@ internal object TokenDetailsPreviewData {
|
|||
)
|
||||
val balanceError = TokenDetailsBalanceBlockState.Error(actionButtons = actionButtons)
|
||||
|
||||
private val marketPriceLoading = MarketPriceBlockState.Loading(currencyName = "USDT")
|
||||
private val marketPriceLoading = MarketPriceBlockState.Loading(currencySymbol = "USDT")
|
||||
|
||||
private val pullToRefreshConfig = TokenDetailsPullToRefreshConfig(
|
||||
isRefreshing = false,
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ internal class TokenDetailsLoadedBalanceConverter(
|
|||
val state = currentStateProvider()
|
||||
return state.copy(
|
||||
tokenBalanceBlockState = TokenDetailsBalanceBlockState.Error(state.tokenBalanceBlockState.actionButtons),
|
||||
marketPriceBlockState = MarketPriceBlockState.Error(state.marketPriceBlockState.currencyName),
|
||||
marketPriceBlockState = MarketPriceBlockState.Error(state.marketPriceBlockState.currencySymbol),
|
||||
notifications = persistentListOf(TokenDetailsNotification.NetworksUnreachable),
|
||||
)
|
||||
}
|
||||
|
||||
private fun convert(status: CryptoCurrencyStatus): TokenDetailsState {
|
||||
val state = currentStateProvider()
|
||||
val currencyName = state.marketPriceBlockState.currencyName
|
||||
val currencyName = state.marketPriceBlockState.currencySymbol
|
||||
return state.copy(
|
||||
tokenBalanceBlockState = getBalanceState(state.tokenBalanceBlockState, status),
|
||||
marketPriceBlockState = getMarketPriceState(status = status.value, currencyName = currencyName),
|
||||
marketPriceBlockState = getMarketPriceState(status = status.value, currencySymbol = currencyName),
|
||||
pendingTxs = status.value.pendingTransactions.map(txHistoryItemConverter::convert).toPersistentList(),
|
||||
)
|
||||
}
|
||||
|
|
@ -80,10 +80,13 @@ internal class TokenDetailsLoadedBalanceConverter(
|
|||
}
|
||||
}
|
||||
|
||||
private fun getMarketPriceState(status: CryptoCurrencyStatus.Status, currencyName: String): MarketPriceBlockState {
|
||||
private fun getMarketPriceState(
|
||||
status: CryptoCurrencyStatus.Status,
|
||||
currencySymbol: String,
|
||||
): MarketPriceBlockState {
|
||||
return when (status) {
|
||||
is CryptoCurrencyStatus.Loading -> MarketPriceBlockState.Loading(currencyName)
|
||||
is CryptoCurrencyStatus.NoQuote -> MarketPriceBlockState.Error(currencyName)
|
||||
is CryptoCurrencyStatus.Loading -> MarketPriceBlockState.Loading(currencySymbol)
|
||||
is CryptoCurrencyStatus.NoQuote -> MarketPriceBlockState.Error(currencySymbol)
|
||||
is CryptoCurrencyStatus.Loaded,
|
||||
is CryptoCurrencyStatus.Custom,
|
||||
is CryptoCurrencyStatus.MissedDerivation,
|
||||
|
|
@ -91,7 +94,7 @@ internal class TokenDetailsLoadedBalanceConverter(
|
|||
is CryptoCurrencyStatus.NoAmount,
|
||||
is CryptoCurrencyStatus.Unreachable,
|
||||
-> MarketPriceBlockState.Content(
|
||||
currencyName = currencyName,
|
||||
currencySymbol = currencySymbol,
|
||||
price = formatPrice(status, appCurrencyProvider()),
|
||||
priceChangeConfig = PriceChangeState.Content(
|
||||
valueInPercent = formatPriceChange(status),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ internal class TokenDetailsSkeletonStateConverter(
|
|||
},
|
||||
),
|
||||
tokenBalanceBlockState = TokenDetailsBalanceBlockState.Loading(actionButtons = createButtons()),
|
||||
marketPriceBlockState = MarketPriceBlockState.Loading(value.currencyName),
|
||||
marketPriceBlockState = MarketPriceBlockState.Loading(value.currencySymbol),
|
||||
notifications = persistentListOf(),
|
||||
pendingTxs = persistentListOf(),
|
||||
txHistoryState = TxHistoryState.Content(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue