Updated on 2026-08-14
This commit is contained in:
parent
069605e151
commit
36516c900f
234 changed files with 902 additions and 1618 deletions
|
|
@ -73,7 +73,7 @@ sealed class AddressPayIdVerifyAction : SendScreenAction {
|
|||
PAY_ID_NOT_REGISTERED,
|
||||
PAY_ID_REQUEST_FAILED,
|
||||
ADDRESS_INVALID_OR_UNSUPPORTED_BY_BLOCKCHAIN,
|
||||
ADDRESS_SAME_AS_WALLET
|
||||
ADDRESS_SAME_AS_WALLET,
|
||||
}
|
||||
|
||||
data class ChangePasteBtnEnableState(val isEnabled: Boolean) : AddressPayIdVerifyAction()
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class AmountReducer : SendInternalReducer {
|
|||
viewBalanceValue = rescaledBalance.stripZeroPlainString(),
|
||||
mainCurrency = state.createMainCurrency(currency, currencyCanBeSwitched),
|
||||
maxLengthOfAmount = sendState.getDecimals(currency),
|
||||
cursorAtTheSamePosition = false
|
||||
cursorAtTheSamePosition = false,
|
||||
)
|
||||
}
|
||||
MainCurrencyType.CRYPTO -> {
|
||||
|
|
@ -51,7 +51,7 @@ class AmountReducer : SendInternalReducer {
|
|||
viewBalanceValue = state.balanceCrypto.stripZeroPlainString(),
|
||||
mainCurrency = state.createMainCurrency(currency, currencyCanBeSwitched),
|
||||
maxLengthOfAmount = sendState.getDecimals(currency),
|
||||
cursorAtTheSamePosition = false
|
||||
cursorAtTheSamePosition = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ class AmountReducer : SendInternalReducer {
|
|||
viewAmountValue = InputViewValue(viewValue, action.isUserInput),
|
||||
amountToSendCrypto = action.amountCrypto,
|
||||
cursorAtTheSamePosition = true,
|
||||
error = null
|
||||
error = null,
|
||||
)
|
||||
}
|
||||
is AmountAction.SetAmountError -> state.copy(error = action.error)
|
||||
|
|
|
|||
|
|
@ -66,11 +66,7 @@ class TransactionExtrasReducer : SendInternalReducer {
|
|||
return updateLastState(sendState.copy(transactionExtrasState = result), result)
|
||||
}
|
||||
|
||||
private fun handleXlmMemo(
|
||||
action: XlmMemo,
|
||||
sendState: SendState,
|
||||
infoState: TransactionExtrasState,
|
||||
): SendState {
|
||||
private fun handleXlmMemo(action: XlmMemo, sendState: SendState, infoState: TransactionExtrasState): SendState {
|
||||
fun clearMemo(memo: XlmMemoState): XlmMemoState = memo.copy(text = null, id = null, error = null)
|
||||
|
||||
val result = when (action) {
|
||||
|
|
|
|||
|
|
@ -101,5 +101,5 @@ data class XrpDestinationTagState(
|
|||
enum class TransactionExtraError {
|
||||
INVALID_DESTINATION_TAG,
|
||||
INVALID_XLM_MEMO,
|
||||
INVALID_BINANCE_MEMO
|
||||
INVALID_BINANCE_MEMO,
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ data class FeeState(
|
|||
val controlsLayoutIsVisible: Boolean = false,
|
||||
val feeChipGroupIsVisible: Boolean = true,
|
||||
val includeFeeSwitcherIsEnabled: Boolean = true,
|
||||
val progressState: ProgressState = ProgressState.Done
|
||||
val progressState: ProgressState = ProgressState.Done,
|
||||
) : SendScreenState {
|
||||
|
||||
override val stateId: StateId = StateId.FEE
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ data class ReceiptState(
|
|||
val crypto: ReceiptCrypto? = null,
|
||||
val tokenFiat: ReceiptTokenFiat? = null,
|
||||
val tokenCrypto: ReceiptTokenCrypto? = null,
|
||||
val mainCurrency: MainCurrency? = null
|
||||
val mainCurrency: MainCurrency? = null,
|
||||
) : SendScreenState {
|
||||
override val stateId: StateId = StateId.RECEIPT
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ data class ReceiptState(
|
|||
data class ReceiptSymbols(
|
||||
val fiat: String,
|
||||
val crypto: String,
|
||||
val token: String? = null
|
||||
val token: String? = null,
|
||||
)
|
||||
|
||||
data class ReceiptFiat(
|
||||
|
|
@ -27,7 +27,7 @@ data class ReceiptFiat(
|
|||
val feeFiat: String,
|
||||
val totalFiat: String,
|
||||
val willSentCrypto: String,
|
||||
val symbols: ReceiptSymbols
|
||||
val symbols: ReceiptSymbols,
|
||||
)
|
||||
|
||||
data class ReceiptCrypto(
|
||||
|
|
@ -36,14 +36,14 @@ data class ReceiptCrypto(
|
|||
val totalCrypto: String,
|
||||
val feeFiat: String,
|
||||
val willSentFiat: String,
|
||||
val symbols: ReceiptSymbols
|
||||
val symbols: ReceiptSymbols,
|
||||
)
|
||||
|
||||
data class ReceiptTokenCrypto(
|
||||
val amountToken: String,
|
||||
val feeCoin: String,
|
||||
val totalFiat: String,
|
||||
val symbols: ReceiptSymbols
|
||||
val symbols: ReceiptSymbols,
|
||||
)
|
||||
|
||||
data class ReceiptTokenFiat(
|
||||
|
|
@ -52,5 +52,5 @@ data class ReceiptTokenFiat(
|
|||
val totalFiat: String,
|
||||
val willSentToken: String,
|
||||
val willSentFeeCoin: String,
|
||||
val symbols: ReceiptSymbols
|
||||
val symbols: ReceiptSymbols,
|
||||
)
|
||||
|
|
@ -277,104 +277,101 @@ class SendStateSubscriber(fragment: BaseStoreFragment) :
|
|||
}
|
||||
|
||||
@Suppress("LongMethod", "ComplexMethod")
|
||||
private fun handleReceiptState(
|
||||
fg: SendFragment,
|
||||
state: ReceiptState,
|
||||
feeProgressState: ProgressState,
|
||||
) = with(fg.binding.clReceiptContainer) {
|
||||
val mainLayout = clReceiptContainer as ViewGroup
|
||||
val totalLayout = llTotalContainer.llTotal as ViewGroup
|
||||
val totalTokenLayout = llTotalContainer.flTotalTokenCrypto as ViewGroup
|
||||
private fun handleReceiptState(fg: SendFragment, state: ReceiptState, feeProgressState: ProgressState) =
|
||||
with(fg.binding.clReceiptContainer) {
|
||||
val mainLayout = clReceiptContainer as ViewGroup
|
||||
val totalLayout = llTotalContainer.llTotal as ViewGroup
|
||||
val totalTokenLayout = llTotalContainer.flTotalTokenCrypto as ViewGroup
|
||||
|
||||
fun getString(id: Int, vararg formatStrings: String): String = mainLayout.getString(id, *formatStrings)
|
||||
fun getString(id: Int, vararg formatStrings: String): String = mainLayout.getString(id, *formatStrings)
|
||||
|
||||
fun roughOrEmpty(value: String): String {
|
||||
return if (value == UNKNOWN_AMOUNT_SIGN) value else "$ROUGH_SIGN $value"
|
||||
}
|
||||
|
||||
when (feeProgressState) {
|
||||
ProgressState.Loading -> {
|
||||
tvReceiptFeeValue.hide()
|
||||
pbReceiptFee.show()
|
||||
fun roughOrEmpty(value: String): String {
|
||||
return if (value == UNKNOWN_AMOUNT_SIGN) value else "$ROUGH_SIGN $value"
|
||||
}
|
||||
ProgressState.Done -> {
|
||||
pbReceiptFee.hide()
|
||||
tvReceiptFeeValue.show()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
when (state.visibleTypeOfReceipt) {
|
||||
ReceiptLayoutType.FIAT -> {
|
||||
val receipt = state.fiat ?: return
|
||||
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
|
||||
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
|
||||
llTotalContainer.tvTotalValue.update("${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}")
|
||||
|
||||
val willSent = getString(
|
||||
R.string.send_total_subtitle_format,
|
||||
"${receipt.willSentCrypto} ${receipt.symbols.crypto}",
|
||||
)
|
||||
llTotalContainer.tvWillBeSentValue.update(willSent)
|
||||
}
|
||||
ReceiptLayoutType.CRYPTO -> {
|
||||
val receipt = state.crypto ?: return
|
||||
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountCrypto} ${receipt.symbols.crypto}")
|
||||
tvReceiptFeeValue.update("${receipt.feeCrypto} ${receipt.symbols.crypto}")
|
||||
llTotalContainer.tvTotalValue.update("${receipt.totalCrypto} ${receipt.symbols.crypto}")
|
||||
|
||||
if (receipt.willSentFiat == UNKNOWN_AMOUNT_SIGN) {
|
||||
llTotalContainer.tvWillBeSentValue.hide()
|
||||
} else {
|
||||
llTotalContainer.tvWillBeSentValue.show()
|
||||
llTotalContainer.tvWillBeSentValue.update(
|
||||
getString(
|
||||
R.string.send_total_subtitle_fiat_format,
|
||||
"${receipt.willSentFiat} ${receipt.symbols.fiat}",
|
||||
"${receipt.feeFiat} ${receipt.symbols.fiat}",
|
||||
),
|
||||
)
|
||||
when (feeProgressState) {
|
||||
ProgressState.Loading -> {
|
||||
tvReceiptFeeValue.hide()
|
||||
pbReceiptFee.show()
|
||||
}
|
||||
ProgressState.Done -> {
|
||||
pbReceiptFee.hide()
|
||||
tvReceiptFeeValue.show()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
ReceiptLayoutType.TOKEN_FIAT -> {
|
||||
val receipt = state.tokenFiat ?: return
|
||||
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
|
||||
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
|
||||
llTotalContainer.tvTotalValue.update("${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}")
|
||||
when (state.visibleTypeOfReceipt) {
|
||||
ReceiptLayoutType.FIAT -> {
|
||||
val receipt = state.fiat ?: return
|
||||
|
||||
val willSent = getString(
|
||||
R.string.send_total_subtitle_asset_format,
|
||||
"${receipt.symbols.token ?: ""} ${receipt.willSentToken}",
|
||||
"${receipt.symbols.crypto} ${receipt.willSentFeeCoin}",
|
||||
)
|
||||
llTotalContainer.tvWillBeSentValue.update(willSent)
|
||||
}
|
||||
ReceiptLayoutType.TOKEN_CRYPTO -> {
|
||||
val receipt = state.tokenCrypto ?: return
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
|
||||
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
|
||||
llTotalContainer.tvTotalValue.update("${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}")
|
||||
|
||||
totalLayout.show(false)
|
||||
totalTokenLayout.show(true)
|
||||
val willSent = getString(
|
||||
R.string.send_total_subtitle_format,
|
||||
"${receipt.willSentCrypto} ${receipt.symbols.crypto}",
|
||||
)
|
||||
llTotalContainer.tvWillBeSentValue.update(willSent)
|
||||
}
|
||||
ReceiptLayoutType.CRYPTO -> {
|
||||
val receipt = state.crypto ?: return
|
||||
|
||||
tvReceiptAmountValue.update("${receipt.amountToken} ${receipt.symbols.token}")
|
||||
tvReceiptFeeValue.update("${receipt.feeCoin} ${receipt.symbols.crypto}")
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountCrypto} ${receipt.symbols.crypto}")
|
||||
tvReceiptFeeValue.update("${receipt.feeCrypto} ${receipt.symbols.crypto}")
|
||||
llTotalContainer.tvTotalValue.update("${receipt.totalCrypto} ${receipt.symbols.crypto}")
|
||||
|
||||
val willSent = SpannableStringBuilder()
|
||||
.bold {
|
||||
append(roughOrEmpty(receipt.totalFiat)).append(" ")
|
||||
append(receipt.symbols.fiat)
|
||||
if (receipt.willSentFiat == UNKNOWN_AMOUNT_SIGN) {
|
||||
llTotalContainer.tvWillBeSentValue.hide()
|
||||
} else {
|
||||
llTotalContainer.tvWillBeSentValue.show()
|
||||
llTotalContainer.tvWillBeSentValue.update(
|
||||
getString(
|
||||
R.string.send_total_subtitle_fiat_format,
|
||||
"${receipt.willSentFiat} ${receipt.symbols.fiat}",
|
||||
"${receipt.feeFiat} ${receipt.symbols.fiat}",
|
||||
),
|
||||
)
|
||||
}
|
||||
llTotalContainer.tvTotalTokenCryptoValue.update(willSent.toString())
|
||||
}
|
||||
ReceiptLayoutType.TOKEN_FIAT -> {
|
||||
val receipt = state.tokenFiat ?: return
|
||||
|
||||
totalLayout.show(true)
|
||||
totalTokenLayout.show(false)
|
||||
tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}")
|
||||
tvReceiptFeeValue.update("${receipt.feeFiat} ${receipt.symbols.fiat}")
|
||||
llTotalContainer.tvTotalValue.update("${roughOrEmpty(receipt.totalFiat)} ${receipt.symbols.fiat}")
|
||||
|
||||
val willSent = getString(
|
||||
R.string.send_total_subtitle_asset_format,
|
||||
"${receipt.symbols.token ?: ""} ${receipt.willSentToken}",
|
||||
"${receipt.symbols.crypto} ${receipt.willSentFeeCoin}",
|
||||
)
|
||||
llTotalContainer.tvWillBeSentValue.update(willSent)
|
||||
}
|
||||
ReceiptLayoutType.TOKEN_CRYPTO -> {
|
||||
val receipt = state.tokenCrypto ?: return
|
||||
|
||||
totalLayout.show(false)
|
||||
totalTokenLayout.show(true)
|
||||
|
||||
tvReceiptAmountValue.update("${receipt.amountToken} ${receipt.symbols.token}")
|
||||
tvReceiptFeeValue.update("${receipt.feeCoin} ${receipt.symbols.crypto}")
|
||||
|
||||
val willSent = SpannableStringBuilder()
|
||||
.bold {
|
||||
append(roughOrEmpty(receipt.totalFiat)).append(" ")
|
||||
append(receipt.symbols.fiat)
|
||||
}
|
||||
llTotalContainer.tvTotalTokenCryptoValue.update(willSent.toString())
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue