فهرست منبع

Dismiss progress dialog on error

vishnukvmd 3 سال پیش
والد
کامیت
c87ff10fe4
1فایلهای تغییر یافته به همراه16 افزوده شده و 11 حذف شده
  1. 16 11
      lib/ui/settings/backup_section_widget.dart

+ 16 - 11
lib/ui/settings/backup_section_widget.dart

@@ -132,18 +132,23 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
           onTap: () async {
           onTap: () async {
             final dialog = createProgressDialog(context, "calculating...");
             final dialog = createProgressDialog(context, "calculating...");
             await dialog.show();
             await dialog.show();
-            final duplicates =
-                await DeduplicationService.instance.getDuplicateFiles();
-            await dialog.hide();
-            if (duplicates.isEmpty) {
-              showErrorDialog(context, "✨ no duplicates",
-                  "you've no duplicate files that can be cleared");
-            } else {
-              DeduplicationResult result =
-                  await routeToPage(context, DeduplicatePage(duplicates));
-              if (result != null) {
-                _showDuplicateFilesDeletedDialog(result);
+            try {
+              final duplicates =
+                  await DeduplicationService.instance.getDuplicateFiles();
+              await dialog.hide();
+              if (duplicates.isEmpty) {
+                showErrorDialog(context, "✨ no duplicates",
+                    "you've no duplicate files that can be cleared");
+              } else {
+                DeduplicationResult result =
+                    await routeToPage(context, DeduplicatePage(duplicates));
+                if (result != null) {
+                  _showDuplicateFilesDeletedDialog(result);
+                }
               }
               }
+            } catch (e) {
+              await dialog.hide();
+              showGenericErrorDialog(context);
             }
             }
           },
           },
           child: SettingsTextItem(
           child: SettingsTextItem(