[Android][Disable work manager] Update the rule for the actions in Sending queue:
- editable all the time - can resend manually only when have network (cherry picked from commit c77f8de4041a53aa1a9a6c7198f2db9bd4cf0c60)
This commit is contained in:
committed by
Dat H. Pham
parent
ad4be01ea2
commit
4952fbe840
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:core/domain/extensions/datetime_extension.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
@@ -115,10 +116,8 @@ class SendingEmail with EquatableMixin {
|
||||
bool get isRunning => sendingState == SendingState.running;
|
||||
|
||||
bool get isEditableSupported {
|
||||
if (PlatformInfo.isAndroid) {
|
||||
return isWaiting || isRunning || isCanceled;
|
||||
} else if (PlatformInfo.isIOS) {
|
||||
return isWaiting || isCanceled;
|
||||
if (PlatformInfo.isMobile) {
|
||||
return isWaiting || isCanceled || isError;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
+10
-17
@@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/state/button_state.dart';
|
||||
import 'package:tmail_ui_user/features/sending_queue/domain/model/sending_email.dart';
|
||||
import 'package:tmail_ui_user/features/sending_queue/presentation/extensions/list_sending_email_extension.dart';
|
||||
import 'package:tmail_ui_user/features/sending_queue/presentation/model/sending_email_action_type.dart';
|
||||
|
||||
typedef OnHandleSendingEmailActionType = void Function(SendingEmailActionType, List<SendingEmail>);
|
||||
@@ -49,14 +48,14 @@ class BottomBarSendingQueueWidget extends StatelessWidget {
|
||||
icon: _imagePaths.icEdit,
|
||||
borderRadius: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
iconColor: SendingEmailActionType.edit.getButtonIconColor(_isEditable ? ButtonState.enabled : ButtonState.disabled),
|
||||
iconColor: SendingEmailActionType.edit.getButtonIconColor(_canEditable ? ButtonState.enabled : ButtonState.disabled),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
color: SendingEmailActionType.edit.getButtonTitleColor(_isEditable ? ButtonState.enabled : ButtonState.disabled)
|
||||
color: SendingEmailActionType.edit.getButtonTitleColor(_canEditable ? ButtonState.enabled : ButtonState.disabled)
|
||||
),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () {
|
||||
if (_isEditable) {
|
||||
if (_canEditable) {
|
||||
onHandleSendingEmailActionType?.call(
|
||||
SendingEmailActionType.edit,
|
||||
listSendingEmailSelected
|
||||
@@ -72,14 +71,14 @@ class BottomBarSendingQueueWidget extends StatelessWidget {
|
||||
icon: _imagePaths.icRefresh,
|
||||
borderRadius: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
iconColor: SendingEmailActionType.resend.getButtonIconColor(_isCanResend ? ButtonState.enabled : ButtonState.disabled),
|
||||
iconColor: SendingEmailActionType.resend.getButtonIconColor(_canResend ? ButtonState.enabled : ButtonState.disabled),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
color: SendingEmailActionType.resend.getButtonTitleColor(_isCanResend ? ButtonState.enabled : ButtonState.disabled)
|
||||
color: SendingEmailActionType.resend.getButtonTitleColor(_canResend ? ButtonState.enabled : ButtonState.disabled)
|
||||
),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () {
|
||||
if (_isCanResend) {
|
||||
if (_canResend) {
|
||||
onHandleSendingEmailActionType?.call(SendingEmailActionType.resend, listSendingEmailSelected);
|
||||
}
|
||||
},
|
||||
@@ -106,12 +105,8 @@ class BottomBarSendingQueueWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
bool get _isEditable {
|
||||
if (PlatformInfo.isAndroid) {
|
||||
return !isConnectedNetwork &&
|
||||
listSendingEmailSelected.length == 1 &&
|
||||
listSendingEmailSelected.first.isEditableSupported;
|
||||
} else if (PlatformInfo.isIOS) {
|
||||
bool get _canEditable {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return listSendingEmailSelected.length == 1 &&
|
||||
listSendingEmailSelected.first.isEditableSupported;
|
||||
} else {
|
||||
@@ -119,10 +114,8 @@ class BottomBarSendingQueueWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
bool get _isCanResend {
|
||||
if (PlatformInfo.isAndroid) {
|
||||
return listSendingEmailSelected.isAllSendingStateError();
|
||||
} else if (PlatformInfo.isIOS) {
|
||||
bool get _canResend {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return isConnectedNetwork &&
|
||||
listSendingEmailSelected.length == 1 &&
|
||||
(listSendingEmailSelected.first.isWaiting || listSendingEmailSelected.first.isError);
|
||||
|
||||
Reference in New Issue
Block a user