From b128907197b3359470bcb69b5e6e1b40984eeeb6 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 7 Nov 2022 20:25:35 +0500 Subject: [PATCH] Updated on 2026-08-14 --- app/src/main/assets/tangem-app-config | 2 +- .../send/redux/reducers/FeeReducer.kt | 8 +++++-- .../features/send/redux/states/FeeState.kt | 2 ++ .../stateSubscribers/SendStateSubscriber.kt | 24 +++++++++++++++---- .../main/res/layout/layout_send_receipt.xml | 22 +++++++++++++---- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/src/main/assets/tangem-app-config b/app/src/main/assets/tangem-app-config index a1658496e7..cf6ea50867 160000 --- a/app/src/main/assets/tangem-app-config +++ b/app/src/main/assets/tangem-app-config @@ -1 +1 @@ -Subproject commit a1658496e777b611fc990ef2bc1a1a1fd48bc1e6 +Subproject commit cf6ea50867477f97655da9da47ff94987e8f3354 diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/reducers/FeeReducer.kt b/app/src/main/java/com/tangem/tap/features/send/redux/reducers/FeeReducer.kt index 9965636a49..3238c3b372 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/reducers/FeeReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/reducers/FeeReducer.kt @@ -7,6 +7,7 @@ import com.tangem.tap.features.send.redux.SendScreenAction import com.tangem.tap.features.send.redux.states.FeeState import com.tangem.tap.features.send.redux.states.FeeType import com.tangem.tap.features.send.redux.states.SendState +import com.tangem.tap.features.wallet.redux.ProgressState /** [REDACTED_AUTHOR] @@ -36,7 +37,7 @@ class FeeReducer : SendInternalReducer { private fun handleAction(action: FeeAction, sendState: SendState, state: FeeState): SendState { val result = when (action) { is FeeAction.RequestFee -> { - state + state.copy(progressState = ProgressState.Loading) } is FeeAction.ChangeLayoutVisibility -> { fun getVisibility(current: Boolean, proposed: Boolean?): Boolean = proposed ?: current @@ -68,12 +69,15 @@ class FeeReducer : SendInternalReducer { currentFee = currentFee, feeIsApproximate = isFeeApproximate(sendState), ) - } + }.copy( + progressState = ProgressState.Done, + ) } FeeAction.FeeCalculation.ClearResult -> { state.copy( feeList = null, currentFee = null, + progressState = ProgressState.Done, ) } } diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/states/FeeState.kt b/app/src/main/java/com/tangem/tap/features/send/redux/states/FeeState.kt index d9b8798a1e..79b199a5e8 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/states/FeeState.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/states/FeeState.kt @@ -1,6 +1,7 @@ package com.tangem.tap.features.send.redux.states import com.tangem.blockchain.common.Amount +import com.tangem.tap.features.wallet.redux.ProgressState import java.math.BigDecimal /** @@ -20,6 +21,7 @@ data class FeeState( val controlsLayoutIsVisible: Boolean = false, val feeChipGroupIsVisible: Boolean = true, val includeFeeSwitcherIsEnabled: Boolean = true, + val progressState: ProgressState = ProgressState.Done ) : SendScreenState { override val stateId: StateId = StateId.FEE diff --git a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt index fe3bee237d..4d6d80e6ce 100644 --- a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt +++ b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt @@ -11,6 +11,7 @@ import com.tangem.tap.common.extensions.beginDelayedTransition import com.tangem.tap.common.extensions.enableError import com.tangem.tap.common.extensions.getColor import com.tangem.tap.common.extensions.getString +import com.tangem.tap.common.extensions.hide import com.tangem.tap.common.extensions.show import com.tangem.tap.common.extensions.update import com.tangem.tap.common.redux.getMessageString @@ -35,6 +36,7 @@ import com.tangem.tap.features.send.ui.SendFragment import com.tangem.tap.features.send.ui.dialogs.RequestFeeErrorDialog import com.tangem.tap.features.send.ui.dialogs.SendTransactionFailsDialog import com.tangem.tap.features.send.ui.dialogs.TezosWarningDialog +import com.tangem.tap.features.wallet.redux.ProgressState import com.tangem.tap.features.wallet.redux.WalletState.Companion.ROUGH_SIGN import com.tangem.tap.features.wallet.redux.WalletState.Companion.UNKNOWN_AMOUNT_SIGN import com.tangem.tap.features.wallet.ui.adapters.WarningMessagesAdapter @@ -62,7 +64,7 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : StateId.TRANSACTION_EXTRAS -> handleTransactionExtrasState(fg, state.transactionExtrasState) StateId.AMOUNT -> handleAmountState(fg, state.amountState) StateId.FEE -> handleFeeState(fg, state.feeState) - StateId.RECEIPT -> handleReceiptState(fg, state.receiptState) + StateId.RECEIPT -> handleReceiptState(fg, state.receiptState, state.feeState.progressState) } } } @@ -263,7 +265,11 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : if (chipGroup.checkedChipId != chipId && chipId != View.NO_ID) chipGroup.check(chipId) } - private fun handleReceiptState(fg: SendFragment, state: ReceiptState) = with(fg.binding.clReceiptContainer) { + 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 @@ -274,11 +280,22 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : return if (value == UNKNOWN_AMOUNT_SIGN) value else "$ROUGH_SIGN $value" } + when (feeProgressState) { + ProgressState.Loading -> { + tvReceiptFeeValue.hide() + pbReceiptFee.show() + } + ProgressState.Done -> { + pbReceiptFee.hide() + tvReceiptFeeValue.show() + } + } + + when (state.visibleTypeOfReceipt) { ReceiptLayoutType.FIAT -> { val receipt = state.fiat ?: return - llTotalContainer.tvTotalValue totalLayout.show(true) totalTokenLayout.show(false) tvReceiptAmountValue.update("${receipt.amountFiat} ${receipt.symbols.fiat}") @@ -290,7 +307,6 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : receipt.willSentCrypto, receipt.symbols.crypto, ) llTotalContainer.tvWillBeSentValue.update(willSent) - } ReceiptLayoutType.CRYPTO -> { val receipt = state.crypto ?: return diff --git a/app/src/main/res/layout/layout_send_receipt.xml b/app/src/main/res/layout/layout_send_receipt.xml index 7309706654..2cf18b1ed5 100644 --- a/app/src/main/res/layout/layout_send_receipt.xml +++ b/app/src/main/res/layout/layout_send_receipt.xml @@ -22,10 +22,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" android:textAllCaps="true" android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" tools:text="75.00 usd" /> + + +