From fb06b08e96015df968a52702f5a68df302af5ea1 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 15 Dec 2023 10:05:07 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tokens/GetCryptoCurrencyActionsUseCase.kt | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt index 61962b7ca5..2a0d6ad530 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt @@ -1,6 +1,5 @@ package com.tangem.domain.tokens -import com.tangem.domain.common.CardTypesResolver import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.exchange.RampStateManager import com.tangem.domain.tokens.model.CryptoCurrency @@ -12,7 +11,6 @@ import com.tangem.domain.tokens.repository.MarketCryptoCurrencyRepository import com.tangem.domain.tokens.repository.NetworksRepository import com.tangem.domain.tokens.repository.QuotesRepository import com.tangem.domain.wallets.models.UserWallet -import com.tangem.domain.wallets.models.UserWalletId import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.isNullOrZero import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -53,10 +51,9 @@ class GetCryptoCurrencyActionsUseCase( val flow = networkFlow.mapLatest { maybeCoinStatus -> createTokenActionsState( - userWalletId = userWallet.walletId, + userWallet = userWallet, coinStatus = maybeCoinStatus.getOrNull(), cryptoCurrencyStatus = cryptoCurrencyStatus, - cardTypesResolver = userWallet.scanResponse.cardTypesResolver, ) } @@ -65,19 +62,17 @@ class GetCryptoCurrencyActionsUseCase( } private suspend fun createTokenActionsState( - userWalletId: UserWalletId, + userWallet: UserWallet, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, - cardTypesResolver: CardTypesResolver, ): TokenActionsState { return TokenActionsState( - walletId = userWalletId, + walletId = userWallet.walletId, cryptoCurrencyStatus = cryptoCurrencyStatus, states = createListOfActions( - userWalletId, + userWallet, coinStatus, cryptoCurrencyStatus, - cardTypesResolver, ), ) } @@ -87,10 +82,9 @@ class GetCryptoCurrencyActionsUseCase( * Actions priority: [Buy Send Receive Sell Swap] */ private suspend fun createListOfActions( - userWalletId: UserWalletId, + userWallet: UserWallet, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, - cardTypesResolver: CardTypesResolver, ): List { val cryptoCurrency = cryptoCurrencyStatus.currency if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.MissedDerivation) { @@ -116,10 +110,9 @@ class GetCryptoCurrencyActionsUseCase( activeList.add(TokenActionsState.ActionState.Send(true)) } - val isMulticurrencyWallet = cardTypesResolver.isTangemWallet() || cardTypesResolver.isWallet2() // swap - if (isMulticurrencyWallet) { - if (marketCryptoCurrencyRepository.isExchangeable(userWalletId, cryptoCurrency)) { + if (userWallet.isMultiCurrency) { + if (marketCryptoCurrencyRepository.isExchangeable(userWallet.walletId, cryptoCurrency)) { activeList.add(TokenActionsState.ActionState.Swap(true)) } else { disabledList.add(TokenActionsState.ActionState.Swap(false))