feat: Add KMP URI handling, import, and QR code generation support#4856
Merged
jamesarich merged 8 commits intomainfrom Mar 19, 2026
Merged
feat: Add KMP URI handling, import, and QR code generation support#4856jamesarich merged 8 commits intomainfrom
jamesarich merged 8 commits intomainfrom
Conversation
This commit enables deep link and URI handling for the desktop application, allowing it to process `meshtastic://` and `meshtastic.org` links from command line arguments and the operating system. It also integrates shared UI components for importing contacts and channels via QR codes or URIs.
Specific changes include:
- **Desktop URI Handling**:
- Updated `main` to process Meshtastic URIs passed via command line arguments.
- Implemented `setOpenURIHandler` using AWT Desktop API to handle URIs triggered by the OS.
- Integrated `UIViewModel` into the desktop entry point to handle scanned/opened URIs.
- **UI & Navigation**:
- Added `SharedContactDialog` and `ScannedQrCodeDialog` to `DesktopMainScreen` to handle incoming contact and channel sharing requests.
- Integrated `MeshtasticImportFAB` into `DesktopAdaptiveContactsScreen` and `DesktopAdaptiveNodeListScreen` to allow manual URI/QR imports.
- Added connection state checks to ensure import actions are only available when connected to a node.
- **Documentation & Build**:
- Updated `kmp-status.md`, `AGENTS.md`, and `GEMINI.md` to reflect the addition of `feature:widget` (Android-only) and the KMP status of other modules.
- Updated Kotlin to `2.3.20` and Koin to `4.2.0` in `agent-playbooks/README.md`.
- **Dependencies**: Injected `UIViewModel` into various desktop screens to manage shared application state for imports and dialogs.
Signed-off-by: James Rich <[email protected]>
…support - Introduced LocalBarcodeScannerSupported and LocalNfcScannerSupported CompositionLocals in core:ui. - Updated MeshtasticImportFAB to dynamically show/hide hardware-dependent items. - Enabled scanner support flags in Android MainActivity. - Added UI tests for supported and unsupported hardware scenarios in ImportFabUiTest.
- Replaced Android-only ZXing bitmap generation with qrcode-kotlin logic in commonMain. - Implemented rememberQrCodePainter to draw raw QR matrices natively on the Compose Canvas. - Ensured a 4-module quiet zone is drawn around the matrix to prevent scanning failures on dark backgrounds. - Removed expect/actual bitmap constraints, making QR rendering fully functional across Android, Desktop, iOS, and Web. - Removed ZXing dependencies from core:model and core:ui.
…ng on Desktop - Moved ChannelScreen and ChannelsNavigation from androidMain to commonMain. - Refactored ChannelScreen to use KMP abstractions for toast messages and error handling. - Wired Desktop Messaging FAB to the shared Channels graph to display the inline QR Code sharing UI. - Removed temporary top app bar actions from ChannelConfigScreen.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4856 +/- ##
==========================================
- Coverage 10.50% 10.41% -0.10%
==========================================
Files 551 550 -1
Lines 18197 18183 -14
Branches 2717 2714 -3
==========================================
- Hits 1912 1894 -18
- Misses 16089 16093 +4
Partials 196 196
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: James Rich <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several significant improvements and refactors to the codebase, focusing on QR code generation, multiplatform support, and UI feature detection. The most notable changes are the migration from ZXing to
qrcode-kotlinfor QR code generation, the addition of platform capability providers for barcode and NFC scanning, and updates to documentation and test coverage to reflect these architectural changes.Key changes include:
QR Code Generation & Dependencies
Migrated QR code generation from ZXing to
qrcode-kotlin, removing ZXing from dependencies and updating implementation to userememberQrCodePainterin shared UI code. Platform-specific QR code utilities and the old ZXing-based code (QrUtils.ktandQrCodeUtils.kt) were removed. (core/model/build.gradle.kts,core/ui/build.gradle.kts,core/model/src/androidMain/kotlin/org/meshtastic/core/model/util/QrCodeUtils.kt,core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/QrUtils.kt,core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/ContactSharing.kt, [1] [2] [3] [4] [5]Updated documentation to instruct developers to use
rememberQrCodePainterfor QR code generation and not to use Android Bitmap or ZXing APIs in common code. (AGENTS.md,GEMINI.md, AGENTS.mdR80)Platform Feature Detection
Introduced
LocalBarcodeScannerSupportedandLocalNfcScannerSupportedcomposition locals to allow UI to detect and conditionally display barcode/NFC features based on platform support. UpdatedMainActivity.ktto provide these locals. (app/src/main/kotlin/org/meshtastic/app/MainActivity.kt, [1] [2]Updated UI tests to verify the conditional display of import options depending on feature support. (
core/ui/src/androidTest/kotlin/org/meshtastic/core/ui/component/ImportFabUiTest.kt, [1] [2] [3]Code Organization & Refactoring
Moved Android-specific screen brightness logic into a new file,
ScreenUtils.kt, to further separate platform-specific code. (core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/ScreenUtils.kt, core/ui/src/androidMain/kotlin/org/meshtastic/core/ui/util/ScreenUtils.ktR1-R39)Updated import paths for settings navigation to reflect project reorganization. (
app/src/main/kotlin/org/meshtastic/app/ui/Main.kt, app/src/main/kotlin/org/meshtastic/app/ui/Main.ktL109-R109)Documentation & Planning
conductor/desktop-uri-import-plan.md, conductor/desktop-uri-import-plan.mdR1-R31)Documentation Updates
firmware,widget) and clarified their multiplatform targets. (AGENTS.md,GEMINI.md, AGENTS.mdL53-R53)These changes modernize QR code support, improve multiplatform compatibility, and make feature support detection more robust and testable.