mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 08:12:28 -06:00
Merge pull request #87 from lagmoellertim/bugfix/ios-delete-temporary-directory
[BUGFIX] Temporary file deletion on iOS
This commit is contained in:
@@ -85,6 +85,17 @@ class FileService {
|
|||||||
await scanDir?.delete(recursive: true);
|
await scanDir?.delete(recursive: true);
|
||||||
await tempDir.delete(recursive: true);
|
await tempDir.delete(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<void> clearDirectoryContent(PaperlessDirectoryType type) async {
|
||||||
|
final dir = await getDirectory(type);
|
||||||
|
|
||||||
|
if (dir == null || !(await dir.exists())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Future.wait(
|
||||||
|
dir.listSync().map((item) => item.delete(recursive: true)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PaperlessDirectoryType {
|
enum PaperlessDirectoryType {
|
||||||
|
|||||||
@@ -101,9 +101,10 @@ void main() async {
|
|||||||
|
|
||||||
// Initialize Blocs/Cubits
|
// Initialize Blocs/Cubits
|
||||||
final connectivityCubit = ConnectivityCubit(connectivityStatusService);
|
final connectivityCubit = ConnectivityCubit(connectivityStatusService);
|
||||||
// Remove temporarily downloaded files.
|
|
||||||
|
|
||||||
// (await FileService.temporaryDirectory).deleteSync(recursive: true);
|
// Remove temporarily downloaded files.
|
||||||
|
await FileService.clearDirectoryContent(PaperlessDirectoryType.temporary);
|
||||||
|
|
||||||
// Load application settings and stored authentication data
|
// Load application settings and stored authentication data
|
||||||
await connectivityCubit.initialize();
|
await connectivityCubit.initialize();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user