diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt
index 5cf37e3a1c..6a0cca84f4 100644
--- a/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt
+++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt
@@ -114,6 +114,7 @@ internal class DefaultRampManager(
userWalletId: UserWalletId,
cryptoCurrencyStatus: CryptoCurrencyStatus,
): ScenarioUnavailabilityReason {
+ val yieldSupplyStatus = cryptoCurrencyStatus.value.yieldSupplyStatus
return when {
cryptoCurrencyStatus.value.amount.isNullOrZero() -> {
ScenarioUnavailabilityReason.EmptyBalance(ScenarioUnavailabilityReason.WithdrawalScenario.SEND)
@@ -127,6 +128,9 @@ internal class DefaultRampManager(
networkName = cryptoCurrencyStatus.currency.network.name,
)
}
+ yieldSupplyStatus?.isAllowedToSpend == false && yieldSupplyStatus.isActive -> {
+ ScenarioUnavailabilityReason.YieldSupplyApprovalRequired
+ }
else -> ScenarioUnavailabilityReason.None
}
}
diff --git a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenActionsUtils.kt b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenActionsUtils.kt
index 374cbde833..49a9714fa8 100644
--- a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenActionsUtils.kt
+++ b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenActionsUtils.kt
@@ -68,6 +68,9 @@ fun ScenarioUnavailabilityReason.getUnavailabilityReasonText(): TextReference {
-> {
resourceReference(id = R.string.token_button_unavailability_reason_loading)
}
+ ScenarioUnavailabilityReason.YieldSupplyApprovalRequired -> resourceReference(
+ R.string.token_button_unavailability_reason_yield_supply_approval,
+ )
ScenarioUnavailabilityReason.None -> {
throw IllegalArgumentException("The unavailability reason must be other than None")
}
diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml
index f6e86e035a..4055e42ef5 100644
--- a/core/res/src/main/res/values/strings.xml
+++ b/core/res/src/main/res/values/strings.xml
@@ -1305,10 +1305,19 @@
Choose token
not available
Deposit
+ Dispute
+ Explore transaction
Service fees
Fee
+ Completed
+ Declined
+ Pending
+ The bank rejected this transaction request.
+ This fee goes to cover the cost of handling your transfer.
Withdrawal
+ Change PIN
Failed to load data. Try again later.
+ Freeze Card
Hide
Technical issues detected. Please try again later or contact support.
Receive unavailable now
diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/ScenarioUnavailabilityReason.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/ScenarioUnavailabilityReason.kt
index bf816df605..64053517d7 100644
--- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/ScenarioUnavailabilityReason.kt
+++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/ScenarioUnavailabilityReason.kt
@@ -56,6 +56,8 @@ sealed class ScenarioUnavailabilityReason {
data object TrustlineRequired : ScenarioUnavailabilityReason()
+ data object YieldSupplyApprovalRequired : ScenarioUnavailabilityReason()
+
enum class WithdrawalScenario {
SELL, SEND // TODO staking create&process STAKING
}
diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenScreenAnalyticsEvent.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenScreenAnalyticsEvent.kt
index b33b3562ed..3365ce6d87 100644
--- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenScreenAnalyticsEvent.kt
+++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/analytics/TokenScreenAnalyticsEvent.kt
@@ -192,6 +192,7 @@ sealed class TokenScreenAnalyticsEvent(
is ScenarioUnavailabilityReason.NotExchangeable,
is ScenarioUnavailabilityReason.NotSupportedBySellService,
is ScenarioUnavailabilityReason.StakingUnavailable,
+ ScenarioUnavailabilityReason.YieldSupplyApprovalRequired,
-> UNAVAILABLE
ScenarioUnavailabilityReason.UnassociatedAsset -> ASSET_REQUIREMENT
ScenarioUnavailabilityReason.TrustlineRequired -> TRUSTLINE_REQUIREMENT
diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/actions/CommonActionsFactory.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/actions/CommonActionsFactory.kt
index 180041ff13..bef54bd155 100644
--- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/actions/CommonActionsFactory.kt
+++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/actions/CommonActionsFactory.kt
@@ -1,7 +1,6 @@
package com.tangem.domain.tokens.actions
import com.tangem.domain.exchange.RampStateManager
-import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
@@ -69,7 +68,7 @@ internal class CommonActionsFactory(
async {
getSwapUnavailabilityReason(
userWalletId = userWallet.walletId,
- currency = cryptoCurrencyStatus.currency,
+ currencyStatus = cryptoCurrencyStatus,
requirementsDeferred = requirementsDeferred,
)
}
@@ -175,17 +174,21 @@ internal class CommonActionsFactory(
private suspend fun getSwapUnavailabilityReason(
userWalletId: UserWalletId,
- currency: CryptoCurrency,
+ currencyStatus: CryptoCurrencyStatus,
requirementsDeferred: Deferred?,
): ScenarioUnavailabilityReason {
val swapUnavailabilityReason = rampStateManager
- .availableForSwap(userWalletId = userWalletId, cryptoCurrency = currency)
+ .availableForSwap(userWalletId = userWalletId, cryptoCurrency = currencyStatus.currency)
val shouldCheckAssetRequirements =
swapUnavailabilityReason == ScenarioUnavailabilityReason.None && requirementsDeferred != null
- return if (shouldCheckAssetRequirements) {
- getReceiveScenario(requirementsDeferred.await())
- } else {
- swapUnavailabilityReason
+
+ val yieldSupplyStatus = currencyStatus.value.yieldSupplyStatus
+ val isUnavailableByYieldSupply = yieldSupplyStatus?.isAllowedToSpend == false && yieldSupplyStatus.isActive
+
+ return when {
+ isUnavailableByYieldSupply -> ScenarioUnavailabilityReason.YieldSupplyApprovalRequired
+ shouldCheckAssetRequirements -> getReceiveScenario(requirementsDeferred.await())
+ else -> swapUnavailabilityReason
}
}
}
\ No newline at end of file
diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/model/OnrampTokenListModel.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/model/OnrampTokenListModel.kt
index a61e5837a8..c8f65cda5a 100644
--- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/model/OnrampTokenListModel.kt
+++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/model/OnrampTokenListModel.kt
@@ -402,7 +402,10 @@ internal class OnrampTokenListModel @Inject constructor(
cryptoCurrency = status.currency,
).isAvailable() && !status.currency.isCustom
- isAvailable && status.value !is CryptoCurrencyStatus.NoQuote
+ val supplyStatus = status.value.yieldSupplyStatus
+ val isUnavailableByYieldSupply = supplyStatus?.isAllowedToSpend == false && supplyStatus.isActive
+
+ isAvailable && status.value !is CryptoCurrencyStatus.NoQuote && !isUnavailableByYieldSupply
}
}
}
diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt
index f54b17d1f9..2b63d7405c 100644
--- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt
+++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt
@@ -19,8 +19,8 @@ import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetProtocolBalanceUseCase
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetTokenStatusUseCase
import com.tangem.domain.yield.supply.usecase.YieldSupplyMinAmountUseCase
-import com.tangem.features.yield.supply.impl.R
import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics
+import com.tangem.features.yield.supply.impl.R
import com.tangem.features.yield.supply.impl.common.formatter.YieldSupplyMinAmountFormatter
import com.tangem.features.yield.supply.impl.subcomponents.active.YieldSupplyActiveComponent
import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM