diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/AddStakingNotificationsTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/AddStakingNotificationsTransformer.kt index b482379c49..c8066c1dc2 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/AddStakingNotificationsTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/AddStakingNotificationsTransformer.kt @@ -119,7 +119,8 @@ internal class AddStakingNotificationsTransformer( isPrimaryButtonEnabled = notifications.none { it is StakingNotification.Error || it is NotificationUM.Error || - it is NotificationUM.Warning.NetworkFeeUnreachable + it is NotificationUM.Warning.NetworkFeeUnreachable || + it is StakingNotification.Warning.TransactionInProgress }, ), ) diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalInProgressTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalInProgressTransformer.kt index f9a5418f89..02adb3d9f1 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalInProgressTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalInProgressTransformer.kt @@ -22,6 +22,7 @@ internal object SetApprovalInProgressTransformer : Transformer { val updatedConfirmationState = state?.copy( notifications = notifications.toPersistentList(), + isPrimaryButtonEnabled = false, ) ?: prevState.confirmationState return prevState.copy( diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingConfirmationContent.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingConfirmationContent.kt index bcf6eb3cc3..255fd36faa 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingConfirmationContent.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingConfirmationContent.kt @@ -22,6 +22,7 @@ import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType import com.tangem.domain.staking.model.stakekit.action.StakingActionType import com.tangem.features.staking.impl.R import com.tangem.features.staking.impl.presentation.state.InnerConfirmationStakingState +import com.tangem.features.staking.impl.presentation.state.StakingNotification import com.tangem.features.staking.impl.presentation.state.StakingStates import com.tangem.features.staking.impl.presentation.state.TransactionDoneState import com.tangem.features.staking.impl.presentation.state.previewdata.ConfirmationStatePreviewData @@ -42,6 +43,7 @@ internal fun StakingConfirmationContent( val isEnterAction = type == StakingActionCommonType.ENTER val showValidatorBlock = isEnterAction || state.pendingAction?.type == StakingActionType.VOTE_LOCKED val isTransactionSent = state.innerState == InnerConfirmationStakingState.COMPLETED + val isTransactionInProgress = state.notifications.any { it is StakingNotification.Warning.TransactionInProgress } Column( modifier = Modifier .background(TangemTheme.colors.background.secondary) @@ -61,12 +63,16 @@ internal fun StakingConfirmationContent( } AmountBlock( amountState = amountState, - isClickDisabled = !isEnterAction || isTransactionSent, + isClickDisabled = !isEnterAction || isTransactionSent || isTransactionInProgress, isEditingDisabled = !isEnterAction && state.innerState != InnerConfirmationStakingState.COMPLETED, onClick = clickIntents::onPrevClick, ) if (showValidatorBlock) { - ValidatorBlock(validatorState = state.validatorState, onClick = clickIntents::openValidators) + ValidatorBlock( + validatorState = state.validatorState, + isClickable = !isTransactionInProgress, + onClick = clickIntents::openValidators, + ) } StakingFeeBlock(feeState = state.feeState, isTransactionSent = isTransactionSent) NotificationsBlock(notifications = state.notifications) diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/block/ValidatorBlock.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/block/ValidatorBlock.kt index e895963463..192d1e5397 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/block/ValidatorBlock.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/block/ValidatorBlock.kt @@ -20,14 +20,14 @@ import com.tangem.features.staking.impl.presentation.ui.ValidatorImagePlaceholde import com.tangem.utils.extensions.orZero @Composable -internal fun ValidatorBlock(validatorState: ValidatorState, onClick: () -> Unit) { +internal fun ValidatorBlock(validatorState: ValidatorState, isClickable: Boolean, onClick: () -> Unit) { Column( modifier = Modifier .fillMaxWidth() .clip(TangemTheme.shapes.roundedCornersXMedium) .background(TangemTheme.colors.background.action) .clickable( - enabled = validatorState.isClickable, + enabled = validatorState.isClickable && isClickable, interactionSource = remember { MutableInteractionSource() }, indication = ripple(), onClick = onClick, diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt index a58ede27d2..47ea7069b2 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt @@ -365,10 +365,16 @@ internal class StakingViewModel @Inject constructor( override fun onPrevClick() { if (value.currentStep == StakingStep.Confirmation) { - when ((value.confirmationState as? StakingStates.ConfirmationState.Data)?.innerState) { + val confirmationState = value.confirmationState as? StakingStates.ConfirmationState.Data + when (confirmationState?.innerState) { InnerConfirmationStakingState.ASSENT -> { - stateController.update(SetConfirmationStateResetAssentTransformer) - stakingStateRouter.onPrevClick() + val isApprovalInProgress = confirmationState.notifications.any { + it is StakingNotification.Warning.TransactionInProgress + } + if (!isApprovalInProgress) { + stakingStateRouter.onPrevClick() + stateController.update(SetConfirmationStateResetAssentTransformer) + } } null, InnerConfirmationStakingState.IN_PROGRESS,