From 9afc2422e66ada231b046105609b6f9728d501f7 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 26 Apr 2024 17:22:57 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../presentation/state/SendStateFactory.kt | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendStateFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendStateFactory.kt index 32b43ad33a..caab9c9dc0 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendStateFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/SendStateFactory.kt @@ -285,7 +285,11 @@ internal class SendStateFactory( return state.copy( sendState = state.sendState?.copy( isSending = isSending, - isPrimaryButtonEnabled = isPrimaryButtonEnabled(state, state.sendState.notifications), + isPrimaryButtonEnabled = isPrimaryButtonEnabled( + state = state, + isSending = isSending, + notifications = state.sendState.notifications, + ), ), ) } @@ -309,7 +313,11 @@ internal class SendStateFactory( val sendState = state.sendState ?: return state return state.copy( sendState = sendState.copy( - isPrimaryButtonEnabled = isPrimaryButtonEnabled(state, notifications), + isPrimaryButtonEnabled = isPrimaryButtonEnabled( + state = state, + isSending = sendState.isSending, + notifications = notifications, + ), notifications = notifications, showTapHelp = sendState.showTapHelp && notifications.isEmpty(), ), @@ -324,11 +332,14 @@ internal class SendStateFactory( ) } - private fun isPrimaryButtonEnabled(state: SendUiState, notifications: ImmutableList): Boolean { - val sendState = state.sendState ?: return false + private fun isPrimaryButtonEnabled( + state: SendUiState, + isSending: Boolean, + notifications: ImmutableList, + ): Boolean { val feeState = state.getFeeState(stateRouterProvider().isEditState) ?: return false val hasErrorNotifications = notifications.any { it is SendNotification.Error } - return !hasErrorNotifications && !sendState.isSending && feeState.feeSelectorState is FeeSelectorState.Content + return !hasErrorNotifications && !isSending && feeState.feeSelectorState is FeeSelectorState.Content } //endregion } \ No newline at end of file