mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-06 09:15:48 -06:00
Improve created app file system structure on ios
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ class _DocumentDownloadButtonState extends State<DocumentDownloadButton> {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user