fix: accept interoperable QR URL hosts#2116
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughContact and channel URL handling now uses structured host, path, and fragment validation. Contact routing supports canonical and ChangesURL handling
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant EntryPoint
participant ContactURLHandler
participant AccessoryManager
EntryPoint->>ContactURLHandler: Validate contact URL
ContactURLHandler-->>EntryPoint: Return supported URL result
EntryPoint->>ContactURLHandler: Handle contact URL
ContactURLHandler->>AccessoryManager: Import contact
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Meshtastic/Views/Messages/MessageText.swift`:
- Around line 197-200: Update docs/user/messages.md to document that
message-text contact links handled by ContactURLHandler, including
www.meshtastic.org links, are intercepted instead of opening in the default
browser. Keep the documentation aligned with the behavior in MessageText.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 19a68736-0b65-4ed9-a2a3-6c726d16e6fc
📒 Files selected for processing (7)
Meshtastic/AppIntents/AddContactIntent.swiftMeshtastic/Helpers/ContactURLHandler.swiftMeshtastic/Helpers/MeshtasticChannelURL.swiftMeshtastic/MeshtasticApp.swiftMeshtastic/Views/Messages/MessageText.swiftMeshtasticTests/EntityTests.swiftMeshtasticTests/MeshtasticChannelURLTests.swift
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/user/messages.md`:
- Line 148: Regenerate the bundled documentation for the updated
docs/user/messages.md content by running the repository’s build-docs.sh command
with Meshtastic/Resources/docs as output, then run copy-snapshots.sh with
Meshtastic/Resources/docs/assets/screenshots and include all generated changes.
- Line 148: Update the message-bubble link documentation to replace both
references to Safari with “the system browser,” reflecting
MessageText.handleURL’s .systemAction behavior. Keep the exceptions for
Meshtastic channel and contact links opening the in-app import flow, and retain
Meshtastic documentation links as system-browser links.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 248eba44-2758-4c62-9ecb-4ab3aa9eb231
📒 Files selected for processing (2)
MeshtasticTests/EntityTests.swiftdocs/user/messages.md
There was a problem hiding this comment.
🧹 Nitpick comments (1)
MeshtasticTests/MeshtasticChannelURLTests.swift (1)
41-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLeverage parameterized testing.
Instead of using a
forloop inside the test function, you can utilize Swift Testing's built-in parameterized testing feature. This approach is more idiomatic and provides individual, granular test results for each channel count in the test runner.♻️ Proposed refactor
- `@Test` func allSupportedChannelCountsPreserveSettingsForReplaceAndAdd() throws { - for channelCount in 1 ... 8 { - let channelSet = makeChannelSet(channelCount: channelCount) - let replace = try MeshtasticChannelURL.parse(MeshtasticChannelURL.urlString(for: channelSet)) - let add = try MeshtasticChannelURL.parse(MeshtasticChannelURL.urlString(for: channelSet, addChannels: true)) - - `#expect`(replace.channelSet.settings == channelSet.settings, "\(channelCount)-channel replace settings") - `#expect`(replace.channelSet.loraConfig == channelSet.loraConfig, "\(channelCount)-channel replace LoRa config") - `#expect`(add.channelSet.settings == channelSet.settings, "\(channelCount)-channel add settings") - `#expect`(!add.channelSet.hasLoraConfig, "\(channelCount)-channel add must not retune") - } - } + `@Test`(arguments: 1 ... 8) + func allSupportedChannelCountsPreserveSettingsForReplaceAndAdd(channelCount: Int) throws { + let channelSet = makeChannelSet(channelCount: channelCount) + let replace = try MeshtasticChannelURL.parse(MeshtasticChannelURL.urlString(for: channelSet)) + let add = try MeshtasticChannelURL.parse(MeshtasticChannelURL.urlString(for: channelSet, addChannels: true)) + + `#expect`(replace.channelSet.settings == channelSet.settings, "\(channelCount)-channel replace settings") + `#expect`(replace.channelSet.loraConfig == channelSet.loraConfig, "\(channelCount)-channel replace LoRa config") + `#expect`(add.channelSet.settings == channelSet.settings, "\(channelCount)-channel add settings") + `#expect`(!add.channelSet.hasLoraConfig, "\(channelCount)-channel add must not retune") + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@MeshtasticTests/MeshtasticChannelURLTests.swift` around lines 41 - 52, Refactor allSupportedChannelCountsPreserveSettingsForReplaceAndAdd to use Swift Testing parameterized testing with channel counts 1 through 8 instead of looping inside the test. Keep the existing replace/add parsing and expectations unchanged so each channel count produces an individual test result.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@MeshtasticTests/MeshtasticChannelURLTests.swift`:
- Around line 41-52: Refactor
allSupportedChannelCountsPreserveSettingsForReplaceAndAdd to use Swift Testing
parameterized testing with channel counts 1 through 8 instead of looping inside
the test. Keep the existing replace/add parsing and expectations unchanged so
each channel count produces an individual test result.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 699ee49b-0b08-4304-80d6-1fa415c52da1
📒 Files selected for processing (5)
Meshtastic/Resources/docs/index.jsonMeshtastic/Resources/docs/markdown/user/messages.mdMeshtastic/Resources/docs/user/messages.htmlMeshtasticTests/MeshtasticChannelURLTests.swiftdocs/user/messages.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/user/messages.md
Summary
Root cause
Android accepts both meshtastic.org and www.meshtastic.org for channel and contact links. Apple only accepted the bare host for channels and routed contacts with a literal meshtastic.org/v/# substring, so valid links using the alternate host were not imported.
Evidence
xcodebuild test -quiet -project Meshtastic.xcodeproj -scheme Meshtastic -only-testing:MeshtasticTests/MeshtasticChannelURLTests -only-testing:MeshtasticTests/ShareContactQRTests
No UI layout changes: this is URL routing and protocol regression coverage.
Summary by CodeRabbit
www.meshtastic.org), and tightened in-app importing to the supported URL formats only.