Updated on 2026-08-14
This commit is contained in:
parent
294c7139ee
commit
fd29bcdc08
12 changed files with 29 additions and 23 deletions
|
|
@ -9,6 +9,7 @@ import kotlinx.parcelize.Parcelize
|
|||
data class TokenDetailsArguments(
|
||||
val currencyId: CryptoCurrency.ID,
|
||||
val currencyName: String,
|
||||
val currencySymbol: String,
|
||||
val iconUrl: String?,
|
||||
val coinType: CoinType,
|
||||
) : Parcelable {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ internal object WalletPreviewData {
|
|||
buttons = manageButtons,
|
||||
bottomSheetConfig = bottomSheet,
|
||||
marketPriceBlockState = MarketPriceBlockState.Content(
|
||||
currencyName = "BTC",
|
||||
currencySymbol = "BTC",
|
||||
price = "98900.12$",
|
||||
priceChangeConfig = PriceChangeState.Content(
|
||||
valueInPercent = "5.16%",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ internal class DefaultWalletRouter(private val reduxNavController: ReduxNavContr
|
|||
TokenDetailsRouter.TOKEN_DETAILS_ARGS to TokenDetailsArguments(
|
||||
currencyId = currency.id,
|
||||
currencyName = currency.name,
|
||||
currencySymbol = currency.symbol,
|
||||
iconUrl = currency.iconUrl,
|
||||
coinType = when (currency) {
|
||||
is CryptoCurrency.Coin -> TokenDetailsArguments.CoinType.Native
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ internal class WalletSingleCurrencyLoadedBalanceConverter(
|
|||
private fun convertContent(status: CryptoCurrencyStatus): WalletState {
|
||||
return when (val state = currentStateProvider()) {
|
||||
is WalletSingleCurrencyState.Content -> {
|
||||
val currencyName = state.marketPriceBlockState.currencyName
|
||||
val currencyName = state.marketPriceBlockState.currencySymbol
|
||||
|
||||
state.copy(
|
||||
walletsListConfig = getUpdatedSelectedWallet(status = status.value, state = state),
|
||||
|
|
@ -58,7 +58,7 @@ internal class WalletSingleCurrencyLoadedBalanceConverter(
|
|||
is CryptoCurrencyStatus.NoQuote,
|
||||
is CryptoCurrencyStatus.Loaded,
|
||||
-> MarketPriceBlockState.Content(
|
||||
currencyName = currencyName,
|
||||
currencySymbol = currencyName,
|
||||
price = formatPrice(status, appCurrencyProvider()),
|
||||
priceChangeConfig = PriceChangeState.Content(
|
||||
valueInPercent = formatPriceChange(status),
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ internal class WalletSkeletonStateConverter(
|
|||
notifications = persistentListOf(),
|
||||
bottomSheetConfig = null,
|
||||
buttons = createButtons(),
|
||||
marketPriceBlockState = MarketPriceBlockState.Loading(currencyName = currencyName),
|
||||
marketPriceBlockState = MarketPriceBlockState.Loading(currencySymbol = currencyName),
|
||||
txHistoryState = TxHistoryState.Content(
|
||||
contentItems = MutableStateFlow(
|
||||
value = TxHistoryState.getDefaultLoadingTransactions(clickIntents::onExploreClick),
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ internal class WalletsUnlockStateConverter(
|
|||
bottomSheetConfig = null,
|
||||
buttons = buttons,
|
||||
marketPriceBlockState = MarketPriceBlockState.Loading(
|
||||
currencyName = action.selectedWallet.getPrimaryCurrencyName(),
|
||||
currencySymbol = action.selectedWallet.getPrimaryCurrencyName(),
|
||||
),
|
||||
txHistoryState = TxHistoryState.Content(
|
||||
contentItems = MutableStateFlow(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue