diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d14fea68..9fd58b7e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/services/storage_service.dart b/lib/services/storage_service.dart index 6780bd3de..674f0433e 100644 --- a/lib/services/storage_service.dart +++ b/lib/services/storage_service.dart @@ -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 revokeDirectoryAccess(String path); // returns number of deleted directories - Future deleteEmptyDirectories(Iterable dirPaths); + Future deleteEmptyRegularDirectories(Set dirPaths); // returns whether user granted access to a directory of his choosing Future requestDirectoryAccess(String path); @@ -132,10 +133,10 @@ class PlatformStorageService implements StorageService { // returns number of deleted directories @override - Future deleteEmptyDirectories(Iterable dirPaths) async { + Future deleteEmptyRegularDirectories(Set dirPaths) async { try { final result = await _platform.invokeMethod('deleteEmptyDirectories', { - '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) { diff --git a/lib/widgets/collection/entry_set_action_delegate.dart b/lib/widgets/collection/entry_set_action_delegate.dart index 767315ca2..908ad0861 100644 --- a/lib/widgets/collection/entry_set_action_delegate.dart +++ b/lib/widgets/collection/entry_set_action_delegate.dart @@ -350,7 +350,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware } // cleanup - await storageService.deleteEmptyDirectories(storageDirs); + await storageService.deleteEmptyRegularDirectories(storageDirs); }, ); } diff --git a/lib/widgets/common/action_mixins/entry_storage.dart b/lib/widgets/common/action_mixins/entry_storage.dart index f8b34f460..24ecffa80 100644 --- a/lib/widgets/common/action_mixins/entry_storage.dart +++ b/lib/widgets/common/action_mixins/entry_storage.dart @@ -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; diff --git a/lib/widgets/filter_grids/common/action_delegates/album_set.dart b/lib/widgets/filter_grids/common/action_delegates/album_set.dart index 3d92768e0..7c46687a4 100644 --- a/lib/widgets/filter_grids/common/action_delegates/album_set.dart +++ b/lib/widgets/filter_grids/common/action_delegates/album_set.dart @@ -373,7 +373,7 @@ class AlbumChipSetActionDelegate extends ChipSetActionDelegate with } // cleanup - await storageService.deleteEmptyDirectories(filledAlbums); + await storageService.deleteEmptyRegularDirectories(filledAlbums); }, ); } @@ -454,7 +454,7 @@ class AlbumChipSetActionDelegate extends ChipSetActionDelegate with } // cleanup - await storageService.deleteEmptyDirectories({album}); + await storageService.deleteEmptyRegularDirectories({album}); }, ); }