From 629db8d6250bfbab82508e3ab1f083c0e38f605b Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Fri, 9 Jun 2023 21:38:29 +0200 Subject: debug logging --- lib/pages/developer_page.dart | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'lib/pages/developer_page.dart') 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 { }); } - Future 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 { } 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 { return ZipFileOperation.includeItem; }, ); + + ScaffoldMessenger.of(context) + .showSnackBar(const SnackBar(content: Text('Backup created'))); } on PlatformException catch (e) { print(e); } -- cgit v1.2.3-70-g09d2