Updated on 2026-08-14
This commit is contained in:
parent
b779403de4
commit
d7b51a7b94
5 changed files with 22 additions and 8 deletions
|
|
@ -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
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ internal object SetApprovalInProgressTransformer : Transformer<StakingUiState> {
|
|||
|
||||
val updatedConfirmationState = state?.copy(
|
||||
notifications = notifications.toPersistentList(),
|
||||
isPrimaryButtonEnabled = false,
|
||||
) ?: prevState.confirmationState
|
||||
|
||||
return prevState.copy(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue