break up settings monopoly

This commit is contained in:
stopflock
2025-08-07 17:59:35 -05:00
parent 58ecf550a5
commit a2aa71de8f
9 changed files with 610 additions and 532 deletions
+5
View File
@@ -250,6 +250,11 @@ class AppState extends ChangeNotifier {
if (p.builtin) return;
_enabled.remove(p);
_profiles.removeWhere((x) => x.id == p.id);
// Safety: Always have at least one enabled profile
if (_enabled.isEmpty) {
final builtIn = _profiles.firstWhere((profile) => profile.builtin, orElse: () => _profiles.first);
_enabled.add(builtIn);
}
_saveEnabledProfiles();
ProfileService().save(_profiles);
notifyListeners();