Updated on 2026-08-14
This commit is contained in:
parent
b082a86c35
commit
13261d664e
2 changed files with 15 additions and 12 deletions
|
|
@ -183,12 +183,14 @@ class ReceiptReducer : SendInternalReducer {
|
|||
return ReceiptTokenCrypto("0", feeValue.stripZeroPlainString(), "0", symbols)
|
||||
}
|
||||
val tokensToSend = amountState.amountToSendCrypto
|
||||
val amountType = amountState.typeOfAmount
|
||||
val currencyConverter = when {
|
||||
amountType is AmountType.Token && sendState.feeIsConvertible() -> sendState.tokenConverter
|
||||
amountType is AmountType.Coin && sendState.feeIsConvertible() -> sendState.coinConverter
|
||||
else -> null
|
||||
}
|
||||
|
||||
return if (sendState.currencyIsConvertible() && sendState.feeIsConvertible()) {
|
||||
val currencyConverter = when (amountState.typeOfAmount) {
|
||||
is AmountType.Token -> sendState.tokenConverter!!
|
||||
else -> sendState.coinConverter!!
|
||||
}
|
||||
return if (currencyConverter != null) {
|
||||
val currencyFiat = currencyConverter.toFiatUnscaled(tokensToSend)
|
||||
val feeFiat = sendState.customFeeConverter!!.toFiatUnscaled(feeValue)
|
||||
val totalFiat = currencyFiat.plus(feeFiat)
|
||||
|
|
@ -218,11 +220,14 @@ class ReceiptReducer : SendInternalReducer {
|
|||
|
||||
val tokensToSend = amountState.amountToSendCrypto
|
||||
|
||||
return if (sendState.currencyIsConvertible() && sendState.feeIsConvertible()) {
|
||||
val currencyConverter = when (amountState.typeOfAmount) {
|
||||
is AmountType.Token -> sendState.tokenConverter!!
|
||||
else -> sendState.coinConverter!!
|
||||
}
|
||||
val amountType = amountState.typeOfAmount
|
||||
val currencyConverter = when {
|
||||
amountType is AmountType.Token && sendState.feeIsConvertible() -> sendState.tokenConverter
|
||||
amountType is AmountType.Coin && sendState.feeIsConvertible() -> sendState.coinConverter
|
||||
else -> null
|
||||
}
|
||||
|
||||
return if (currencyConverter != null) {
|
||||
val feeFiat = sendState.customFeeConverter!!.toFiatUnscaled(feeCoin)
|
||||
val amountFiat = currencyConverter.toFiatUnscaled(tokensToSend)
|
||||
val totalFiat = amountFiat.plus(feeFiat)
|
||||
|
|
|
|||
|
|
@ -102,8 +102,6 @@ data class SendState(
|
|||
|
||||
fun coinIsConvertible(): Boolean = coinConverter != null
|
||||
fun tokenIsConvertible(): Boolean = tokenConverter != null
|
||||
|
||||
fun currencyIsConvertible(): Boolean = coinConverter != null || tokenConverter != null
|
||||
fun feeIsConvertible(): Boolean = customFeeConverter != null
|
||||
|
||||
fun mainCurrencyCanBeSwitched(): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue