Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-06 18:34:53 +03:00
parent 54d476cadd
commit d258cb2f5c

View file

@ -107,10 +107,7 @@ internal class DefaultSwapComponent @AssistedInject constructor(
val fromCryptoCurrency by remember { derivedStateOf { dataState.fromCryptoCurrency } }
val feePaidCryptoCurrency by remember { derivedStateOf { dataState.feePaidCryptoCurrency } }
val shouldHideBlock by remember {
derivedStateOf {
dataState.amount.isNullOrBlank() || BigDecimal(dataState.amount).isZero() ||
model.uiState.isInsufficientFunds
}
derivedStateOf { toBigDecimalOrZero(dataState.amount).isZero() || model.uiState.isInsufficientFunds }
}
LaunchedEffect(fromCryptoCurrency, feePaidCryptoCurrency, shouldHideBlock) {
@ -208,6 +205,10 @@ internal class DefaultSwapComponent @AssistedInject constructor(
)
}
private fun toBigDecimalOrZero(bigDecimalString: String?): BigDecimal {
return bigDecimalString?.replace(",", ".")?.toBigDecimalOrNull() ?: BigDecimal.ZERO
}
@AssistedFactory
interface Factory : SwapComponent.Factory {
override fun create(context: AppComponentContext, params: SwapComponent.Params): DefaultSwapComponent