From 8804fdadf41e531d87cede812632d7e87fdc1faf Mon Sep 17 00:00:00 2001 From: stopflock Date: Fri, 6 Feb 2026 09:56:08 -0600 Subject: [PATCH] Remove special "existing tags" profile case; existing tags profile now empty. --- README.md | 14 ++++++-------- lib/models/node_profile.dart | 14 ++++++++++++++ lib/state/session_state.dart | 6 +++--- lib/widgets/edit_node_sheet.dart | 21 ++------------------- lib/widgets/refine_tags_sheet.dart | 8 -------- 5 files changed, 25 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index aebb7fa..af1f9b9 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,6 @@ cp lib/keys.dart.example lib/keys.dart ## Roadmap ### Needed Bugfixes -- Temp. "existing" profile should pick up FOV if available from each direction - Imperial units - Clear search box after selecting first nav point - Make submission guide scarier @@ -119,7 +118,7 @@ cp lib/keys.dart.example lib/keys.dart - Add ability to downvote suspected locations which are old enough - Turn by turn navigation or at least swipe nav sheet up to see a list - Import/Export map providers -- Import default profiles from the website to capture changes without pushing an update? +- Update default profiles from the website on launch to capture changes ### Future Features & Wishlist - Tap direction slider to enter integer directly @@ -130,15 +129,14 @@ cp lib/keys.dart.example lib/keys.dart - Offline navigation (pending vector map tiles) ### Maybes -- "Universal Links" for better handling of profile import when app not installed? +- Icons/glyphs for profiles +- "Universal Links" for better handling of profile import when app is not installed - Yellow ring for devices missing specific tag details - Android Auto / CarPlay -- "Cache accumulating" offline area? -- "Offline areas" as tile provider? +- "Cache accumulating" offline area? Most recent / most viewed? - Grab the full latest database for each profile just like for suspected locations (instead of overpass)? -- Optional custom icons for profiles to aid identification -- Custom device providers and OSM/Overpass alternatives -- Offer options for extracting nodes which are attached to a way/relation: +- Custom data providers? (OSM/Overpass alternatives) +- Offer options for extracting nodes which are attached to a way/relation? - Auto extract (how?) - Leave it alone (wrong answer unless user chooses intentionally) - Manual cleanup (cognitive load for users) diff --git a/lib/models/node_profile.dart b/lib/models/node_profile.dart index 393e050..e532cde 100644 --- a/lib/models/node_profile.dart +++ b/lib/models/node_profile.dart @@ -270,6 +270,19 @@ class NodeProfile { /// Used as the default "" option when editing nodes /// All existing tags will flow through as additionalExistingTags static NodeProfile createExistingTagsProfile(OsmNode node) { + // Calculate FOV from existing direction ranges if applicable + double? calculatedFov; + + // If node has direction/FOV pairs, check if they all have the same FOV + if (node.directionFovPairs.isNotEmpty) { + final firstFov = node.directionFovPairs.first.fovDegrees; + + // If all directions have the same FOV, use it for the profile + if (node.directionFovPairs.every((df) => df.fovDegrees == firstFov)) { + calculatedFov = firstFov; + } + } + return NodeProfile( id: 'temp-empty-${node.id}', name: '', // Will be localized in UI @@ -278,6 +291,7 @@ class NodeProfile { requiresDirection: true, submittable: true, editable: false, + fov: calculatedFov, // Use calculated FOV from existing direction ranges ); } diff --git a/lib/state/session_state.dart b/lib/state/session_state.dart index 85c8ae9..0fe2469 100644 --- a/lib/state/session_state.dart +++ b/lib/state/session_state.dart @@ -319,9 +319,9 @@ class SessionState extends ChangeNotifier { dirty = true; } - // Only update operator profile if explicitly provided or different from current - if (operatorProfile != null && operatorProfile != _editSession!.operatorProfile) { - _editSession!.operatorProfile = operatorProfile; + // Only update operator profile if explicitly provided (including null) and different from current + if (operatorProfile != _editSession!.operatorProfile) { + _editSession!.operatorProfile = operatorProfile; // This can be null dirty = true; } if (target != null && target != _editSession!.target) { diff --git a/lib/widgets/edit_node_sheet.dart b/lib/widgets/edit_node_sheet.dart index e53d0ed..99421e0 100644 --- a/lib/widgets/edit_node_sheet.dart +++ b/lib/widgets/edit_node_sheet.dart @@ -154,40 +154,28 @@ class _EditNodeSheetState extends State { /// Check if the edit session has any actual changes compared to the original node bool _hasActualChanges(EditNodeSession session) { - debugPrint('EditNodeSheet: Checking for actual changes...'); - // Extract operation is always a change - if (session.extractFromWay) { - debugPrint('EditNodeSheet: Extract operation detected - changes found'); - return true; - } + if (session.extractFromWay) return true; // Check location change const double tolerance = 0.0000001; // ~1cm precision if ((session.target.latitude - session.originalNode.coord.latitude).abs() > tolerance || (session.target.longitude - session.originalNode.coord.longitude).abs() > tolerance) { - debugPrint('EditNodeSheet: Location change detected - changes found'); return true; } // Check direction changes if (!_directionsEqual(session.directions, session.originalNode.directionDeg)) { - debugPrint('EditNodeSheet: Direction change detected - changes found'); return true; } - // Check tag changes (including operator profile) + // Check tag changes (including operator profile and additional existing tags) final originalTags = session.originalNode.tags; final newTags = _getSessionCombinedTags(session); - debugPrint('EditNodeSheet: Original tags: $originalTags'); - debugPrint('EditNodeSheet: New combined tags: $newTags'); - if (!_tagsEqual(originalTags, newTags)) { - debugPrint('EditNodeSheet: Tag changes detected - changes found'); return true; } - debugPrint('EditNodeSheet: No changes detected'); return false; } @@ -513,11 +501,6 @@ class _EditNodeSheetState extends State { ), ); if (result != null) { - debugPrint('EditNodeSheet: Updating session from refine tags result'); - debugPrint('EditNodeSheet: Profile: ${session.profile?.name}'); - debugPrint('EditNodeSheet: AdditionalExistingTags: ${result.additionalExistingTags}'); - debugPrint('EditNodeSheet: Current session additionalExistingTags: ${session.additionalExistingTags}'); - appState.updateEditSession( operatorProfile: result.operatorProfile, refinedTags: result.refinedTags, diff --git a/lib/widgets/refine_tags_sheet.dart b/lib/widgets/refine_tags_sheet.dart index 8889c63..7edc0dd 100644 --- a/lib/widgets/refine_tags_sheet.dart +++ b/lib/widgets/refine_tags_sheet.dart @@ -101,7 +101,6 @@ class _RefineTagsSheetState extends State { // Use the additional existing tags calculated by SessionState when profile changed if (widget.currentAdditionalExistingTags != null) { _additionalExistingTags = widget.currentAdditionalExistingTags!.entries.toList(); - debugPrint('RefineTagsSheet: Loaded ${_additionalExistingTags.length} additional existing tags from session'); return; } @@ -130,8 +129,6 @@ class _RefineTagsSheetState extends State { // Include this tag as an additional existing tag _additionalExistingTags.add(MapEntry(key, value)); } - - debugPrint('RefineTagsSheet: Fallback calculated ${_additionalExistingTags.length} additional existing tags'); } /// Check if a tag should be skipped from additional existing tags @@ -203,11 +200,6 @@ class _RefineTagsSheetState extends State { ? Map.fromEntries(_additionalExistingTags.where((e) => e.key.isNotEmpty)) : null; - debugPrint('RefineTagsSheet: Returning result'); - debugPrint('RefineTagsSheet: additionalTags: $additionalTags'); - debugPrint('RefineTagsSheet: _additionalExistingTags: $_additionalExistingTags'); - debugPrint('RefineTagsSheet: _shouldShowAdditionalExistingTags: $_shouldShowAdditionalExistingTags'); - Navigator.pop(context, RefineTagsResult( operatorProfile: _selectedOperatorProfile, refinedTags: _refinedTags,