fix: hide hidden libraries on the home screen

close #145
This commit is contained in:
edde746
2025-12-05 14:08:04 +01:00
parent 4eed2aa3d2
commit 6db21d93bb
2 changed files with 17 additions and 2 deletions
+11 -2
View File
@@ -325,9 +325,18 @@ class _DiscoverScreenState extends State<DiscoverScreen>
// Wait for libraries and then fetch hubs
final librariesByServer = await librariesFuture;
// Fetch hubs using the pre-fetched libraries
// Get hidden libraries to filter from hubs
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(
context,
listen: false,
);
// Fetch hubs using the pre-fetched libraries and hidden keys
final allHubs = await multiServerProvider.aggregationService
.getHubsFromAllServers(librariesByServer: librariesByServer);
.getHubsFromAllServers(
librariesByServer: librariesByServer,
hiddenLibraryKeys: hiddenLibrariesProvider.hiddenLibraryKeys,
);
// Filter out duplicate hubs that we already fetch separately
final filteredHubs = allHubs.where((hub) {
@@ -134,6 +134,7 @@ class DataAggregationService {
Future<List<PlexHub>> getHubsFromAllServers({
int? limit,
Map<String, List<PlexLibrary>>? librariesByServer,
Set<String>? hiddenLibraryKeys,
}) async {
final clients = _serverManager.onlineClients;
@@ -171,6 +172,11 @@ class DataAggregationService {
if (library.hidden != null && library.hidden != 0) {
return false;
}
// Check app-level hidden libraries
if (hiddenLibraryKeys != null &&
hiddenLibraryKeys.contains(library.globalKey)) {
return false;
}
return true;
}).toList();