diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-06-09 21:38:29 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-06-09 21:38:29 +0200 |
| commit | 629db8d6250bfbab82508e3ab1f083c0e38f605b (patch) | |
| tree | 3645b1c2c64d70cbf44167e2456300ea946a0bc9 /lib/pages | |
| parent | 97e0c8cef73064d121dcb38ab904e8d5d8ba5cdd (diff) | |
debug logging
Diffstat (limited to 'lib/pages')
| -rw-r--r-- | lib/pages/developer_page.dart | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/lib/pages/developer_page.dart b/lib/pages/developer_page.dart index 2b1b54c..a75ca92 100644 --- a/lib/pages/developer_page.dart +++ b/lib/pages/developer_page.dart @@ -73,24 +73,6 @@ class _DeveloperPageState extends State<DeveloperPage> { }); } - Future<String?> getDownloadPath() async { - Directory? directory; - try { - if (Platform.isIOS) { - directory = await getApplicationDocumentsDirectory(); - } else { - directory = Directory('/storage/emulated/0/Download'); - // Put file in global download folder, if for an unknown reason it didn't exist, we fallback - // ignore: avoid_slow_async_io - if (!await directory.exists()) - directory = await getExternalStorageDirectory(); - } - } catch (err, stack) { - print("Cannot get download folder path"); - } - return directory?.path; - } - File _createZipFile(String fileName) { final zipFilePath = fileName; final zipFile = File(zipFilePath); @@ -113,9 +95,9 @@ class _DeveloperPageState extends State<DeveloperPage> { } if (await Permission.storage.request().isGranted) { - String? path = await getDownloadPath(); + String? path = await backupService.getDownloadPath(); if (path != null) { - path += '/backup.zip'; + path += 'backup.zip'; var zip = _createZipFile(path); int onProgressCallCount1 = 0; @@ -134,6 +116,9 @@ class _DeveloperPageState extends State<DeveloperPage> { return ZipFileOperation.includeItem; }, ); + + ScaffoldMessenger.of(context) + .showSnackBar(const SnackBar(content: Text('Backup created'))); } on PlatformException catch (e) { print(e); } |
