Updated on 2026-08-14
This commit is contained in:
parent
3a84102e1d
commit
41164b1baf
2 changed files with 28 additions and 7 deletions
|
|
@ -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<UserWallet, UserWalletItemUM> {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ internal class PortfolioSelectorModel @Inject constructor(
|
|||
val appCurrency = portfolioData.appCurrency
|
||||
val isBalanceHidden = portfolioData.isBalanceHidden
|
||||
val lockedWallets = mutableListOf<PortfolioSelectorItemUM>()
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue