diff --git a/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt index b8f7104b03..f5643c66c3 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt @@ -35,6 +35,7 @@ class UserWalletItemUMConverter( private val isClickableIfLocked: Boolean = false, private val endIcon: UserWalletItemUM.EndIcon = UserWalletItemUM.EndIcon.None, artwork: UserWalletItemUM.ImageState? = null, + private val mode: InfoField = InfoField.Devices, ) : Converter { private val artwork = artwork ?: UserWalletItemUM.ImageState.Loading @@ -61,17 +62,29 @@ class UserWalletItemUMConverter( private fun getInfo(userWallet: UserWallet): UserWalletItemUM.Information.Loaded { val text = when (userWallet) { is UserWallet.Cold -> { - val cardCount = userWallet.getCardsCount() ?: 1 - TextReference.PluralRes( - id = R.plurals.card_label_card_count, - count = cardCount, - formatArgs = wrappedList(cardCount), - ) + when (mode) { + is InfoField.Devices -> { + val cardCount = userWallet.getCardsCount() ?: 1 + TextReference.PluralRes( + id = R.plurals.card_label_card_count, + count = cardCount, + formatArgs = wrappedList(cardCount), + ) + } + is InfoField.Tokens -> { + TextReference.PluralRes( + id = R.plurals.common_tokens_count, + count = mode.tokensCount, + formatArgs = wrappedList(mode.tokensCount), + ) + } + } } is UserWallet.Hot -> { TextReference.Res(R.string.hw_mobile_wallet) } } + return UserWalletItemUM.Information.Loaded(text) } @@ -103,4 +116,9 @@ class UserWalletItemUMConverter( } } } + + sealed interface InfoField { + data object Devices : InfoField + data class Tokens(val tokensCount: Int) : InfoField + } } \ No newline at end of file diff --git a/features/account/impl/src/main/java/com/tangem/features/account/selector/PortfolioSelectorModel.kt b/features/account/impl/src/main/java/com/tangem/features/account/selector/PortfolioSelectorModel.kt index cc56f722fc..fc13e4df56 100644 --- a/features/account/impl/src/main/java/com/tangem/features/account/selector/PortfolioSelectorModel.kt +++ b/features/account/impl/src/main/java/com/tangem/features/account/selector/PortfolioSelectorModel.kt @@ -104,7 +104,7 @@ internal class PortfolioSelectorModel @Inject constructor( val appCurrency = portfolioData.appCurrency val isBalanceHidden = portfolioData.isBalanceHidden val lockedWallets = mutableListOf() - portfolioData.balances.forEach { walletId, portfolio -> + portfolioData.balances.forEach { (_, portfolio) -> val balance = portfolio.walletBalance val wallet = portfolio.userWallet val walletItemUM = UserWalletItemUMConverter( @@ -116,6 +116,9 @@ internal class PortfolioSelectorModel @Inject constructor( isBalanceHidden = isBalanceHidden, artwork = artworks[wallet.walletId], isAuthMode = false, + mode = UserWalletItemUMConverter.InfoField.Tokens( + tokensCount = portfolio.accountsBalance.flattenCurrencies().size, + ), ).convert(wallet) if (walletItemUM.isEnabled) { val mainAccount = portfolio.accountsBalance.mainAccount