From 19b3ca236e0652f47b65b0d99fde0e591adf609d Mon Sep 17 00:00:00 2001 From: stopflock Date: Tue, 10 Feb 2026 18:28:07 -0600 Subject: [PATCH] no longer lose operator profile selection when making other changes to a node --- assets/changelog.json | 5 +++++ lib/app_state.dart | 4 ++++ lib/dev_config.dart | 2 +- lib/state/session_state.dart | 13 ++++++++----- lib/widgets/add_node_sheet.dart | 1 + lib/widgets/edit_node_sheet.dart | 1 + 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/assets/changelog.json b/assets/changelog.json index 3b5fc90..7f98474 100644 --- a/assets/changelog.json +++ b/assets/changelog.json @@ -1,4 +1,9 @@ { + "2.7.1": { + "content": [ + "• Fixed operator profile selection being lost when moving node position, adjusting direction, or changing profiles" + ] + }, "2.6.4": { "content": [ "• Added imperial units support (miles, feet) in addition to metric units (km, meters)", diff --git a/lib/app_state.dart b/lib/app_state.dart index 71a70c5..3f41450 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -447,6 +447,7 @@ class AppState extends ChangeNotifier { Map? refinedTags, Map? additionalExistingTags, String? changesetComment, + bool updateOperatorProfile = false, }) { _sessionState.updateSession( directionDeg: directionDeg, @@ -456,6 +457,7 @@ class AppState extends ChangeNotifier { refinedTags: refinedTags, additionalExistingTags: additionalExistingTags, changesetComment: changesetComment, + updateOperatorProfile: updateOperatorProfile, ); // Check tutorial completion if position changed @@ -473,6 +475,7 @@ class AppState extends ChangeNotifier { Map? refinedTags, Map? additionalExistingTags, String? changesetComment, + bool updateOperatorProfile = false, }) { _sessionState.updateEditSession( directionDeg: directionDeg, @@ -483,6 +486,7 @@ class AppState extends ChangeNotifier { refinedTags: refinedTags, additionalExistingTags: additionalExistingTags, changesetComment: changesetComment, + updateOperatorProfile: updateOperatorProfile, ); // Check tutorial completion if position changed diff --git a/lib/dev_config.dart b/lib/dev_config.dart index 729efff..689db25 100644 --- a/lib/dev_config.dart +++ b/lib/dev_config.dart @@ -72,7 +72,7 @@ const Duration kOverpassQueryTimeout = Duration(seconds: 45); // Timeout for Ove const String kSuspectedLocationsCsvUrl = 'https://alprwatch.org/suspected-locations/deflock-latest.csv'; // Development/testing features - set to false for production builds -const bool kEnableDevelopmentModes = false; // Set to false to hide sandbox/simulate modes and force production mode +const bool kEnableDevelopmentModes = true; // Set to false to hide sandbox/simulate modes and force production mode // Navigation features - set to false to hide navigation UI elements while in development const bool kEnableNavigationFeatures = true; // Hide navigation until fully implemented diff --git a/lib/state/session_state.dart b/lib/state/session_state.dart index b48019f..6925295 100644 --- a/lib/state/session_state.dart +++ b/lib/state/session_state.dart @@ -215,6 +215,7 @@ class SessionState extends ChangeNotifier { Map? refinedTags, Map? additionalExistingTags, String? changesetComment, + bool updateOperatorProfile = false, }) { if (_session == null) return; @@ -232,7 +233,8 @@ class SessionState extends ChangeNotifier { ); dirty = true; } - if (operatorProfile != _session!.operatorProfile) { + // Only update operator profile when explicitly requested + if (updateOperatorProfile && operatorProfile != _session!.operatorProfile) { _session!.operatorProfile = operatorProfile; dirty = true; } @@ -264,6 +266,7 @@ class SessionState extends ChangeNotifier { Map? refinedTags, Map? additionalExistingTags, String? changesetComment, + bool updateOperatorProfile = false, }) { if (_editSession == null) return; @@ -282,9 +285,9 @@ class SessionState extends ChangeNotifier { // Handle direction requirements when profile changes _handleDirectionRequirementsOnProfileChange(oldProfile, profile); - // When profile changes but operator profile not explicitly provided, + // When profile changes and operator profile not being explicitly updated, // restore the detected operator profile (if any) - if (operatorProfile == null && _detectedOperatorProfile != null) { + if (!updateOperatorProfile && _detectedOperatorProfile != null) { _editSession!.operatorProfile = _detectedOperatorProfile; } @@ -309,8 +312,8 @@ class SessionState extends ChangeNotifier { dirty = true; } - // Only update operator profile if explicitly provided (including null) and different from current - if (operatorProfile != _editSession!.operatorProfile) { + // Only update operator profile when explicitly requested + if (updateOperatorProfile && operatorProfile != _editSession!.operatorProfile) { _editSession!.operatorProfile = operatorProfile; // This can be null dirty = true; } diff --git a/lib/widgets/add_node_sheet.dart b/lib/widgets/add_node_sheet.dart index c836866..7fef8ed 100644 --- a/lib/widgets/add_node_sheet.dart +++ b/lib/widgets/add_node_sheet.dart @@ -448,6 +448,7 @@ class _AddNodeSheetState extends State { operatorProfile: result.operatorProfile, refinedTags: result.refinedTags, changesetComment: result.changesetComment, + updateOperatorProfile: true, ); } } diff --git a/lib/widgets/edit_node_sheet.dart b/lib/widgets/edit_node_sheet.dart index 0299dbc..afe4cf1 100644 --- a/lib/widgets/edit_node_sheet.dart +++ b/lib/widgets/edit_node_sheet.dart @@ -503,6 +503,7 @@ class _EditNodeSheetState extends State { refinedTags: result.refinedTags, additionalExistingTags: result.additionalExistingTags, changesetComment: result.changesetComment, + updateOperatorProfile: true, ); } }