Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-27 19:43:34 +03:00
parent 76e17fc21f
commit f9cc3decfb
12 changed files with 353 additions and 144 deletions

View file

@ -10,6 +10,7 @@ import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
import com.tangem.domain.core.lce.Lce
import com.tangem.domain.core.utils.getOrElse
import com.tangem.domain.exchange.ExchangeableState
import com.tangem.domain.exchange.RampStateManager
import com.tangem.domain.settings.usercountry.GetUserCountryUseCase
import com.tangem.domain.settings.usercountry.models.UserCountry
@ -241,10 +242,21 @@ internal class OnrampTokenListModel @Inject constructor(
val isAvailable = rampStateManager.availableForSwap(
userWalletId = params.userWalletId,
cryptoCurrency = status.currency,
)
).isSwapAvailable() && !status.currency.isCustom
isAvailable && status.value !is CryptoCurrencyStatus.NoQuote
}
}
}
private fun ExchangeableState.isSwapAvailable(): Boolean {
return when (this) {
ExchangeableState.AssetNotFound,
ExchangeableState.Error,
ExchangeableState.Loading,
ExchangeableState.NotExchangeable,
-> false
ExchangeableState.Exchangeable -> true
}
}
}