Skip to content

feat: Enhance privacy settings and telemetry#308

Merged
wel97459 merged 2 commits into
devfrom
dev-privacy
Mar 20, 2026
Merged

feat: Enhance privacy settings and telemetry#308
wel97459 merged 2 commits into
devfrom
dev-privacy

Conversation

@wel97459

Copy link
Copy Markdown
Collaborator
  • Implemented telemetry options for contacts, allowing users to enable or disable telemetry data sharing.
  • Introduced a clear chat option in the chat interface for better message management.
  • Updated the telemetry screen to handle telemetry data for contacts, including battery level.
  • Refactored contact settings to include telemetry options and improved UI for better user experience.

Copilot AI review requested due to automatic review settings March 19, 2026 22:03

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

This PR enhances privacy/telemetry controls and adds chat management actions, expanding the existing MeshCore contact/chat UI to support telemetry permissions and “clear chat” operations.

Changes:

  • Adds a new Privacy Settings dialog to configure telemetry sharing modes, advert location policy, and multi-ACK behavior.
  • Extends telemetry to work with chat contacts (new telemetry request/response handling) and adds per-contact telemetry permission flags.
  • Adds “Clear Chat” actions to 1:1 chats and channel chats, plus new contact settings options from the chat UI.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
lib/screens/telemetry_screen.dart Refactors telemetry to target generic contacts (incl. chat), updates frame parsing, and battery snapshot updates.
lib/screens/settings_screen.dart Replaces privacy mode toggle with a richer privacy/telemetry settings dialog.
lib/screens/repeater_hub_screen.dart Updates TelemetryScreen navigation to new contact parameter.
lib/screens/contacts_screen.dart Switches favorite toggling to the new setContactFlags API.
lib/screens/chat_screen.dart Adds a menu with contact info/settings/telemetry and clear-chat; refactors contact usage.
lib/screens/channel_chat_screen.dart Adds a menu action to clear channel chat.
lib/models/contact.dart Adds computed getters for telemetry permission flags.
lib/connector/meshcore_protocol.dart Adds telemetry mode constants and a buildSendTelemetryReq frame builder.
lib/connector/meshcore_connector.dart Adds telemetry mode getters/setter, introduces setContactFlags, and implements message clearing APIs.
lib/l10n/.arb, lib/l10n/app_localizations.dart, lib/l10n/app_localizations.dart Adds new localization keys for privacy/contact/telemetry UI text.

💡 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_protocol.dart
Comment thread lib/connector/meshcore_connector.dart
Comment thread lib/screens/chat_screen.dart Outdated
Comment thread lib/screens/telemetry_screen.dart
Comment thread lib/screens/settings_screen.dart Outdated
Comment thread lib/screens/telemetry_screen.dart
Comment thread lib/screens/telemetry_screen.dart Outdated
Comment thread lib/screens/settings_screen.dart
Comment thread lib/screens/settings_screen.dart
@wel97459 wel97459 changed the base branch from main to dev March 19, 2026 22:31
@wel97459

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

_telemetryModeEnv = telemetryFlag >> 2 & 0x03;
_telemetryModeLoc = telemetryFlag >> 4 & 0x03;

P1 Badge Decode telemetry location/env bits in the encoded order

setTelemetryModeBase() writes the location mode into bits 2-3 and the environment mode into bits 4-5 ((_telemetryModeEnv << 4) | (_telemetryModeLoc << 2) | _telemetryModeBase), but respCodeSelfInfo parses those two fields the other way around here. After any reconnect or refreshDeviceInfo(), the Privacy dialog will show location/env swapped, and saving again can push the wrong permission modes back to the device.

ℹ️ 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/chat_screen.dart Outdated
Comment thread lib/screens/settings_screen.dart
- Implemented telemetry options for contacts, allowing users to enable or disable telemetry data sharing.
- Introduced a clear chat option in the chat interface for better message management.
- Updated the telemetry screen to handle telemetry data for contacts, including battery level.
- Refactored contact settings to include telemetry options and improved UI for better user experience.
@wel97459

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: 3f780ac667

ℹ️ 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/telemetry_screen.dart
Comment thread lib/screens/telemetry_screen.dart
Comment thread lib/connector/meshcore_connector.dart
@wel97459

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: 5ad9263cc4

ℹ️ 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 on lines +2402 to +2404
(_telemetryModeEnv << 4) |
(_telemetryModeLoc << 2) |
_telemetryModeBase,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Encode location/environment telemetry bits in the same order

setTelemetryModeBase() packs location into bits 2-3 and env into bits 4-5 here, but _handleSelfInfo() in the same file decodes bits 2-3 into _telemetryModeEnv and bits 4-5 into _telemetryModeLoc (lib/connector/meshcore_connector.dart:2774-2777). That means the new privacy dialog will round-trip these two dropdowns incorrectly: after a save + refresh, location and environment modes come back swapped, and changing one can silently alter the other on-device.

Useful? React with 👍 / 👎.

Comment on lines +175 to +177
frame = buildSendTelemetryReq(widget.contact.publicKey);
}
await connector.sendFrame(frame);

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 Start a local timeout for chat telemetry requests

For chat contacts this path now sends CMD_SEND_TELEMETRY_REQ and returns without arming any fallback timer. The only timeout is created later in _setupMessageListener() after a RESP_CODE_SENT, so if a node rejects or does not support this deprecated command (docs/BLE_PROTOCOL.md:618-624) and answers with RESP_CODE_ERR/nothing instead, _isLoading never resets and the telemetry screen stays stuck spinning until it is closed.

Useful? React with 👍 / 👎.

Comment on lines +1052 to +1056
final contact = widget.contact;
bool smazEnabled = connector.isContactSmazEnabled(contact.publicKeyHex);
bool teleBaseEnabled = contact.teleBaseEnabled;
bool teleLocEnabled = contact.teleLocEnabled;
bool teleEnvEnabled = contact.teleEnvEnabled;

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 Resolve the latest contact before seeding the settings dialog

This dialog snapshots all three telemetry toggles from widget.contact, which is the stale contact object captured when the chat screen was opened. If the contact record is refreshed later (for example by a contact reload or a flag change from another screen), pressing Save still sends every toggle through setContactFlags(), so untouched permissions are reverted to the old values from that stale snapshot.

Useful? React with 👍 / 👎.

@wel97459 wel97459 merged commit c9e3ceb into dev Mar 20, 2026
6 checks passed
wel97459 added a commit that referenced this pull request Mar 21, 2026
* feat: Enhance privacy settings and telemetry

- Implemented telemetry options for contacts, allowing users to enable or disable telemetry data sharing.
- Introduced a clear chat option in the chat interface for better message management.
- Updated the telemetry screen to handle telemetry data for contacts, including battery level.
- Refactored contact settings to include telemetry options and improved UI for better user experience.

* feat: Refactor repeater resolution logic across multiple screens
wel97459 added a commit that referenced this pull request Mar 21, 2026
* feat: Enhance privacy settings and telemetry

- Implemented telemetry options for contacts, allowing users to enable or disable telemetry data sharing.
- Introduced a clear chat option in the chat interface for better message management.
- Updated the telemetry screen to handle telemetry data for contacts, including battery level.
- Refactored contact settings to include telemetry options and improved UI for better user experience.

* feat: Refactor repeater resolution logic across multiple screens
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.

2 participants