Updated on 2026-08-14
This commit is contained in:
parent
cff0f51c84
commit
b34ba3d882
2 changed files with 15 additions and 3 deletions
|
|
@ -30,9 +30,11 @@ import com.tangem.features.feed.components.market.details.portfolio.add.AddToPor
|
|||
import com.tangem.features.send.v2.api.SendFeatureToggles
|
||||
import com.tangem.features.send.v2.api.analytics.CommonSendAnalyticEvents
|
||||
import com.tangem.features.swap.SwapComponent
|
||||
import com.tangem.utils.extensions.isZero
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
import java.math.BigDecimal
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
internal class DefaultSwapComponent @AssistedInject constructor(
|
||||
|
|
@ -104,10 +106,15 @@ internal class DefaultSwapComponent @AssistedInject constructor(
|
|||
val dataState by model.dataStateStateFlow.collectAsStateWithLifecycle()
|
||||
val fromCryptoCurrency by remember { derivedStateOf { dataState.fromCryptoCurrency } }
|
||||
val feePaidCryptoCurrency by remember { derivedStateOf { dataState.feePaidCryptoCurrency } }
|
||||
val amount by remember { derivedStateOf { dataState.amount } }
|
||||
val shouldHideBlock by remember {
|
||||
derivedStateOf {
|
||||
dataState.amount.isNullOrBlank() || BigDecimal(dataState.amount).isZero() ||
|
||||
model.uiState.isInsufficientFunds
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(fromCryptoCurrency, feePaidCryptoCurrency, amount.isNullOrBlank()) {
|
||||
if (amount.isNullOrBlank()) {
|
||||
LaunchedEffect(fromCryptoCurrency, feePaidCryptoCurrency, shouldHideBlock) {
|
||||
if (shouldHideBlock) {
|
||||
slotNavigation.dismiss()
|
||||
return@LaunchedEffect
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2200,6 +2200,11 @@ internal class SwapModel @Inject constructor(
|
|||
return
|
||||
}
|
||||
|
||||
if (newState is FeeSelectorUM.Error) {
|
||||
state.value = newState.copy(isHidden = true)
|
||||
return
|
||||
}
|
||||
|
||||
state.value = newState
|
||||
|
||||
// If fee currency is same as from currency, we need to reload quotes to update fee info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue