#578 delete empty album folder only if it is a regular album

This commit is contained in:
Thibault Deckers 2023-04-16 18:38:14 +02:00
parent bd001c1871
commit 482b23afee
5 changed files with 11 additions and 8 deletions

View file

@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
### Changed
- upgraded Flutter to stable v3.7.11
- when an album becomes empty, the folder will be deleted only if it is a non-app/common album
### Fixed
@ -134,7 +135,8 @@ All notable changes to this project will be documented in this file.
### Changed
- editing description writes XMP `dc:description`, and clears Exif `ImageDescription` / `UserComment`
- editing description writes XMP `dc:description`, and clears Exif `ImageDescription`
/ `UserComment`
- in the tag editor, tapping on applied tag applies it to all items instead of removing it
- pin app bar when selecting items

View file

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:aves/model/covers.dart';
import 'package:aves/services/common/output_buffer.dart';
import 'package:aves/services/common/services.dart';
import 'package:aves_model/aves_model.dart';
@ -22,7 +23,7 @@ abstract class StorageService {
Future<void> revokeDirectoryAccess(String path);
// returns number of deleted directories
Future<int> deleteEmptyDirectories(Iterable<String> dirPaths);
Future<int> deleteEmptyRegularDirectories(Set<String> dirPaths);
// returns whether user granted access to a directory of his choosing
Future<bool> requestDirectoryAccess(String path);
@ -132,10 +133,10 @@ class PlatformStorageService implements StorageService {
// returns number of deleted directories
@override
Future<int> deleteEmptyDirectories(Iterable<String> dirPaths) async {
Future<int> deleteEmptyRegularDirectories(Set<String> dirPaths) async {
try {
final result = await _platform.invokeMethod('deleteEmptyDirectories', <String, dynamic>{
'dirPaths': dirPaths.toList(),
'dirPaths': dirPaths.where((v) => covers.effectiveAlbumType(v) == AlbumType.regular).toList(),
});
if (result != null) return result as int;
} on PlatformException catch (e, stack) {

View file

@ -350,7 +350,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
}
// cleanup
await storageService.deleteEmptyDirectories(storageDirs);
await storageService.deleteEmptyRegularDirectories(storageDirs);
},
);
}

View file

@ -220,7 +220,7 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
// cleanup
if ({MoveType.move, MoveType.toBin}.contains(moveType)) {
await storageService.deleteEmptyDirectories(originAlbums);
await storageService.deleteEmptyRegularDirectories(originAlbums);
}
final successCount = successOps.length;

View file

@ -373,7 +373,7 @@ class AlbumChipSetActionDelegate extends ChipSetActionDelegate<AlbumFilter> with
}
// cleanup
await storageService.deleteEmptyDirectories(filledAlbums);
await storageService.deleteEmptyRegularDirectories(filledAlbums);
},
);
}
@ -454,7 +454,7 @@ class AlbumChipSetActionDelegate extends ChipSetActionDelegate<AlbumFilter> with
}
// cleanup
await storageService.deleteEmptyDirectories({album});
await storageService.deleteEmptyRegularDirectories({album});
},
);
}