Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-27 18:52:30 +03:00
parent fe21d8801c
commit 8124a142de
2 changed files with 16 additions and 6 deletions

View file

@ -24,7 +24,6 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.feature.swap.component.SwapFeeSelectorBlockComponent
import com.tangem.feature.swap.model.SwapModel
import com.tangem.feature.swap.models.AddToPortfolioRoute
import com.tangem.feature.swap.models.SwapCardState.SwapCardData
import com.tangem.feature.swap.router.SwapNavScreen
import com.tangem.feature.swap.ui.SwapScreen
import com.tangem.feature.swap.ui.SwapSelectTokenScreen
@ -100,14 +99,25 @@ internal class DefaultSwapComponent @AssistedInject constructor(
val feeCurrencyStatus: CryptoCurrencyStatus,
)
@Suppress("LongMethod")
@Suppress("LongMethod", "CyclomaticComplexMethod")
@Composable
override fun Content(modifier: Modifier) {
if (sendFeatureToggles.isGaslessTransactionsEnabled) {
val sendCardData = model.uiState.sendCardData as? SwapCardData
val fromCryptoCurrency = if (model.isOrderReversed) {
model.dataState.toCryptoCurrency
} else {
model.dataState.fromCryptoCurrency
}
val feePaidCryptoCurrency = model.dataState.feePaidCryptoCurrency
LaunchedEffect(sendCardData?.token?.currency, feePaidCryptoCurrency?.currency) {
val sendingCryptoCurrencyStatus = sendCardData?.token ?: run {
val amount = model.dataState.amount
LaunchedEffect(fromCryptoCurrency, feePaidCryptoCurrency, amount.isNullOrBlank()) {
if (amount.isNullOrBlank()) {
slotNavigation.dismiss()
return@LaunchedEffect
}
val sendingCryptoCurrencyStatus = fromCryptoCurrency ?: run {
slotNavigation.dismiss()
return@LaunchedEffect
}

View file

@ -213,7 +213,7 @@ internal class SwapModel @Inject constructor(
val feeSelectorRepository = FeeSelectorRepository()
// shows currency order (direct - swap initial to selected, reversed = selected to initial)
private var isOrderReversed = false
var isOrderReversed by mutableStateOf(false)
private val lastAmount = mutableStateOf(INITIAL_AMOUNT)
private val lastReducedBalanceBy = mutableStateOf(BigDecimal.ZERO)
private val swapRouter: SwapRouter = SwapRouter(router = router)