Repository navigation
manager: refactor intent handling and introduce URL schema - #3541
Merged
Merged
Conversation
…ification - Centralized intent processing by replacing scattered handlers (`ZipFileIntentHandler`, `ShortcutIntentHandler`, `HandleDeepLink`) with a unified `IntentDispatcher` using a Coroutine `Channel<Intent>`. This resolves edge cases with missed intent updates and removes the need to manually clear intent data. - Introduced a URL scheme (`ksu://`) with `action` and `webui` hosts for triggering module actions and opening module WebUIs. Added corresponding intent filters in `AndroidManifest.xml`. - Implemented a security mechanism using a randomized intent token generated in `SettingsRepositoryImpl`. This token is appended to shortcut URIs and DownloadService intents, and strictly verified by the `IntentDispatcher` to prevent unauthorized apps from triggering sensitive module actions or installations. - Added a "Copy URL schema" button to the module shortcut dialog in both Material and Miuix UIs, allowing users to easily copy the deep link for tasker integration. - check if the `Lifecycle` is at least `RESUMED` before pushing the flash screen route upon a successful module download. - Removed the deprecated `DeepLinkResolver.kt` as intent resolution is now handled directly by the dispatcher. Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
- SegmentedList: Add 2dp vertical spacing to the top and bottom of items in the DropdownMenuGroup for better visual padding. - SegmentedList: Explicitly pass `null` to `leadingIcon` when an item is not selected. - ModuleMaterial: Restrict `ModalBottomSheet` enabled values to only `SheetValue.Hidden` and `SheetValue.Expanded` in `ModuleShortcutSheet`. This disables the `PartiallyExpanded` state, ensuring the shortcut sheet always fully opens without getting stuck halfway. Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors how the Manager receives and processes external/internal intents by centralizing handling in a new IntentDispatcher, while also introducing a new ksu:// URL scheme for module actions and WebUI deep links. It additionally exposes the deep link URL to users via a “Copy URL scheme” button and adds an intent token mechanism to help validate trusted invocations.
Changes:
- Replaced prior deep-link/shortcut/ZIP handlers with a single channel-driven
IntentDispatcherand wired it intoMainActivity. - Introduced
ksu://actionandksu://webuiURIs (with token validation) and updated shortcut/deep-link generation and WebUI parameter parsing. - Added UI strings and UI affordances to copy the generated deep-link URL to the clipboard.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| manager/app/src/main/res/values/strings.xml | Adds strings for “Copy URL scheme” UI. |
| manager/app/src/main/res/values-zh-rCN/strings.xml | Adds Chinese translations for the new shortcut-copy strings. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt | Reads module id from deep link query parameter instead of extras. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/util/module/Shortcut.kt | Generates ksu:// shortcut URIs (action/webui) including token. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/util/DownloadService.kt | Adds an intent token extra to the “Install” notification action. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleShortcutState.kt | Adds URL generation for the shortcut dialog/sheet “Copy URL scheme” button. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleScreen.kt | Switches WebUI launch to the new URI builder; adds a RESUMED guard around post-download navigation. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleMiuix.kt | Adds “Copy URL scheme” action to the MIUIX shortcut dialog. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/module/ModuleMaterial.kt | Adds “Copy URL scheme” action to the Material shortcut sheet and adjusts sheet state behavior. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/navigation3/IntentDispatcher.kt | New centralized intent/deeplink resolver/dispatcher using a channel consumer. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/navigation3/DeepLinkResolver.kt | Removes prior deep-link resolver/handler composable. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt | Replaces state-flow-triggered handlers with a buffered intent channel feeding IntentDispatcher. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/dialogs/MultiSelectDialog.kt | Adjusts bottom sheet enabled states. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/component/material/SegmentedList.kt | Small dropdown menu layout/leading icon adjustments. |
| manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepositoryImpl.kt | Adds persistent secure intent token generation/storage. |
| manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepository.kt | Exposes intentToken on the settings repository interface. |
| manager/app/src/main/AndroidManifest.xml | Registers ksu://action and ksu://webui intent-filters on MainActivity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
IntentDispatcherusing Channels to prevent dropped intents.ksu://actionandksu://webuideep link support.