Updated on 2026-08-14
This commit is contained in:
commit
ba02ab2cd9
2 changed files with 26 additions and 6 deletions
|
|
@ -148,5 +148,17 @@ data class Network(
|
|||
|
||||
/** Destination tag supported */
|
||||
DESTINATION_TAG,
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Indicated whether any tx extras are supported
|
||||
*/
|
||||
fun isTxExtrasSupported() = when (this) {
|
||||
NONE -> false
|
||||
MEMO,
|
||||
DESTINATION_TAG,
|
||||
-> true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,11 +22,11 @@ import com.tangem.core.ui.extensions.resourceReference
|
|||
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.exchange.RampStateManager
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.isMultiCurrency
|
||||
import com.tangem.domain.tokens.GetMinimumTransactionAmountSyncUseCase
|
||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.isMultiCurrency
|
||||
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
|
||||
import com.tangem.features.send.v2.api.SendFeatureToggles
|
||||
import com.tangem.features.send.v2.api.entity.PredefinedValues
|
||||
|
|
@ -323,10 +323,7 @@ internal class SendAmountModel @Inject constructor(
|
|||
flow2 = params.currentRoute.filterIsInstance<CommonSendRoute.Amount>(),
|
||||
transform = { state, route -> state to route },
|
||||
).onEach { (state, route) ->
|
||||
isSendWithSwapAvailable.update {
|
||||
val isMultiCurrency = userWallet?.isMultiCurrency == true
|
||||
isAvailableForSwap && isMultiCurrency && sendFeatureToggles.isSendWithSwapEnabled
|
||||
}
|
||||
setSendWithSwapAvailability()
|
||||
params.callback.onNavigationResult(
|
||||
NavigationUM.Content(
|
||||
title = resourceReference(R.string.send_amount_label),
|
||||
|
|
@ -367,4 +364,15 @@ internal class SendAmountModel @Inject constructor(
|
|||
)
|
||||
}.launchIn(modelScope)
|
||||
}
|
||||
|
||||
private fun setSendWithSwapAvailability() {
|
||||
// Allowed only in multicurrency wallets
|
||||
val isMultiCurrency = userWallet?.isMultiCurrency == true
|
||||
|
||||
// Allowed only on networks without tx extras (e.i. memo and destination tag)
|
||||
val isExtrasSupported = cryptoCurrencyStatus.currency.network.transactionExtrasType.isTxExtrasSupported()
|
||||
isSendWithSwapAvailable.update {
|
||||
isAvailableForSwap && isMultiCurrency && sendFeatureToggles.isSendWithSwapEnabled && !isExtrasSupported
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue