Skip to content

Add share contact via QR (and untested scanning of contact QR codes) #1225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 15, 2025

Conversation

thebentern
Copy link
Collaborator

@thebentern thebentern commented May 14, 2025

Can't actually test the entitlement related url handling changes until it is released to testflight sadly

ScreenRecording_05-13-2025.20-15-53_1.mov

Feel free to hijack and make it not terrible
@thebentern thebentern requested a review from Copilot May 14, 2025 00:45
Copy link
Contributor

@Copilot Copilot AI left a comment

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 adds a feature to share a contact via a QR code and updates related components to support processing the shared contact information.

  • Introduces a new ShareContactQRDialog view to generate and display the QR code for a contact.
  • Updates NodeList, MeshtasticApp, and BLEManager to integrate QR-based contact sharing and proper URL handling.
  • Adjusts entitlements and project files to include new source files.

Reviewed Changes

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

Show a summary per file
File Description
Meshtastic/Views/Nodes/NodeList.swift Adds state properties and a button to present the Share Contact QR dialog.
Meshtastic/Views/Nodes/Helpers/ShareContactQRDialog.swift New view for generating and displaying the QR code from contact data.
Meshtastic/MeshtasticApp.swift Updates URL scheme handling to extract contact data from new URL patterns.
Meshtastic/Meshtastic.entitlements Adds new applinks domain to support the updated URL scheme.
Meshtastic/Helpers/BLEManager.swift Adds a function to process and add a contact from a QR code URL.
Meshtastic/Extensions/CoreData/NodeInfoEntityToNodeInfo.swift Provides conversion from Core Data entity to proto contact model.
Meshtastic.xcodeproj/project.pbxproj Includes new source files in the project configuration.

@thebentern thebentern requested a review from Copilot May 14, 2025 00:59
Copy link
Contributor

@Copilot Copilot AI left a comment

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 introduces a “Share Contact via QR” feature, allowing users to generate and scan QR codes to share node contact information. Key changes include UI updates, URL handling for incoming share links, CoreData/protobuf conversion, BLEManager support, and associated domain entitlements.

  • Added a “Share Contact QR” button and sheet presentation in NodeList.swift
  • Created ShareContactQRDialog for QR generation/display
  • Extended MeshtasticApp to handle incoming v/# URLs and BLEManager to add contacts
  • Added CoreData → protobuf conversion and updated entitlements/xcodeproj

Reviewed Changes

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

Show a summary per file
File Description
Meshtastic/Views/Nodes/NodeList.swift UI: button and sheet logic for presenting ShareContactQRDialog
Meshtastic/Views/Nodes/Helpers/ShareContactQRDialog.swift New SwiftUI dialog for QR code generation/display
Meshtastic/MeshtasticApp.swift URL handling for meshtastic.org/v/# links and alert dialogs
Meshtastic/Meshtastic.entitlements Added associated domain applinks:meshtastic.org/v/*
Meshtastic/Helpers/BLEManager.swift addContactFromURL method to decode and send shared contact
Meshtastic/Extensions/CoreData/NodeInfoEntityToNodeInfo.swift Extension to convert CoreData entity to protobuf NodeInfo
Meshtastic.xcodeproj/project.pbxproj Added new files to the Xcode project build phases/groups

@thebentern thebentern requested a review from Copilot May 14, 2025 01:06
Copy link
Contributor

@Copilot Copilot AI left a comment

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 adds a new "share contact via QR" feature, updating both the UI and the underlying data handling for sharing node contact information.

  • Introduces a new share contact button and corresponding modal dialog for QR generation in the NodeList view.
  • Implements a ShareContactQRDialog view that generates a QR code for a contact and integrates URL handling for sharing contacts.
  • Adds new API and helper methods for processing contact information, with necessary project file adjustments.

Reviewed Changes

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

Show a summary per file
File Description
Meshtastic/Views/Nodes/NodeList.swift Added state properties, button, and sheet for sharing contact via QR code.
Meshtastic/Views/Nodes/Helpers/ShareContactQRDialog.swift New view to generate and display a QR code for sharing contact details.
Meshtastic/MeshtasticApp.swift Updated URL handling to support the new share contact URL pattern.
Meshtastic/Helpers/BLEManager.swift Added a method to process and add contact data from a QR-generated URL.
Meshtastic/Extensions/CoreData/NodeInfoEntityToNodeInfo.swift Added conversion helper to create a protobuf NodeInfo from Core Data.
Meshtastic.xcodeproj/project.pbxproj Updated project file to include new source files.

@thebentern thebentern changed the title Add share contact via QR Add share contact via QR (and untested scanning of contact QR codes) May 14, 2025
@thebentern thebentern requested a review from garthvh May 14, 2025 01:18
@thebentern thebentern requested a review from Copilot May 14, 2025 21:40
Copy link
Contributor

@Copilot Copilot AI left a comment

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 adds functionality for sharing a contact via QR code and processing contact URLs, along with minor protobuf updates and related UI integrations. Key changes include:

  • Adding new protobuf cases and fields for a lipo battery gauge and map report options.
  • Introducing a new SwiftUI view (ShareContactQRDialog) and updating the NodeList view to trigger QR sharing.
  • Extending URL handling in the app, BLE manager contact processing, and adding a corresponding AppIntent.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
protobufs Updated subproject commit hash.
MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift Added a new sensor type “max17261”.
MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift Introduced a new field for location reporting opt-in.
MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift Added a new “shouldReportLocation” Boolean field.
MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift
MeshtasticProtobufs/Sources/meshtastic/deviceonly.pb.swift
Added computed properties related to the “isUnmessagable” status.
Meshtastic/Views/Nodes/NodeList.swift Added a new share contact QR button and sheet presentation.
Meshtastic/Views/Nodes/Helpers/ShareContactQRDialog.swift New UI view for generating and displaying the QR code for sharing a contact.
Meshtastic/MeshtasticApp.swift Updated URL-handling for the new “meshtastic.org/v/#” format and contact processing.
Meshtastic/Helpers/BLEManager.swift Introduced the addContactFromURL function for creating contacts via a URL.
Meshtastic/AppIntents/AddContactIntent.swift Added new AppIntent to support adding contacts using a URL.
Meshtastic.xcodeproj/project.pbxproj & Localizable.xcstrings Updated project files and localization files to support the new features.
Comments suppressed due to low confidence (1)

MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift:122

  • [nitpick] The naming 'hasOptedReportLocation_p' is slightly inconsistent with similar fields (e.g., 'shouldReportLocation' in ModuleConfig). Consider renaming it for better consistency across the codebase.
public var hasOptedReportLocation_p: Bool = false

@thebentern thebentern requested a review from Copilot May 14, 2025 21:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds the ability to share and scan contact information via QR codes, updates protobuf schemas, and integrates URL handling for contact links.

  • Extend SwiftProtobuf definitions for new sensor types, location-sharing flags, and optional messaging blocks.
  • Implement ShareContactQRDialog, integrate into NodeList, and add URL handling in App and AddContactIntent.
  • Add BLEManager.addContactFromURL, entitlement updates, project file references, and CoreData-to-proto conversion helper.

Reviewed Changes

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

Show a summary per file
File Description
protobufs Update submodule commit for MeshtasticProtobufs
telemetry.pb.swift Add max17261 sensor type
mqtt.pb.swift Add hasOptedReportLocation_p field
module_config.pb.swift Add shouldReportLocation field
mesh.pb.swift Add optional isUnmessagable on User
deviceonly.pb.swift Mirror isUnmessagable changes in UserLite
NodeList.swift Add share-QR button & sheet
ShareContactQRDialog.swift New QR generation view
MeshtasticApp.swift Handle meshtastic.org/v/# URLs
Meshtastic.entitlements Add associated domain for /v/* links
BLEManager.swift Implement addContactFromURL
NodeInfoEntityToNodeInfo.swift Convert CoreData entity to protobuf
AddContactIntent.swift AppIntent for adding contact URLs
project.pbxproj Register new source files
Localizable.xcstrings Add new localization keys
Comments suppressed due to low confidence (2)

MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift:122

  • [nitpick] The trailing _p in hasOptedReportLocation_p is nonstandard. Rename to hasOptedReportLocation to match Swift naming conventions and avoid confusion.
public var hasOptedReportLocation_p: Bool = false

Meshtastic/Views/Nodes/NodeList.swift:43

  • [nitpick] This line uses spaces for indentation while most of the file uses tabs. Align indent style with the rest of the project for consistency.
@State private var isPresentingShareContactQR = false

@thebentern thebentern requested a review from Copilot May 14, 2025 22:13
Copy link
Contributor

@Copilot Copilot AI left a comment

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 adds support for sharing contacts via QR code and scanning contact QR codes by introducing new UI components, BLE handling logic, and associated protobuf updates.

  • Added a new ShareContactQRDialog view and updated NodeList to present the QR sharing UI.
  • Updated URL handling in MeshtasticApp and BLEManager to decode contact information from a new "meshtastic.org/v/#" URL.
  • Introduced a new AppIntent to add contacts from a URL along with corresponding localization and project file updates.

Reviewed Changes

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

Show a summary per file
File Description
protobufs Updated submodule reference.
MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift Added new sensor type case (max17261).
MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift Introduced new boolean field (hasOptedReportLocation_p).
MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift Added new property (shouldReportLocation) in map report settings.
MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift Added computed properties for “isUnmessagable” in User.
MeshtasticProtobufs/Sources/meshtastic/deviceonly.pb.swift Added similar computed properties for “isUnmessagable”.
Meshtastic/Views/Nodes/NodeList.swift Inserted a new button and sheet presentation to share contact QR codes.
Meshtastic/Views/Nodes/Helpers/ShareContactQRDialog.swift New SwiftUI dialog view for sharing contact as a QR code.
Meshtastic/MeshtasticApp.swift Modified URL handling to process contact URLs.
Meshtastic/Meshtastic.entitlements Updated associated domains for new URL pattern.
Meshtastic/Helpers/BLEManager.swift Added addContactFromURL function to decode and process shared contact data.
Meshtastic/AppIntents/AddContactIntent.swift New AppIntent for adding a contact via a provided URL.
Meshtastic.xcodeproj/project.pbxproj Updated file references with new source files.
Localizable.xcstrings Added new localization entries for shared contact UI texts.
Comments suppressed due to low confidence (1)

MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift:1508

  • [nitpick] The property name 'isUnmessagable' may be confusing or potentially misspelled. Consider renaming it to 'isUnmessageable' for clarity.
public var isUnmessagable: Bool {

@thebentern
Copy link
Collaborator Author

@garthvh I updated the protobufs here

@garthvh
Copy link
Member

garthvh commented May 15, 2025

Cool I want to gate it by firmware version but we can add that

@garthvh garthvh merged commit b47ce37 into 2.6.3 May 15, 2025
2 checks passed
@garthvh garthvh deleted the add-share-contact branch May 15, 2025 15:47
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.

3 participants