From 01b9ceda966ac290fb16ac1051ff90fac8eb9774 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 30 Jul 2024 23:58:54 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/features/details/utils/UserWalletMappers.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/features/details/impl/src/main/kotlin/com/tangem/features/details/utils/UserWalletMappers.kt b/features/details/impl/src/main/kotlin/com/tangem/features/details/utils/UserWalletMappers.kt index eab5ed50e3..a9782fc1d9 100644 --- a/features/details/impl/src/main/kotlin/com/tangem/features/details/utils/UserWalletMappers.kt +++ b/features/details/impl/src/main/kotlin/com/tangem/features/details/utils/UserWalletMappers.kt @@ -21,7 +21,8 @@ internal fun List.toUiModels( isBalancesHidden: Boolean = false, ): ImmutableList = this.map { model -> val balance = balances[model.walletId] - model.mapToUiModel( + + model.toUiModel( balance = balance, appCurrency = appCurrency, isLoading = isLoading, @@ -30,7 +31,7 @@ internal fun List.toUiModels( ) }.toImmutableList() -private fun UserWallet.mapToUiModel( +private fun UserWallet.toUiModel( balance: TotalFiatBalance?, appCurrency: AppCurrency?, isLoading: Boolean, @@ -66,9 +67,9 @@ private fun UserWallet.getInfo( ) return when { + isBalanceHidden -> combinedReference(cardCountRef, dividerRef, stringReference(STARS)) isLocked -> combinedReference(cardCountRef, dividerRef, resourceReference(R.string.common_locked)) isLoading -> cardCountRef - isBalanceHidden -> combinedReference(cardCountRef, dividerRef, stringReference(STARS)) else -> getBalanceInfo(balance, appCurrency, cardCountRef, dividerRef) } } @@ -80,7 +81,7 @@ private fun getBalanceInfo( dividerRef: TextReference, ): TextReference { val amount = when (balance) { - is TotalFiatBalance.Loaded -> balance.amount.takeIf { balance.isAllAmountsSummarized } + is TotalFiatBalance.Loaded -> balance.amount is TotalFiatBalance.Failed, is TotalFiatBalance.Loading, null,