Updated on 2026-08-14
This commit is contained in:
parent
8f77d699ed
commit
9bd2d958b7
4 changed files with 6 additions and 12 deletions
|
|
@ -33,6 +33,7 @@ import kotlinx.coroutines.flow.Flow
|
|||
import timber.log.Timber
|
||||
import java.math.BigDecimal
|
||||
|
||||
@Suppress("LargeClass")
|
||||
// FIXME: Move to its own module and make internal
|
||||
@Deprecated("Inject the WalletManagerFacade interface using DI instead")
|
||||
@Suppress("LargeClass")
|
||||
|
|
|
|||
|
|
@ -46,14 +46,8 @@ internal class TokenListFiatBalanceOperations(
|
|||
}
|
||||
|
||||
private fun recalculateBalanceWithoutQuote(currentBalance: TokenList.FiatBalance): TokenList.FiatBalance {
|
||||
return with(currentBalance) {
|
||||
(this as? TokenList.FiatBalance.Loaded)?.copy(
|
||||
isAllAmountsSummarized = false,
|
||||
) ?: TokenList.FiatBalance.Loaded(
|
||||
amount = BigDecimal.ZERO,
|
||||
isAllAmountsSummarized = false,
|
||||
)
|
||||
}
|
||||
return (currentBalance as? TokenList.FiatBalance.Loaded)?.copy(isAllAmountsSummarized = false)
|
||||
?: TokenList.FiatBalance.Failed
|
||||
}
|
||||
|
||||
private fun recalculateBalance(
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ internal class TokenListOperations(
|
|||
}
|
||||
|
||||
private fun Raise<Error>.createTokenList(isGrouped: Boolean, isSortedByBalance: Boolean): TokenList {
|
||||
val nonEmptyCurrencies = tokens.toNonEmptyListOrNull()
|
||||
?: return TokenList.Empty
|
||||
val nonEmptyCurrencies = tokens.toNonEmptyListOrNull() ?: return TokenList.Empty
|
||||
|
||||
val isAnyTokenLoading = nonEmptyCurrencies.any { it.value is CryptoCurrencyStatus.Loading }
|
||||
val fiatBalanceOperations = TokenListFiatBalanceOperations(nonEmptyCurrencies, isAnyTokenLoading)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.utils
|
|||
|
||||
import com.tangem.common.Provider
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.common.util.cardTypesResolver
|
||||
import com.tangem.domain.tokens.model.TokenList
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletMultiCurrencyState
|
||||
|
|
@ -28,8 +29,7 @@ internal class TokenListToWalletStateConverter(
|
|||
|
||||
override fun convert(value: TokenListWithWallet): WalletState {
|
||||
val tokenList = value.tokenList
|
||||
val isSingleCurrencyWalletWithToken = !value.wallet.isMultiCurrency &&
|
||||
value.wallet.scanResponse.walletData?.token != null
|
||||
val isSingleCurrencyWalletWithToken = value.wallet.scanResponse.cardTypesResolver.isSingleWalletWithToken()
|
||||
return when (val state = currentStateProvider()) {
|
||||
is WalletMultiCurrencyState.Content -> {
|
||||
state.copy(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue