From 187218cf037839ec4b58fa6f0627882bd0f22dd7 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 29 Sep 2023 12:40:50 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../redux/middlewares/MultiWalletMiddleware.kt | 1 + .../tokendetails/navigation/TokenDetailsArguments.kt | 2 ++ .../tokendetails/TokenDetailsPreviewData.kt | 1 + .../tokendetails/state/TokenDetailsState.kt | 1 + .../factory/TokenDetailsSkeletonStateConverter.kt | 4 +++- .../tokendetails/ui/TokenDetailsScreen.kt | 12 +++++++----- .../presentation/router/DefaultWalletRouter.kt | 1 + 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt index 9b4d3fe816..6a76d4ef38 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt @@ -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, diff --git a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsArguments.kt b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsArguments.kt index 03a33f3af3..5238d98973 100644 --- a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsArguments.kt +++ b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsArguments.kt @@ -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, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt index 47fb487c28..664c3fd0e1 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt @@ -93,5 +93,6 @@ internal object TokenDetailsPreviewData { pullToRefreshConfig = pullToRefreshConfig, bottomSheetConfig = null, isBalanceHidden = false, + isCustomToken = false, ) } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt index 936440ff36..a86052874e 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/TokenDetailsState.kt @@ -22,4 +22,5 @@ internal data class TokenDetailsState( val pullToRefreshConfig: TokenDetailsPullToRefreshConfig, val bottomSheetConfig: TangemBottomSheetConfig?, val isBalanceHidden: Boolean, + val isCustomToken: Boolean, ) \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt index 9392fa607c..e828c9a2be 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt @@ -20,6 +20,7 @@ internal class TokenDetailsSkeletonStateConverter( ) : Converter { 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, ) } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt index 5ff3e0fff7..d1683f22c8 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/TokenDetailsScreen.kt @@ -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( diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt index f134aeade2..2c80ed2af1 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt @@ -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,