feat(sharing): Refactor QR/NFC scanning with ML Kit and CameraX#4471
Merged
Conversation
This commit overhauls the QR code and NFC scanning functionality, replacing the Zxing-Embedded library with a modern, unified solution based on ML Kit and CameraX. This refactoring centralizes scanning logic into new `core:barcode` and `core:nfc` modules, improving maintainability and user experience. Key changes include: - Replaced the third-party Zxing-Embedded library with Google's ML Kit for barcode scanning and a custom CameraX implementation. - Introduced a unified Floating Action Button (FAB) menu for sharing/scanning contacts and channels, providing options for QR code, NFC, and manual URL entry. - Added new `core:barcode` and `core:nfc` modules to encapsulate scanning logic. - Implemented a new full-screen, in-app scanner UI using CameraX for a more integrated experience. - Created a generic `QrDialog` composable to standardize the display of QR codes and associated data, which now also maximizes screen brightness for better scannability. - Refactored channel and contact sharing screens to use the new centralized scanning and dialog components. - Added a unified URI handler (`handleScannedUri`) to process both channel and contact URIs from any scanning source. - Included NFC scanning capabilities for both contacts and Wi-Fi credentials. - Updated AndroidManifest to declare NFC support and handle Meshtastic URLs via NFC discovery. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
…t UI
This commit refactors URL and import handling by:
- **Introducing `MeshtasticUrlConstants.kt`**: Centralizes all Meshtastic URL constants (`meshtastic.org`, `/e/`, `/v/`) into a single file in the `core:model` module for consistency.
- **Creating `UriUtils.kt` with `handleMeshtasticUri`**: A new utility function in `core:model` to parse and dispatch `meshtastic.org` URIs based on their path (`/e/` for channels, `/v/` for contacts), ensuring a single point of entry for URI handling.
- **Refactoring to a generic `ImportFab.kt`**: The contact sharing FAB logic has been extracted from `ContactSharing.kt` into a new, reusable `ImportFab` composable. This unified component now handles importing channels and contacts via QR, NFC, or URL.
- **Updating existing code**:
- `ContactSharing.kt` and `ChannelSet.kt` are updated to use the new centralized constants.
- `NetworkConfigItemList.kt` now uses `handleMeshtasticUri` to correctly ignore Meshtastic URIs during Wi-Fi credential scans.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
The visibility of `formatAbbreviation` and `formatPosixOffset` in `ZoneIdExtensions.kt` has been changed from `internal` to `public` to allow their use in other modules. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
The visibility of several Composables in the debugging feature has been changed from `internal` to `public`. This allows them to be used in UI tests and previews. The affected Composables are: - `DebugPresetFilters` - `DebugFilterBar` - `DebugActiveFilters` - `DebugSearchNavigation` - `DebugSearchBar` - `DebugSearchState` Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
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 commit overhauls the QR code and NFC scanning functionality, replacing the Zxing-Embedded library with a modern, unified solution based on ML Kit and CameraX. This refactoring centralizes scanning logic into new
core:barcodeandcore:nfcmodules, improving maintainability and user experience.Key changes include:
core:barcodeandcore:nfcmodules to encapsulate scanning logic.QrDialogcomposable to standardize the display of QR codes and associated data, which now also maximizes screen brightness for better scannability.handleScannedUri) to process both channel and contact URIs from any scanning source.Screen_recording_20260205_175035.mp4