Updated on 2026-08-14
This commit is contained in:
parent
fd29bcdc08
commit
187218cf03
7 changed files with 16 additions and 6 deletions
|
|
@ -144,6 +144,7 @@ class MultiWalletMiddleware {
|
|||
coinType = when (cryptoCurrency) {
|
||||
is CryptoCurrency.Coin -> TokenDetailsArguments.CoinType.Native
|
||||
is CryptoCurrency.Token -> TokenDetailsArguments.CoinType.Token(
|
||||
isCustom = cryptoCurrency.isCustom,
|
||||
standardName = cryptoCurrency.network.standardType.name,
|
||||
networkName = cryptoCurrency.network.name,
|
||||
networkIcon = cryptoCurrency.networkIconResId,
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@ data class TokenDetailsArguments(
|
|||
object Native : CoinType()
|
||||
|
||||
/**
|
||||
* @param isCustom - Indicates whether the currency is a custom user-added currency or not.
|
||||
* @param standardName - token standard. Samples: ERC20, BEP20, BEP2, TRC20 and etc.
|
||||
* @param networkName - token's blockchain name. Ethereum, Tron and etc.
|
||||
*/
|
||||
data class Token(
|
||||
val isCustom: Boolean,
|
||||
val standardName: String,
|
||||
val networkName: String,
|
||||
@DrawableRes val networkIcon: Int,
|
||||
|
|
|
|||
|
|
@ -93,5 +93,6 @@ internal object TokenDetailsPreviewData {
|
|||
pullToRefreshConfig = pullToRefreshConfig,
|
||||
bottomSheetConfig = null,
|
||||
isBalanceHidden = false,
|
||||
isCustomToken = false,
|
||||
)
|
||||
}
|
||||
|
|
@ -22,4 +22,5 @@ internal data class TokenDetailsState(
|
|||
val pullToRefreshConfig: TokenDetailsPullToRefreshConfig,
|
||||
val bottomSheetConfig: TangemBottomSheetConfig?,
|
||||
val isBalanceHidden: Boolean,
|
||||
val isCustomToken: Boolean,
|
||||
)
|
||||
|
|
@ -20,6 +20,7 @@ internal class TokenDetailsSkeletonStateConverter(
|
|||
) : Converter<TokenDetailsArguments, TokenDetailsState> {
|
||||
|
||||
override fun convert(value: TokenDetailsArguments): TokenDetailsState {
|
||||
val coinType = value.coinType
|
||||
return TokenDetailsState(
|
||||
topAppBarConfig = TokenDetailsTopAppBarConfig(
|
||||
onBackClick = clickIntents::onBackClick,
|
||||
|
|
@ -28,7 +29,7 @@ internal class TokenDetailsSkeletonStateConverter(
|
|||
tokenInfoBlockState = TokenInfoBlockState(
|
||||
name = value.currencyName,
|
||||
iconUrl = value.iconUrl,
|
||||
currency = when (val coinType = value.coinType) {
|
||||
currency = when (coinType) {
|
||||
TokenDetailsArguments.CoinType.Native -> TokenInfoBlockState.Currency.Native
|
||||
is TokenDetailsArguments.CoinType.Token -> TokenInfoBlockState.Currency.Token(
|
||||
standardName = coinType.networkName,
|
||||
|
|
@ -50,6 +51,7 @@ internal class TokenDetailsSkeletonStateConverter(
|
|||
pullToRefreshConfig = createPullToRefresh(),
|
||||
bottomSheetConfig = null,
|
||||
isBalanceHidden = true,
|
||||
isCustomToken = coinType is TokenDetailsArguments.CoinType.Token && coinType.isCustom,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,11 +92,13 @@ internal fun TokenDetailsScreen(state: TokenDetailsState) {
|
|||
contentType = { it.config::class.java },
|
||||
itemContent = { Notification(config = it.config, modifier = itemModifier.animateItemPlacement()) },
|
||||
)
|
||||
item(
|
||||
key = MarketPriceBlockState::class.java,
|
||||
contentType = MarketPriceBlockState::class.java,
|
||||
content = { MarketPriceBlock(modifier = itemModifier, state = state.marketPriceBlockState) },
|
||||
)
|
||||
if (!state.isCustomToken) {
|
||||
item(
|
||||
key = MarketPriceBlockState::class.java,
|
||||
contentType = MarketPriceBlockState::class.java,
|
||||
content = { MarketPriceBlock(modifier = itemModifier, state = state.marketPriceBlockState) },
|
||||
)
|
||||
}
|
||||
if (state.txHistoryState is TxHistoryState.NotSupported && state.pendingTxs.isNotEmpty()) {
|
||||
item {
|
||||
PendingTxsBlock(
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ internal class DefaultWalletRouter(private val reduxNavController: ReduxNavContr
|
|||
coinType = when (currency) {
|
||||
is CryptoCurrency.Coin -> TokenDetailsArguments.CoinType.Native
|
||||
is CryptoCurrency.Token -> TokenDetailsArguments.CoinType.Token(
|
||||
isCustom = currency.isCustom,
|
||||
standardName = currency.network.standardType.name,
|
||||
networkName = currency.network.name,
|
||||
networkIcon = currency.networkIconResId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue