From c928c2cf748e87535cbe08bb0cd3ef4369ef3a02 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Sun, 19 Sep 2021 19:01:38 +0800 Subject: [PATCH] Fix exceptions not caught for download notification --- lib/widget/viewer.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/widget/viewer.dart b/lib/widget/viewer.dart index f486514e..61387cdd 100644 --- a/lib/widget/viewer.dart +++ b/lib/widget/viewer.dart @@ -454,7 +454,7 @@ class _ViewerState extends State try { result = await DownloadFile()(widget.account, file); controller?.close(); - _onDownloadSuccessful(file, result); + await _onDownloadSuccessful(file, result); } on PermissionException catch (_) { _log.warning("[_onDownloadPressed] Permission not granted"); controller?.close(); @@ -476,7 +476,7 @@ class _ViewerState extends State } } - void _onDownloadSuccessful(File file, dynamic result) { + Future _onDownloadSuccessful(File file, dynamic result) async { dynamic notif; if (platform_k.isAndroid) { notif = AndroidItemDownloadSuccessfulNotification( @@ -484,7 +484,7 @@ class _ViewerState extends State } if (notif != null) { try { - notif.notify(); + await notif.notify(); return; } catch (e, stacktrace) { _log.shout(