fix(trackers): preserve Plex library context

This commit is contained in:
edde746
2026-05-12 22:46:38 +02:00
parent 3a01fa25a7
commit de129fbb0a
30 changed files with 845 additions and 119 deletions
+6 -3
View File
@@ -446,11 +446,14 @@ class SettingsService extends BaseSharedPreferencesService {
static Map<String, String> defaultKeyboardShortcuts() => _defaultKeyboardShortcuts();
static Map<String, HotKey> defaultKeyboardHotkeys() => _defaultKeyboardHotkeys();
/// Null keys bypass the filter so we err on the side of syncing.
/// Unknown libraries are allowed only when no filter is configured.
bool isLibraryAllowedForTracker(TrackerService service, String? libraryGlobalKey) {
if (libraryGlobalKey == null) return true;
final inList = read(trackerFilterIdsPref(service)).contains(libraryGlobalKey);
final filterIds = read(trackerFilterIdsPref(service));
final mode = read(trackerFilterModePref(service));
if (libraryGlobalKey == null) {
return mode == TrackerLibraryFilterMode.blacklist && filterIds.isEmpty;
}
final inList = filterIds.contains(libraryGlobalKey);
return mode == TrackerLibraryFilterMode.blacklist ? !inList : inList;
}