diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt b/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt index 3f105620c4..c1fbac9b0a 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt @@ -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") diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFiatBalanceOperations.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFiatBalanceOperations.kt index 326fceb11f..d727850d2d 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFiatBalanceOperations.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFiatBalanceOperations.kt @@ -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( diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListOperations.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListOperations.kt index 1c77b372ce..612140fbfb 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListOperations.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListOperations.kt @@ -50,8 +50,7 @@ internal class TokenListOperations( } private fun Raise.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) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/utils/TokenListToWalletStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/utils/TokenListToWalletStateConverter.kt index 2228f63598..5e32d7706d 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/utils/TokenListToWalletStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/utils/TokenListToWalletStateConverter.kt @@ -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(