albums: hide grouped albums containing hidden items only

This commit is contained in:
Thibault Deckers 2025-05-14 22:01:45 +02:00
parent 09df269ee0
commit df63f06897
2 changed files with 9 additions and 4 deletions

View file

@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- albums: show groups to move/copy/export items - albums: show groups to move/copy/export items
- albums: hide grouped albums containing hidden items only
## <a id="v1.13.0"></a>[v1.13.0] - 2025-05-12 ## <a id="v1.13.0"></a>[v1.13.0] - 2025-05-12

View file

@ -111,21 +111,25 @@ class AlbumListPage extends StatelessWidget {
final listedStoredAlbums = <String>{}; final listedStoredAlbums = <String>{};
if (albumChipTypes.contains(AlbumChipType.stored)) { if (albumChipTypes.contains(AlbumChipType.stored)) {
final allAlbums = source.rawAlbums;
if (groupUri == null) { if (groupUri == null) {
final withinGroups = whereTypeRecursively<StoredAlbumFilter>(groupContent).map((v) => v.album).toSet(); final withinGroups = whereTypeRecursively<StoredAlbumFilter>(groupContent).map((v) => v.album).toSet();
listedStoredAlbums.addAll(source.rawAlbums.whereNot(withinGroups.contains)); listedStoredAlbums.addAll(allAlbums.whereNot(withinGroups.contains));
} else { } else {
listedStoredAlbums.addAll(groupContent.whereType<StoredAlbumFilter>().map((v) => v.album)); // check that group content is listed from source, to prevent displaying hidden content
listedStoredAlbums.addAll(groupContent.whereType<StoredAlbumFilter>().map((v) => v.album).where(allAlbums.contains));
} }
} }
final listedDynamicAlbums = <DynamicAlbumFilter>{}; final listedDynamicAlbums = <DynamicAlbumFilter>{};
if (albumChipTypes.contains(AlbumChipType.dynamic)) { if (albumChipTypes.contains(AlbumChipType.dynamic)) {
final allDynamicAlbums = dynamicAlbums.all;
if (groupUri == null) { if (groupUri == null) {
final withinGroups = whereTypeRecursively<DynamicAlbumFilter>(groupContent).toSet(); final withinGroups = whereTypeRecursively<DynamicAlbumFilter>(groupContent).toSet();
listedDynamicAlbums.addAll(dynamicAlbums.all.whereNot(withinGroups.contains)); listedDynamicAlbums.addAll(allDynamicAlbums.whereNot(withinGroups.contains));
} else { } else {
listedDynamicAlbums.addAll(groupContent.whereType<DynamicAlbumFilter>()); // check that group content is listed from source, to prevent displaying hidden content
listedDynamicAlbums.addAll(groupContent.whereType<DynamicAlbumFilter>().where(allDynamicAlbums.contains));
} }
} }