feat: implement unified deep link routing for Kotlin Multiplatform#4910
Merged
jamesarich merged 4 commits intomainfrom Mar 25, 2026
Merged
feat: implement unified deep link routing for Kotlin Multiplatform#4910jamesarich merged 4 commits intomainfrom
jamesarich merged 4 commits intomainfrom
Conversation
This commit introduces a centralized deep link handling system and a type-safe `DeepLinkRouter` to support navigation and resource importing across Android and Desktop platforms. It transitions the project toward a more robust navigation architecture using Navigation 3. ### Key Changes: - **Core Navigation & Routing:** - Introduced `DeepLinkRouter` in `core:navigation` to parse Meshtastic URIs into type-safe `NavKey` backstacks. - Supported comprehensive route mapping for `share`, `messages`, `nodes`, `settings`, `map`, and `firmware` segments. - Added logic to synthesize parent hierarchies (e.g., automatically adding `NodesGraph` when deep linking to a `NodeDetail`). - **Unified UI Deep Link Handling:** - Consolidated `handleNavigationDeepLink` and `handleScannedUri` into a single `handleDeepLink` method within `UIViewModel`. - Updated `MainActivity` (Android) and `Main.kt` (Desktop) to use the new unified handler. - Implemented a `LaunchedEffect` in `MainScreen` and `DesktopMainScreen` to collect and apply deep link navigation events to the `NavBackStack`. - **Feature Integration:** - Refactored `feature:node` and `feature:messaging` to propagate `onHandleDeepLink` callbacks through adaptive and list screens. - Removed redundant contact/channel request logic from `NodeListViewModel`, moving responsibility to the shared `UIViewModel`. - Updated `NodesNavigation` and `desktopNavGraph` to support deep link handling via dependency injection. - **Infrastructure & Dependencies:** - Added `navigation3-ui` and `kermit` dependencies to `core:navigation`. - Added `navigation3-ui` to `core:ui`. - Renamed internal parameters from `scannedUri` to `deepLink` across various composables for consistency. Signed-off-by: James Rich <[email protected]>
This commit introduces support for modern RESTful deep links (App Links) via `meshtastic.org` and cleans up the routing logic to maintain a consistent path structure. Specific changes include: - **AndroidManifest Updates**: Added a new `intent-filter` with `autoVerify="true"` to handle `http/https` links for `meshtastic.org`. Registered path prefixes for `share`, `connections`, `map`, `messages`, `quickchat`, `nodes`, `settings`, `channels`, and `firmware`. - **Router Refactoring**: Simplified `DeepLinkRouter.kt` by removing redundant path aliases like `conversations`, `contacts`, and the singular `node` to favor a more standardized RESTful routing pattern. - **Message Routing**: Updated the `routeContacts` logic to remove the deprecated `conversations` segment. Signed-off-by: James Rich <[email protected]>
…ling
This commit enhances the navigation system to support RESTful path patterns for deep linking and unifies URI handling within the `UIViewModel`. These changes allow for more descriptive, hierarchical routing across the multiplatform application.
Specific changes include:
- **RESTful Deep Linking**: Updated `DeepLinkRouter` to support modern path patterns (e.g., `/nodes/{id}`, `/messages/{key}`, `/settings/{id}/{page}`) alongside legacy query-parameter URIs.
- **Unified URI Dispatching**: Refactored `UIViewModel.handleDeepLink` to first attempt typed navigation via `DeepLinkRouter` before falling back to legacy data import (contacts/channels).
- **Navigation Documentation**: Updated `AGENTS.md`, `GEMINI.md`, `README.md`, and the DI/Navigation playbook to reflect the shift toward RESTful multiplatform routing.
- **Code Maintenance**:
- Added comprehensive documentation to `MeshtasticCommonAppSetup` regarding its role in global UI logic and deep link interception.
- Improved Kdoc for `DeepLinkRouter` and `UIViewModel` to clarify deep link orchestration.
Signed-off-by: James Rich <[email protected]>
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 commit introduces a centralized deep link handling system and a type-safe
DeepLinkRouterto support navigation and resource importing across Android and Desktop platforms. It transitions the project toward a more robust navigation architecture using Navigation 3.Key Changes:
Core Navigation & Routing:
DeepLinkRouterincore:navigationto parse Meshtastic URIs into type-safeNavKeybackstacks.share,messages,nodes,settings,map, andfirmwaresegments.NodesGraphwhen deep linking to aNodeDetail).Unified UI Deep Link Handling:
handleNavigationDeepLinkandhandleScannedUriinto a singlehandleDeepLinkmethod withinUIViewModel.MainActivity(Android) andMain.kt(Desktop) to use the new unified handler.LaunchedEffectinMainScreenandDesktopMainScreento collect and apply deep link navigation events to theNavBackStack.Feature Integration:
feature:nodeandfeature:messagingto propagateonHandleDeepLinkcallbacks through adaptive and list screens.NodeListViewModel, moving responsibility to the sharedUIViewModel.NodesNavigationanddesktopNavGraphto support deep link handling via dependency injection.Infrastructure & Dependencies:
navigation3-uiandkermitdependencies tocore:navigation.navigation3-uitocore:ui.scannedUritodeepLinkacross various composables for consistency.