Skip to content

Contact discovery#251

Merged
zjs81 merged 12 commits into
mainfrom
dev-discoverScreen
Mar 6, 2026
Merged

Contact discovery#251
zjs81 merged 12 commits into
mainfrom
dev-discoverScreen

Conversation

@wel97459

@wel97459 wel97459 commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

Adds the contact discovery functionality, along with settings for controlling the companion's auto-adding of contacts.
This should close issue #21

_handleRadioSettings was removed.

- Implemented contact settings in localization files for Swedish, Ukrainian, and Chinese.
- Added new DiscoveryContact model to handle discovered contacts.
- Created DiscoveryScreen to display discovered contacts with filtering and sorting options.
- Integrated contact discovery storage to persist discovered contacts.
- Updated settings screen to include options for automatic contact addition.
- Enhanced app bar and list filter widgets for better user experience.
- Fixed variable naming inconsistencies in contact model.
… languages

- Translated contact settings and related strings in Slovenian, Swedish, Ukrainian, Chinese, Dutch, Polish, Portuguese, Russian, and Slovak.
- Added new strings for discovered contacts actions such as adding, copying, and deleting contacts.
- Enhanced the DiscoveryContact model to include a rawPacket field for better data handling.
- Updated the contacts screen to support new actions in the context menu for discovered contacts.
- Improved the contact discovery store to handle the serialization of the new rawPacket field.
@wel97459 wel97459 requested review from 446564, Copilot and zjs81 and removed request for 446564 and Copilot March 1, 2026 18:26
Copilot AI review requested due to automatic review settings March 1, 2026 18:35

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 a “Discovered Contacts” flow to surface incoming adverts separately from the main contacts list, plus device-controlled settings for which advert types should be auto-added.

Changes:

  • Introduces a Discovery screen + filtering/search to review and import/remove discovered contacts.
  • Adds persistence for discovered contacts and updates MeshCoreConnector to track discovery + auto-add flags.
  • Extends the protocol layer with auto-add config frames/flags and updates localizations for the new UI strings.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
lib/widgets/list_filter_widget.dart Adds a filter menu variant for Discovery contacts.
lib/widgets/app_bar.dart Extends AppBarTitle with toggles for subtitle/indicators visibility.
lib/utils/contact_search.dart Adds query matching helper for DiscoveryContact.
lib/storage/contact_discovery_store.dart New store for persisting discovered contacts via prefs.
lib/services/ble_debug_log_service.dart Updates debug labels for the new response code name.
lib/screens/settings_screen.dart Adds Contact Settings entry + auto-add config dialog.
lib/screens/discovery_screen.dart New Discovery UI for browsing/importing discovered contacts.
lib/screens/contacts_screen.dart Adds navigation entry to the Discovery screen + updates clipboard import parsing.
lib/models/discovery_contact.dart New model for discovered contacts (raw advert packet + metadata).
lib/models/contact.dart Fixes constant name usage for contactLastModOffset.
lib/l10n/app_en.arb Adds new English strings for contact discovery/settings.
lib/l10n/app_de.arb Adds new German strings for contact discovery/settings.
lib/l10n/app_es.arb Adds new Spanish strings for contact discovery/settings.
lib/l10n/app_fr.arb Adds new French strings for contact discovery/settings.
lib/l10n/app_it.arb Adds new Italian strings for contact discovery/settings.
lib/l10n/app_nl.arb Adds new Dutch strings for contact discovery/settings.
lib/l10n/app_pl.arb Adds new Polish strings for contact discovery/settings.
lib/l10n/app_pt.arb Adds new Portuguese strings for contact discovery/settings.
lib/l10n/app_ru.arb Adds new Russian strings for contact discovery/settings.
lib/l10n/app_sk.arb Adds new Slovak strings for contact discovery/settings.
lib/l10n/app_sl.arb Adds new Slovenian strings for contact discovery/settings.
lib/l10n/app_sv.arb Adds new Swedish strings for contact discovery/settings.
lib/l10n/app_uk.arb Adds new Ukrainian strings for contact discovery/settings.
lib/l10n/app_zh.arb Adds new Chinese strings for contact discovery/settings.
lib/l10n/app_bg.arb Adds new Bulgarian strings for contact discovery/settings.
lib/l10n/app_localizations.dart Adds new localization getters for discovery/settings UI.
lib/l10n/app_localizations_en.dart Implements new getters for English localization class.
lib/l10n/app_localizations_de.dart Implements new getters for German localization class.
lib/l10n/app_localizations_es.dart Implements new getters for Spanish localization class.
lib/l10n/app_localizations_fr.dart Implements new getters for French localization class.
lib/l10n/app_localizations_it.dart Implements new getters for Italian localization class.
lib/l10n/app_localizations_nl.dart Implements new getters for Dutch localization class.
lib/l10n/app_localizations_pl.dart Implements new getters for Polish localization class.
lib/l10n/app_localizations_pt.dart Implements new getters for Portuguese localization class.
lib/l10n/app_localizations_ru.dart Implements new getters for Russian localization class.
lib/l10n/app_localizations_sk.dart Implements new getters for Slovak localization class.
lib/l10n/app_localizations_sl.dart Implements new getters for Slovenian localization class.
lib/l10n/app_localizations_sv.dart Implements new getters for Swedish localization class.
lib/l10n/app_localizations_uk.dart Implements new getters for Ukrainian localization class.
lib/l10n/app_localizations_zh.dart Implements new getters for Chinese localization class.
lib/l10n/app_localizations_bg.dart Implements new getters for Bulgarian localization class.
lib/connector/meshcore_protocol.dart Adds auto-add config commands/flags + introduces hex2Uint8List and updates import frame signature.
lib/connector/meshcore_connector.dart Tracks discovered contacts + auto-add flags; routes adverts into contacts vs discovery; persists discovery cache.

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

Comment thread lib/connector/meshcore_connector.dart Outdated
Comment thread lib/widgets/list_filter_widget.dart
Comment thread lib/l10n/app_en.arb Outdated
Comment thread lib/screens/settings_screen.dart
Comment thread lib/connector/meshcore_connector.dart Outdated
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/screens/discovery_screen.dart Outdated
Comment thread lib/screens/contacts_screen.dart
Copilot AI review requested due to automatic review settings March 1, 2026 19:08

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

Copilot reviewed 44 out of 44 changed files in this pull request and generated 7 comments.


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

Comment thread lib/screens/settings_screen.dart
Comment thread lib/screens/contacts_screen.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/screens/discovery_screen.dart
Comment thread tools/translate.py Outdated
Comment thread lib/connector/meshcore_connector.dart
Comment thread tools/translate.py Outdated
…andling logic

refactor(settings): extract settings sending logic into a separate method
refactor(ble_debug_log_service): remove unused command case for radio settings
refactor(app_bar): update compact width threshold for app bar display
Copilot AI review requested due to automatic review settings March 1, 2026 21:06
@wel97459 wel97459 force-pushed the dev-discoverScreen branch from 43c1bf9 to fcab69f Compare March 1, 2026 21:06

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

Copilot reviewed 43 out of 43 changed files in this pull request and generated 2 comments.


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

Comment thread lib/connector/meshcore_connector.dart Outdated
Comment thread lib/screens/discovery_screen.dart
Copilot AI review requested due to automatic review settings March 1, 2026 22:40

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

Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.


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

Comment thread lib/screens/settings_screen.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/screens/discovery_screen.dart
Comment thread lib/screens/discovery_screen.dart
@ericszimmermann

ericszimmermann commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

The Discovery Screen works on my testbuild, Repeater gets added to Discovery, User due to autoAdd direct in Contact list. I can Add Contacts from the Discovery list.
On Delete however I noticed two different behaviours: repeater added from discovery will go back to discovery list. (good), users where completly deleted directly.
It would also still be nice to use the information from Discovery screen for path info of yet "unknown repeater" because they are now all in my Discovery list. Maybe even show them in Map screen.

Sincerely Eric
And thank you very much for the fast and hard work.

(State of Testbuild: commit fcab69f)

@zjs81

zjs81 commented Mar 2, 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: ddeb1edc2e

ℹ️ 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".

Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
- Implemented a new method to remove all discovered contacts from the list.
- Added confirmation dialog for deleting all discovered contacts in the discovery screen.
- Updated localization files to include new strings for deleting all discovered contacts.
- Refactored contact import logic to streamline the process.
- Enhanced the discovery handling to notify users appropriately based on settings.
@wel97459

wel97459 commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator Author

Contacts that are deleted get moved into discovered and can be re-added from the list.
Added a delete all discovered contacts option.
Changed how contacts get imported into the radio to bypass the loopback packet.
Older companion frimwares will not work as the change relies on:

#define CMD_SET_AUTOADD_CONFIG 58
#define CMD_GET_AUTOADD_CONFIG 59
#define RESP_CODE_AUTOADD_CONFIG 25

This is the commit that added them:
meshcore-dev/MeshCore@403ce1d

Repository owner deleted a comment from chatgpt-codex-connector Bot Mar 2, 2026
@wel97459

wel97459 commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 38856c67e5

ℹ️ 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".

Comment thread lib/screens/contacts_screen.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
Copilot AI review requested due to automatic review settings March 3, 2026 00:45
@wel97459 wel97459 force-pushed the dev-discoverScreen branch from efddf1d to 38856c6 Compare March 3, 2026 00:50

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

Copilot reviewed 43 out of 43 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

lib/connector/meshcore_connector.dart:4140

  • removeAllDiscoveredContacts() clears the in-memory list but does not persist the empty list to storage. After reconnect/restart, loadDiscoveredContactCache() will reload the old contacts. Persist the cleared state (and consider awaiting/unawaiting it consistently).
    required this.pathBytes,
    required this.payload,
  });

lib/connector/meshcore_connector.dart:2193

  • _checkManualAddContacts() is declared async but returns void. Since it’s invoked from the RX frame handler without await, any exception will be unhandled and harder to debug. Make it return Future<void> and call it with unawaited(...) (or await it where appropriate).
  /// Calculate timeout for a message based on radio settings and path length
  /// Returns timeout in milliseconds, considering number of hops
  int calculateTimeout({required int pathLength, int messageBytes = 100}) {
    // If we have radio settings, use them for accurate calculation
    if (_currentFreqHz != null &&

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

Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/screens/contacts_screen.dart

@zjs81 zjs81 left a comment

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.

Please review all the copilot comments and see if they are issues

Comment thread lib/connector/meshcore_connector.dart

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

Copilot reviewed 43 out of 43 changed files in this pull request and generated 1 comment.


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

Comment on lines +3832 to +3837
publicKey = packet.readBytes(32);
timestamp = packet.readInt32LE();
//TODO add signature verification
packet.skipBytes(64); // Skip signature for now
final flags = packet.readByte();
type = flags & 0x0F;

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

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

importContact parses an advertised contact from untrusted clipboard data, reads publicKey and timestamp, and then skips over a 64-byte signature without verifying it, so the app fully trusts contact identity and metadata from an unauthenticated blob. An attacker who can trick a user into importing a crafted meshcore://... string can spoof arbitrary public keys, names, locations, and paths (including impersonating existing contacts) and have them treated as legitimate contacts. You should cryptographically verify the advert signature (using the advertised public key and the same scheme as the firmware) and discard or ignore frames whose signature does not validate before creating DiscoveryContact instances.

Copilot uses AI. Check for mistakes.
@zjs81 zjs81 merged commit d96cd34 into main Mar 6, 2026
10 checks passed
@wel97459 wel97459 deleted the dev-discoverScreen branch March 7, 2026 09:48
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