From c6fdc1fc52fff142b9f3cc3201ea8fa8af7e828b Mon Sep 17 00:00:00 2001 From: dab246 Date: Tue, 14 Jun 2022 12:19:21 +0700 Subject: [PATCH] TF-644 Show toast message when export attachment failed --- .../email/presentation/email_controller.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/features/email/presentation/email_controller.dart b/lib/features/email/presentation/email_controller.dart index 2ec312209..6b9917212 100644 --- a/lib/features/email/presentation/email_controller.dart +++ b/lib/features/email/presentation/email_controller.dart @@ -308,17 +308,18 @@ class EmailController extends BaseController { } } - void _exportAttachmentFailureAction(Failure failure) { - if (failure is ExportAttachmentFailure && failure.exception is! CancelDownloadFileException) { + void _exportAttachmentFailureAction(ExportAttachmentFailure failure) { + if (failure.exception is! CancelDownloadFileException) { popBack(); + if (currentContext != null) { + _appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed); + } } } - void _exportAttachmentSuccessAction(Success success) async { + void _exportAttachmentSuccessAction(ExportAttachmentSuccess success) async { popBack(); - if (success is ExportAttachmentSuccess) { - _openDownloadedPreviewWorkGroupDocument(success.downloadedResponse); - } + _openDownloadedPreviewWorkGroupDocument(success.downloadedResponse); } void _openDownloadedPreviewWorkGroupDocument(DownloadedResponse downloadedResponse) async {