From f76731e166bf0ed39c39151a4ad1bd267a074e0a Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 18 Oct 2023 12:31:14 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tokens/GetCryptoCurrencyActionsUseCase.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 765307f6e7..718b412716 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 @@ -56,6 +56,9 @@ class GetCryptoCurrencyActionsUseCase( if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.MissedDerivation) { return listOf(TokenActionsState.ActionState.HideToken(true)) } + if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.Unreachable) { + return getActionsForUnreachableCurrency(cryptoCurrency) + } val activeList = mutableListOf() val disabledList = mutableListOf() @@ -99,4 +102,22 @@ class GetCryptoCurrencyActionsUseCase( return activeList + disabledList } + + private fun getActionsForUnreachableCurrency(cryptoCurrency: CryptoCurrency): List { + val activeList = mutableListOf() + val disabledList = mutableListOf() + + activeList.add(TokenActionsState.ActionState.CopyAddress(true)) + if (rampManager.availableForBuy(cryptoCurrency)) { + activeList.add(TokenActionsState.ActionState.Buy(true)) + } else { + disabledList.add(TokenActionsState.ActionState.Buy(false)) + } + disabledList.add(TokenActionsState.ActionState.Send(false)) + disabledList.add(TokenActionsState.ActionState.Swap(false)) + disabledList.add(TokenActionsState.ActionState.Sell(false)) + activeList.add(TokenActionsState.ActionState.Receive(true)) + activeList.add(TokenActionsState.ActionState.HideToken(true)) + return activeList + disabledList + } } \ No newline at end of file