From 928bc6cd78355b489739c814faa65da76e17d3a7 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 5 Oct 2023 15:50:49 +0700 Subject: [PATCH] TF-2188 Allow editable waiting/running/canceled status (cherry picked from commit 04af1331106afb2df676fac5fefbd2b086187a38) --- lib/features/sending_queue/domain/model/sending_email.dart | 4 ++++ .../sending_queue/presentation/sending_queue_view.dart | 2 +- .../presentation/widgets/bottom_bar_sending_queue_widget.dart | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/features/sending_queue/domain/model/sending_email.dart b/lib/features/sending_queue/domain/model/sending_email.dart index 6d8094741..fd54ff237 100644 --- a/lib/features/sending_queue/domain/model/sending_email.dart +++ b/lib/features/sending_queue/domain/model/sending_email.dart @@ -107,6 +107,10 @@ class SendingEmail with EquatableMixin { bool get isCanceled => sendingState == SendingState.canceled; + bool get isRunning => sendingState == SendingState.running; + + bool get isEditableSupported => isWaiting || isRunning || isCanceled; + @override List get props => [ sendingId, diff --git a/lib/features/sending_queue/presentation/sending_queue_view.dart b/lib/features/sending_queue/presentation/sending_queue_view.dart index efd861057..81f19d186 100644 --- a/lib/features/sending_queue/presentation/sending_queue_view.dart +++ b/lib/features/sending_queue/presentation/sending_queue_view.dart @@ -87,7 +87,7 @@ class SendingQueueView extends GetWidget with AppLoaderM onLongPressAction: controller.handleOnLongPressAction, onSelectLeadingAction: controller.toggleSelectionSendingEmail, onTapAction: (actionType, sendingEmail) { - if (!controller.isConnectedNetwork && sendingEmail.isWaiting) { + if (!controller.isConnectedNetwork && sendingEmail.isEditableSupported) { controller.handleSendingEmailActionType(context, actionType, [sendingEmail]); } }); diff --git a/lib/features/sending_queue/presentation/widgets/bottom_bar_sending_queue_widget.dart b/lib/features/sending_queue/presentation/widgets/bottom_bar_sending_queue_widget.dart index 715d470c5..7dcdce8c3 100644 --- a/lib/features/sending_queue/presentation/widgets/bottom_bar_sending_queue_widget.dart +++ b/lib/features/sending_queue/presentation/widgets/bottom_bar_sending_queue_widget.dart @@ -104,7 +104,7 @@ class BottomBarSendingQueueWidget extends StatelessWidget { bool get _isEditable => !isConnectedNetwork && listSendingEmailSelected.length == 1 && - listSendingEmailSelected.first.isWaiting; + listSendingEmailSelected.first.isEditableSupported; bool get _isCanResend => listSendingEmailSelected.isAllSendingStateError(); } \ No newline at end of file