TF-2321 Set isSendEmailLoading = false when tap outside to close the dialog in composer
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 3f9ab37e42d6bc2e726a047a8d7606128f23d02a)
This commit is contained in:
+2
-2
@@ -50,8 +50,8 @@ class ConfirmationDialogActionSheetBuilder {
|
|||||||
_styleCancelButton = style;
|
_styleCancelButton = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
void show() async {
|
Future<dynamic> show() async {
|
||||||
await showCupertinoModalPopup(
|
return await showCupertinoModalPopup(
|
||||||
context: _context,
|
context: _context,
|
||||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||||
builder: (context) => PointerInterceptor(child: CupertinoActionSheet(
|
builder: (context) => PointerInterceptor(child: CupertinoActionSheet(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
|||||||
|
|
||||||
mixin MessageDialogActionMixin {
|
mixin MessageDialogActionMixin {
|
||||||
|
|
||||||
void showConfirmDialogAction(
|
Future<dynamic> showConfirmDialogAction(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
String message,
|
String message,
|
||||||
String actionName,
|
String actionName,
|
||||||
@@ -34,7 +34,7 @@ mixin MessageDialogActionMixin {
|
|||||||
final imagePaths = Get.find<ImagePaths>();
|
final imagePaths = Get.find<ImagePaths>();
|
||||||
|
|
||||||
if (alignCenter) {
|
if (alignCenter) {
|
||||||
await showDialog(
|
return await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||||
builder: (BuildContext context) => PointerInterceptor(
|
builder: (BuildContext context) => PointerInterceptor(
|
||||||
@@ -71,7 +71,7 @@ mixin MessageDialogActionMixin {
|
|||||||
} else {
|
} else {
|
||||||
if (responsiveUtils.isMobile(context)) {
|
if (responsiveUtils.isMobile(context)) {
|
||||||
if (showAsBottomSheet) {
|
if (showAsBottomSheet) {
|
||||||
await showModalBottomSheet(
|
return await showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||||
@@ -110,7 +110,7 @@ mixin MessageDialogActionMixin {
|
|||||||
..onCloseButtonAction(() => popBack()))
|
..onCloseButtonAction(() => popBack()))
|
||||||
.build()));
|
.build()));
|
||||||
} else {
|
} else {
|
||||||
(ConfirmationDialogActionSheetBuilder(context, listTextSpan: listTextSpan)
|
return (ConfirmationDialogActionSheetBuilder(context, listTextSpan: listTextSpan)
|
||||||
..messageText(message)
|
..messageText(message)
|
||||||
..styleConfirmButton(const TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black))
|
..styleConfirmButton(const TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black))
|
||||||
..styleMessage(messageStyle)
|
..styleMessage(messageStyle)
|
||||||
@@ -128,7 +128,7 @@ mixin MessageDialogActionMixin {
|
|||||||
})).show();
|
})).show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await showDialog(
|
return await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||||
builder: (BuildContext context) => PointerInterceptor(
|
builder: (BuildContext context) => PointerInterceptor(
|
||||||
|
|||||||
@@ -819,12 +819,13 @@ class ComposerController extends BaseController {
|
|||||||
|
|
||||||
if (!isEnableEmailSendButton.value) {
|
if (!isEnableEmailSendButton.value) {
|
||||||
showConfirmDialogAction(context,
|
showConfirmDialogAction(context,
|
||||||
AppLocalizations.of(context).message_dialog_send_email_without_recipient,
|
AppLocalizations.of(context).message_dialog_send_email_without_recipient,
|
||||||
AppLocalizations.of(context).add_recipients,
|
AppLocalizations.of(context).add_recipients,
|
||||||
onConfirmAction: () => {isSendEmailLoading.value = false},
|
onConfirmAction: () => isSendEmailLoading.value = false,
|
||||||
title: AppLocalizations.of(context).sending_failed,
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false
|
||||||
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,54 +835,57 @@ class ComposerController extends BaseController {
|
|||||||
.toList();
|
.toList();
|
||||||
if (listEmailAddressInvalid.isNotEmpty) {
|
if (listEmailAddressInvalid.isNotEmpty) {
|
||||||
showConfirmDialogAction(context,
|
showConfirmDialogAction(context,
|
||||||
AppLocalizations.of(context).message_dialog_send_email_with_email_address_invalid,
|
AppLocalizations.of(context).message_dialog_send_email_with_email_address_invalid,
|
||||||
AppLocalizations.of(context).fix_email_addresses,
|
AppLocalizations.of(context).fix_email_addresses,
|
||||||
onConfirmAction: () {
|
onConfirmAction: () {
|
||||||
toAddressExpandMode.value = ExpandMode.EXPAND;
|
toAddressExpandMode.value = ExpandMode.EXPAND;
|
||||||
ccAddressExpandMode.value = ExpandMode.EXPAND;
|
ccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||||
bccAddressExpandMode.value = ExpandMode.EXPAND;
|
bccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||||
isSendEmailLoading.value = false;
|
isSendEmailLoading.value = false;
|
||||||
},
|
},
|
||||||
title: AppLocalizations.of(context).sending_failed,
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false
|
||||||
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subjectEmail.value == null || subjectEmail.isEmpty == true) {
|
if (subjectEmail.value == null || subjectEmail.isEmpty == true) {
|
||||||
showConfirmDialogAction(context,
|
showConfirmDialogAction(context,
|
||||||
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
|
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
|
||||||
AppLocalizations.of(context).send_anyway,
|
AppLocalizations.of(context).send_anyway,
|
||||||
onConfirmAction: () => _handleSendMessages(context),
|
onConfirmAction: () => _handleSendMessages(context),
|
||||||
onCancelAction: () => {isSendEmailLoading.value = false},
|
onCancelAction: () => isSendEmailLoading.value = false,
|
||||||
title: AppLocalizations.of(context).empty_subject,
|
title: AppLocalizations.of(context).empty_subject,
|
||||||
icon: SvgPicture.asset(imagePaths.icEmpty, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icEmpty, fit: BoxFit.fill),
|
||||||
);
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uploadController.allUploadAttachmentsCompleted) {
|
if (!uploadController.allUploadAttachmentsCompleted) {
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
context,
|
context,
|
||||||
AppLocalizations.of(context).messageDialogSendEmailUploadingAttachment,
|
AppLocalizations.of(context).messageDialogSendEmailUploadingAttachment,
|
||||||
AppLocalizations.of(context).got_it,
|
AppLocalizations.of(context).got_it,
|
||||||
onConfirmAction: () => {isSendEmailLoading.value = false},
|
onConfirmAction: () => isSendEmailLoading.value = false,
|
||||||
title: AppLocalizations.of(context).sending_failed,
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false
|
||||||
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uploadController.hasEnoughMaxAttachmentSize()) {
|
if (!uploadController.hasEnoughMaxAttachmentSize()) {
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
context,
|
context,
|
||||||
AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size(
|
AppLocalizations.of(context).message_dialog_send_email_exceeds_maximum_size(
|
||||||
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
|
||||||
AppLocalizations.of(context).got_it,
|
AppLocalizations.of(context).got_it,
|
||||||
onConfirmAction: () => {isSendEmailLoading.value = false},
|
onConfirmAction: () => isSendEmailLoading.value = false,
|
||||||
title: AppLocalizations.of(context).sending_failed,
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false
|
||||||
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,7 +1014,7 @@ class ComposerController extends BaseController {
|
|||||||
),
|
),
|
||||||
TextSpan(text: AppLocalizations.of(context).messageDialogWhenStoreSendingEmailTail)
|
TextSpan(text: AppLocalizations.of(context).messageDialogWhenStoreSendingEmailTail)
|
||||||
]
|
]
|
||||||
);
|
).whenComplete(() => isSendEmailLoading.value = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkContactPermission() async {
|
void _checkContactPermission() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user