Updated on 2026-08-14
This commit is contained in:
parent
7200be9827
commit
1de486f684
6 changed files with 38 additions and 30 deletions
|
|
@ -4,6 +4,7 @@ import com.tangem.blockchain.common.AmountType
|
|||
import com.tangem.blockchain.common.Wallet
|
||||
import com.tangem.tap.common.extensions.scaleToFiat
|
||||
import com.tangem.tap.common.extensions.stripZeroPlainString
|
||||
import com.tangem.tap.domain.getFirstToken
|
||||
import com.tangem.tap.features.send.redux.ReceiptAction.RefreshReceipt
|
||||
import com.tangem.tap.features.send.redux.SendScreenAction
|
||||
import com.tangem.tap.features.send.redux.states.*
|
||||
|
|
@ -179,7 +180,7 @@ class ReceiptReducer : SendInternalReducer {
|
|||
return ReceiptSymbols(
|
||||
fiat = store.state.globalState.appCurrency,
|
||||
crypto = wallet.blockchain.currency,
|
||||
token = wallet.amounts[AmountType.Token]?.currencySymbol
|
||||
token = wallet.getFirstToken()?.symbol
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -187,12 +188,12 @@ class ReceiptReducer : SendInternalReducer {
|
|||
return when (mainCurrencyType) {
|
||||
MainCurrencyType.FIAT -> when (amountType) {
|
||||
AmountType.Coin -> ReceiptLayoutType.FIAT
|
||||
AmountType.Token -> ReceiptLayoutType.TOKEN_FIAT
|
||||
is AmountType.Token -> ReceiptLayoutType.TOKEN_FIAT
|
||||
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN
|
||||
}
|
||||
MainCurrencyType.CRYPTO -> when (amountType) {
|
||||
AmountType.Coin -> ReceiptLayoutType.CRYPTO
|
||||
AmountType.Token -> ReceiptLayoutType.TOKEN_CRYPTO
|
||||
is AmountType.Token -> ReceiptLayoutType.TOKEN_CRYPTO
|
||||
AmountType.Reserve -> ReceiptLayoutType.UNKNOWN
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ data class SendState(
|
|||
|
||||
fun convertFiatToExtractCrypto(fiatValue: BigDecimal): BigDecimal = when (amountState.typeOfAmount) {
|
||||
AmountType.Coin -> convertFiatToCoin(fiatValue)
|
||||
AmountType.Token -> convertFiatToToken(fiatValue)
|
||||
is AmountType.Token -> convertFiatToToken(fiatValue)
|
||||
AmountType.Reserve -> fiatValue
|
||||
}
|
||||
|
||||
fun convertExtractCryptoToFiat(cryptoValue: BigDecimal, scaleWithPrecision: Boolean = false): BigDecimal {
|
||||
return when (amountState.typeOfAmount) {
|
||||
AmountType.Coin -> convertCoinToFiat(cryptoValue, scaleWithPrecision)
|
||||
AmountType.Token -> convertTokenToFiat(cryptoValue, scaleWithPrecision)
|
||||
is AmountType.Token -> convertTokenToFiat(cryptoValue, scaleWithPrecision)
|
||||
AmountType.Reserve -> cryptoValue
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ data class SendState(
|
|||
fun mainCurrencyCanBeSwitched(): Boolean {
|
||||
return when (amountState.typeOfAmount) {
|
||||
AmountType.Coin -> coinIsConvertible()
|
||||
AmountType.Token -> tokenIsConvertible()
|
||||
is AmountType.Token -> tokenIsConvertible()
|
||||
AmountType.Reserve -> false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue