TF-369 Fix auto close email when download attachment in browser with small screen
This commit is contained in:
@@ -140,8 +140,6 @@ class EmailController extends BaseController {
|
|||||||
_moveToMailboxSuccess(success);
|
_moveToMailboxSuccess(success);
|
||||||
} else if (success is MarkAsStarEmailSuccess) {
|
} else if (success is MarkAsStarEmailSuccess) {
|
||||||
_markAsEmailStarSuccess(success);
|
_markAsEmailStarSuccess(success);
|
||||||
} else if (success is DownloadAttachmentForWebSuccess) {
|
|
||||||
_downloadAttachmentForWebSuccessAction(success);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -308,28 +306,25 @@ class EmailController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadAttachmentForWeb(Attachment attachment) {
|
void downloadAttachmentForWeb(BuildContext context, Attachment attachment) {
|
||||||
_downloadAttachmentForWebAction(attachment);
|
_downloadAttachmentForWebAction(context, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _downloadAttachmentForWebAction(Attachment attachment) async {
|
void _downloadAttachmentForWebAction(BuildContext context, Attachment attachment) async {
|
||||||
final accountId = mailboxDashBoardController.accountId.value;
|
final accountId = mailboxDashBoardController.accountId.value;
|
||||||
if (accountId != null && mailboxDashBoardController.sessionCurrent != null) {
|
if (accountId != null && mailboxDashBoardController.sessionCurrent != null) {
|
||||||
final baseDownloadUrl = mailboxDashBoardController.sessionCurrent!.getDownloadUrl();
|
final baseDownloadUrl = mailboxDashBoardController.sessionCurrent!.getDownloadUrl();
|
||||||
|
_appToast.showToast(AppLocalizations.of(context).your_download_has_started);
|
||||||
consumeState(_downloadAttachmentForWebInteractor.execute(attachment, accountId, baseDownloadUrl));
|
consumeState(_downloadAttachmentForWebInteractor.execute(attachment, accountId, baseDownloadUrl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _downloadAttachmentForWebFailureAction(Failure failure) {
|
void _downloadAttachmentForWebFailureAction(Failure failure) {
|
||||||
if (failure is DownloadAttachmentForWebFailure) {
|
if (failure is DownloadAttachmentForWebFailure && currentContext != null) {
|
||||||
popBack();
|
_appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _downloadAttachmentForWebSuccessAction(Success success) async {
|
|
||||||
popBack();
|
|
||||||
}
|
|
||||||
|
|
||||||
void moveToMailboxAction(PresentationEmail email) async {
|
void moveToMailboxAction(PresentationEmail email) async {
|
||||||
final currentMailbox = mailboxDashBoardController.selectedMailbox.value;
|
final currentMailbox = mailboxDashBoardController.selectedMailbox.value;
|
||||||
final accountId = mailboxDashBoardController.accountId.value;
|
final accountId = mailboxDashBoardController.accountId.value;
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ class EmailView extends GetView with UserSettingPopupMenuMixin {
|
|||||||
..onExpandAttachmentActionClick(() => emailController.toggleDisplayAttachmentsAction())
|
..onExpandAttachmentActionClick(() => emailController.toggleDisplayAttachmentsAction())
|
||||||
..onDownloadAttachmentFileActionClick((attachment) {
|
..onDownloadAttachmentFileActionClick((attachment) {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
emailController.downloadAttachmentForWeb(attachment);
|
emailController.downloadAttachmentForWeb(context, attachment);
|
||||||
} else {
|
} else {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
emailController.downloadAttachments(context, [attachment]);
|
emailController.downloadAttachments(context, [attachment]);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2022-03-29T13:00:02.017403",
|
"@@last_modified": "2022-03-29T16:34:59.741046",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -899,5 +899,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"your_download_has_started": "Your download has started",
|
||||||
|
"@your_download_has_started": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -956,4 +956,11 @@ class AppLocalizations {
|
|||||||
name: 'the_total_size_of_attachments_in_an_email_exceeds_the_limit'
|
name: 'the_total_size_of_attachments_in_an_email_exceeds_the_limit'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get your_download_has_started {
|
||||||
|
return Intl.message(
|
||||||
|
'Your download has started',
|
||||||
|
name: 'your_download_has_started'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user