From be2d2fc5268772696eea623f0a219426db35386e Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 22 Apr 2024 20:48:36 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../send/impl/presentation/state/SendUiState.kt | 2 -- .../state/amount/AmountStateFactory.kt | 14 -------------- .../impl/presentation/state/fee/FeeStateFactory.kt | 3 --- .../impl/presentation/ui/SendNavigationButtons.kt | 3 +-- .../impl/presentation/ui/amount/AmountButtons.kt | 2 -- .../impl/presentation/ui/amount/AmountField.kt | 12 +----------- .../presentation/ui/amount/AmountFieldContainer.kt | 1 - .../presentation/ui/amount/SendAmountContent.kt | 1 - .../impl/presentation/viewmodel/SendViewModel.kt | 2 +- 9 files changed, 3 insertions(+), 37 deletions(-) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendUiState.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendUiState.kt index b3772f48eb..2b14283039 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendUiState.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendUiState.kt @@ -51,8 +51,6 @@ internal sealed class SendStates { val isSegmentedButtonsEnabled: Boolean, val amountTextField: SendTextField.AmountField, val appCurrencyCode: String, - val isFeeLoading: Boolean, - val subtractedFee: BigDecimal?, ) : SendStates() /** Recipient state */ diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/amount/AmountStateFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/amount/AmountStateFactory.kt index 204c2f9e08..6f56b6aff3 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/amount/AmountStateFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/amount/AmountStateFactory.kt @@ -41,18 +41,4 @@ internal class AmountStateFactory( } fun getOnCurrencyChangedState(isFiat: Boolean) = amountCurrencyConverter.convert(isFiat) - - fun getAmountNotificationState(notifications: ImmutableList): SendUiState { - val state = currentStateProvider() - return state.copy( - amountState = state.amountState?.copy(notifications = notifications), - ) - } - - fun getOnAmountFeeLoadingCancel(): SendUiState { - val state = currentStateProvider() - return state.copy( - amountState = state.amountState?.copy(isFeeLoading = false), - ) - } } \ No newline at end of file diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeStateFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeStateFactory.kt index 5e34a54d61..a74613acd3 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeStateFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeStateFactory.kt @@ -45,7 +45,6 @@ internal class FeeStateFactory( val state = currentStateProvider() val feeState = state.feeState ?: return state return state.copy( - amountState = state.amountState?.copy(isFeeLoading = true), feeState = feeState.copy( feeSelectorState = if (feeState.feeSelectorState is FeeSelectorState.Content) { feeState.feeSelectorState @@ -78,7 +77,6 @@ internal class FeeStateFactory( val fee = feeConverter.convert(updatedFeeSelectorState) return state.copy( - amountState = state.amountState?.copy(isFeeLoading = false), feeState = feeState.copy( feeSelectorState = updatedFeeSelectorState, fee = fee, @@ -90,7 +88,6 @@ internal class FeeStateFactory( fun onFeeOnErrorState(): SendUiState { val state = currentStateProvider() return state.copy( - amountState = state.amountState?.copy(isFeeLoading = false), feeState = state.feeState?.copy( feeSelectorState = FeeSelectorState.Error, ), diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt index fda14b8a8a..604a9ba0a6 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt @@ -78,7 +78,6 @@ private fun SendNavigationButton( val isFromConfirmation = currentState.isFromConfirmation val isCorrectScreen = currentState.type == SendUiStateType.Amount || currentState.type == SendUiStateType.Fee val isSendingState = currentState.type == SendUiStateType.Send && !isSuccess && !isSending - val showProgress = uiState.amountState?.isFeeLoading == true val (buttonTextId, buttonClick) = getButtonData( currentState = currentState, @@ -120,7 +119,7 @@ private fun SendNavigationButton( if (isSendingState) hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) buttonClick() }, - showProgress = showProgress, + showProgress = false, modifier = Modifier.fillMaxWidth(), colors = TangemButtonsDefaults.primaryButtonColors, ) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountButtons.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountButtons.kt index 4e05fe9506..340f8e20ad 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountButtons.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountButtons.kt @@ -28,7 +28,6 @@ private const val AMOUNT_BUTTONS_KEY = "amountButtonsKey" internal fun LazyListScope.buttons( segmentedButtonConfig: PersistentList, clickIntents: SendClickIntents, - isMaxButtonEnabled: Boolean, isSegmentedButtonsEnabled: Boolean, ) { item( @@ -61,7 +60,6 @@ internal fun LazyListScope.buttons( } SecondaryButton( text = stringResource(R.string.send_max_amount), - enabled = isMaxButtonEnabled, onClick = { hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) clickIntents.onMaxValueClick() diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt index 84dd5252c8..f92a93cdae 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt @@ -25,7 +25,7 @@ import com.tangem.features.send.impl.presentation.state.fields.SendTextField import kotlinx.coroutines.job @Composable -internal fun AmountField(sendField: SendTextField.AmountField, isEnabled: Boolean, appCurrencyCode: String) { +internal fun AmountField(sendField: SendTextField.AmountField, appCurrencyCode: String) { val decimalFormat = rememberDecimalFormat() val isFiatValue = sendField.isFiatValue val currencyCode = if (isFiatValue) appCurrencyCode else null @@ -35,15 +35,6 @@ internal fun AmountField(sendField: SendTextField.AmountField, isEnabled: Boolea sendField.cryptoAmount to sendField.value } val requester = remember { FocusRequester() } - var isEnabledProxy by remember { mutableStateOf(isEnabled) } - - // Fix animation from amount screen to summary screen ([REDACTED_TASK_KEY]) - LaunchedEffect(key1 = isEnabled) { - if (isEnabled) { - delay(timeMillis = 700) - } - isEnabledProxy = isEnabled - } AmountTextField( value = primaryValue, @@ -61,7 +52,6 @@ internal fun AmountField(sendField: SendTextField.AmountField, isEnabled: Boolea color = TangemTheme.colors.text.primary1, textAlign = TextAlign.Center, ), - isEnabled = isEnabledProxy, isAutoResize = true, modifier = Modifier .focusRequester(requester) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountFieldContainer.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountFieldContainer.kt index d9926e3f54..eb78c8d0a1 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountFieldContainer.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountFieldContainer.kt @@ -62,7 +62,6 @@ internal fun LazyListScope.amountField( ) AmountField( sendField = amountState.amountTextField, - isEnabled = !amountState.isFeeLoading, appCurrencyCode = amountState.appCurrencyCode, ) } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/SendAmountContent.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/SendAmountContent.kt index e85226d60d..6806468b2b 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/SendAmountContent.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/SendAmountContent.kt @@ -34,7 +34,6 @@ internal fun SendAmountContent( buttons( segmentedButtonConfig = amountState.segmentedButtonConfig, clickIntents = clickIntents, - isMaxButtonEnabled = !amountState.isFeeLoading, isSegmentedButtonsEnabled = amountState.isSegmentedButtonsEnabled, ) } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt index 71bcfa8718..216ce22112 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt @@ -705,7 +705,7 @@ internal class SendViewModel @Inject constructor( updateFeeNotifications() }.saveIn(feeJobHolder) .invokeOnCompletion { - uiState = amountStateFactory.getOnAmountFeeLoadingCancel() + // todo } }