Skip to content

Add path tracing functionality to map screen#165

Merged
zjs81 merged 2 commits into
mainfrom
dev-NewPathTracing
Feb 14, 2026
Merged

Add path tracing functionality to map screen#165
zjs81 merged 2 commits into
mainfrom
dev-NewPathTracing

Conversation

@wel97459

Copy link
Copy Markdown
Collaborator
  • Implemented path tracing feature in the map screen, allowing users to add nodes to a path and visualize it on the map as they select nodes.
  • Added buttons for starting path tracing, removing the last node, and running the path trace.
  • Introduced a new overlay to display current path information and distance.
  • Updated localization files for multiple languages to include new strings related to path tracing.
  • Refactored map rendering logic to accommodate path tracing visuals.

- Implemented path tracing feature in the map screen, allowing users to add nodes to a path and visualize it on the map.
- Added buttons for starting path tracing, removing the last node, and running the path trace.
- Introduced a new overlay to display current path information and distance.
- Updated localization files for multiple languages to include new strings related to path tracing.
- Refactored map rendering logic to accommodate path tracing visuals.
Copilot AI review requested due to automatic review settings February 12, 2026 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an in-map “path trace” builder workflow so users can select nodes on the main map, visualize the selected path, and then run an actual trace in the dedicated Path Trace screen. Also updates localization resources to support new UI strings.

Changes:

  • Add path-building mode to MapScreen (select nodes to build a path, show overlay, run trace).
  • Refactor PathTraceMapScreen map rendering and distance formatting utilities.
  • Update ARB + generated localization files with new path-tracing strings (and remove some duplicate entries).

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/screens/path_trace_map.dart Extracts distance helpers, refactors map widget build, improves unknown-hop labeling, adds additional error handling.
lib/screens/map_screen.dart Adds path-building mode, overlay UI (tap-to-add, remove last, run trace), and polyline rendering during path build.
lib/l10n/app_en.arb Adds new strings for map path building + clear tooltip.
lib/l10n/app_de.arb Adds new strings; also removes duplicate entries/normalizes formatting.
lib/l10n/app_es.arb Adds new strings; also removes duplicate entries/normalizes formatting.
lib/l10n/app_fr.arb Adds new strings for map path building.
lib/l10n/app_it.arb Adds new strings for map path building.
lib/l10n/app_nl.arb Adds new strings for map path building.
lib/l10n/app_pl.arb Adds new strings for map path building.
lib/l10n/app_pt.arb Adds new strings for map path building.
lib/l10n/app_ru.arb Adds new strings for map path building.
lib/l10n/app_sk.arb Adds new strings for map path building.
lib/l10n/app_sl.arb Adds new strings for map path building.
lib/l10n/app_sv.arb Adds new strings for map path building.
lib/l10n/app_uk.arb Adds new strings for map path building.
lib/l10n/app_zh.arb Adds new strings for map path building.
lib/l10n/app_bg.arb Adds new strings for map path building.
lib/l10n/app_localizations.dart Adds new localization getters for map path-building + clear tooltip.
lib/l10n/app_localizations_en.dart Implements new localization getters.
lib/l10n/app_localizations_de.dart Implements new localization getters.
lib/l10n/app_localizations_es.dart Implements new localization getters.
lib/l10n/app_localizations_fr.dart Implements new localization getters.
lib/l10n/app_localizations_it.dart Implements new localization getters.
lib/l10n/app_localizations_nl.dart Implements new localization getters.
lib/l10n/app_localizations_pl.dart Implements new localization getters.
lib/l10n/app_localizations_pt.dart Implements new localization getters.
lib/l10n/app_localizations_ru.dart Implements new localization getters.
lib/l10n/app_localizations_sk.dart Implements new localization getters.
lib/l10n/app_localizations_sl.dart Implements new localization getters.
lib/l10n/app_localizations_sv.dart Implements new localization getters.
lib/l10n/app_localizations_uk.dart Implements new localization getters.
lib/l10n/app_localizations_zh.dart Implements new localization getters.
lib/l10n/app_localizations_bg.dart Implements new localization getters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 6 to 8
import 'package:latlong2/latlong.dart';
import 'package:meshcore_open/screens/path_trace_map.dart';
import 'package:provider/provider.dart';

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map_screen.dart imports path_trace_map.dart just to reuse getPathDistanceMeters / formatDistance. This introduces an unnecessary dependency on a UI screen file and makes reuse harder. Consider moving these helpers into a small shared utility (e.g., lib/utils/path_distance.dart) and importing that instead.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true there is a navigation to PathTraceMapScreen method.

Comment on lines +156 to +160
_polylines.clear();
_polylines.addAll(
_points.length > 1
? [
Polyline(

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build() is mutating state by clearing/rebuilding _polylines on every rebuild. This makes the widget harder to reason about and can lead to subtle issues if build is triggered often. Prefer deriving a local final polylines = ... from _points (without mutating state), or update _polylines only inside setState when _points changes.

Copilot uses AI. Check for mistakes.
Comment on lines +1454 to +1457
_pathTrace.add(
contact.publicKey[0],
); // Add first 16 bytes of public key to path trace
_points.add(LatLng(contact.latitude!, contact.longitude!));

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment says “Add first 16 bytes of public key”, but the code only appends contact.publicKey[0] (1 byte). Please correct the comment to match the actual behavior (or adjust the logic if the intent really is 16 bytes).

Copilot uses AI. Check for mistakes.
Comment on lines +4757 to +4762
/// No description provided for @pathTrace_clearTooltip.
///
/// In en, this message translates to:
/// **'Clear path.'**
String get pathTrace_clearTooltip;

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathTrace_clearTooltip is added to localizations, but it is not referenced anywhere in the Dart codebase. Either wire this up to the intended UI (e.g., a clear-path action/tooltip) or remove the string to avoid unused translations and translator churn.

Suggested change
/// No description provided for @pathTrace_clearTooltip.
///
/// In en, this message translates to:
/// **'Clear path.'**
String get pathTrace_clearTooltip;

Copilot uses AI. Check for mistakes.
@zjs81

zjs81 commented Feb 12, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1afd6c9a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

MaterialPageRoute(
builder: (context) => PathTraceMapScreen(
title: l10n.contacts_pathTrace,
path: Uint8List.fromList(_pathTrace),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce max trace path length before sending request

The selected path is passed straight through as Uint8List.fromList(_pathTrace) with no size check, so users can keep adding nodes until the trace payload exceeds the protocol frame budget (trace header + payload, with frames capped at 172 bytes). In larger meshes this can produce oversized trace requests that are rejected or truncated by the device transport; add a guard and user feedback before allowing/sending paths beyond the supported length.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fix this

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex address that feedback

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Testing

  • git diff -- lib/screens/map_screen.dart
  • git status --short
  • ⚠️ ~/flutter/bin/dart format lib/screens/map_screen.dart (Flutter/Dart SDK path unavailable in this environment: /root/flutter/bin/dart not found)

View task →

Comment on lines +469 to +470
onLongPress: () =>
_isBuildingPathTrace ? _showNodeInfo(context, contact) : null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Avoid swallowing long-presses when path mode is off

This always installs a marker onLongPress callback, but when _isBuildingPathTrace is false the callback just returns null. That still captures long-press gestures on top of markers, so map-level long-press behavior (like the share-marker flow on the map) no longer triggers in those spots. Make the handler itself null when path tracing is inactive instead of returning null from an active handler.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fix this

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex address that feedback

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Updated marker long-press wiring in MapScreen so GestureDetector.onLongPress is only assigned when _isBuildingPathTrace is active; otherwise it is null. This prevents markers from swallowing long-press gestures when path tracing is off while preserving the path-mode behavior. lib/screens/map_screen.dartL468-L474
  • Committed the change with message: Fix marker long-press handler in path mode (commit 4aa2e05), and created a follow-up PR via the make_pr tool.

Testing

  • ⚠️ python - <<'PY' ... urllib.request.urlopen('https://api.github.com/search/issues?q=flutter+GestureDetector+onLongPress') ... PY (web-search attempt failed due network tunnel restriction: 403 Forbidden).
  • ⚠️ ~/flutter/bin/flutter analyze lib/screens/map_screen.dart (Flutter binary not present at that path in this environment).
  • ⚠️ flutter --version (command not found in environment).

View task →

@446564

446564 commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

tested and working well other than above changes

@446564 446564 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zjs81 zjs81 merged commit 7308186 into main Feb 14, 2026
6 checks passed
@wel97459 wel97459 deleted the dev-NewPathTracing branch March 7, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants