diff --git a/lib/core/service/file_service.dart b/lib/core/service/file_service.dart index 3fe6265..06ba344 100644 --- a/lib/core/service/file_service.dart +++ b/lib/core/service/file_service.dart @@ -50,7 +50,10 @@ class FileService { ))! .first; } else if (Platform.isIOS) { - return getApplicationDocumentsDirectory(); + final appDir = await getApplicationDocumentsDirectory(); + final dir = Directory('${appDir.path}/documents'); + dir.createSync(); + return dir; } else { throw UnsupportedError("Platform not supported."); } @@ -67,7 +70,10 @@ class FileService { } return directory; } else if (Platform.isIOS) { - return getApplicationDocumentsDirectory(); + final appDir = await getApplicationDocumentsDirectory(); + final dir = Directory('${appDir.path}/downloads'); + dir.createSync(); + return dir; } else { throw UnsupportedError("Platform not supported."); } @@ -80,7 +86,10 @@ class FileService { ); return scanDir!.first; } else if (Platform.isIOS) { - return getApplicationDocumentsDirectory(); + final appDir = await getApplicationDocumentsDirectory(); + final dir = Directory('${appDir.path}/scans'); + dir.createSync(); + return dir; } else { throw UnsupportedError("Platform not supported."); } diff --git a/lib/features/document_details/view/widgets/document_download_button.dart b/lib/features/document_details/view/widgets/document_download_button.dart index bc68e42..a024927 100644 --- a/lib/features/document_details/view/widgets/document_download_button.dart +++ b/lib/features/document_details/view/widgets/document_download_button.dart @@ -91,6 +91,7 @@ class _DocumentDownloadButtonState extends State { final createdFile = File(filePath); createdFile.createSync(recursive: true); createdFile.writeAsBytesSync(bytes); + debugPrint("Downloaded file to $filePath"); showSnackBar(context, S.of(context).documentDownloadSuccessMessage); } on PaperlessServerException catch (error, stackTrace) { showErrorMessage(context, error, stackTrace);