Add new builtin profiles, better handline of initialization, bump version

This commit is contained in:
stopflock
2025-10-24 16:23:09 -05:00
parent 2a7004e5a2
commit c8ae925dc1
6 changed files with 78 additions and 16 deletions
+12 -1
View File
@@ -8,8 +8,19 @@ class OperatorProfileState extends ChangeNotifier {
List<OperatorProfile> get profiles => List.unmodifiable(_profiles);
Future<void> init() async {
Future<void> init({bool addDefaults = false}) async {
_profiles.addAll(await OperatorProfileService().load());
// Add default operator profiles if this is first launch
if (addDefaults) {
final defaults = [
OperatorProfile.lowes(),
OperatorProfile.homeDepot(),
];
_profiles.addAll(defaults);
await OperatorProfileService().save(_profiles);
}
}
void addOrUpdateProfile(OperatorProfile p) {
+20 -11
View File
@@ -17,19 +17,28 @@ class ProfileState extends ChangeNotifier {
_profiles.where(isEnabled).toList(growable: false);
// Initialize profiles from built-in and custom sources
Future<void> init() async {
// Initialize profiles: built-in + custom
_profiles.add(NodeProfile.genericAlpr());
_profiles.add(NodeProfile.flock());
_profiles.add(NodeProfile.motorola());
_profiles.add(NodeProfile.genetec());
_profiles.add(NodeProfile.leonardo());
_profiles.add(NodeProfile.neology());
_profiles.add(NodeProfile.genericGunshotDetector());
_profiles.add(NodeProfile.shotspotter());
_profiles.add(NodeProfile.flockRaven());
Future<void> init({bool addDefaults = false}) async {
// Load custom profiles from storage
_profiles.addAll(await ProfileService().load());
// Add built-in profiles if this is first launch
if (addDefaults) {
final builtinProfiles = [
NodeProfile.genericAlpr(),
NodeProfile.flock(),
NodeProfile.motorola(),
NodeProfile.genetec(),
NodeProfile.leonardo(),
NodeProfile.neology(),
NodeProfile.genericGunshotDetector(),
NodeProfile.shotspotter(),
NodeProfile.flockRaven(),
];
_profiles.addAll(builtinProfiles);
await ProfileService().save(_profiles);
}
// Load enabled profile IDs from prefs
final prefs = await SharedPreferences.getInstance();
final enabledIds = prefs.getStringList(_enabledPrefsKey);