Skip to content

manager: refactor intent handling and introduce URL schema - #3541

Merged
aviraxp merged 4 commits into
tiann:mainfrom
u9521:intent-refactor
Jun 29, 2026
Merged

aviraxp merged 4 commits into
tiann:mainfrom
u9521:intent-refactor

Conversation

@u9521

@u9521 u9521 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor
  • Replaced fragmented handlers with a single IntentDispatcher using Channels to prevent dropped intents.
  • Added ksu://action and ksu://webui deep link support.
  • Added a "Copy URL Schema" button in the module shortcut dialog for easy integration with tools like Tasker.

…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>
@5ec1cff
5ec1cff requested review from KOWX712 and YuKongA June 25, 2026 09:02
u9521 added 3 commits June 25, 2026 17:08
- 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>
1
Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IntentDispatcher and wired it into MainActivity.
  • Introduced ksu://action and ksu://webui URIs (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.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt
Comment thread manager/app/src/main/AndroidManifest.xml
Comment thread manager/app/src/main/AndroidManifest.xml
@aviraxp
aviraxp merged commit 36941b9 into tiann:main Jun 29, 2026
18 checks passed
@u9521
u9521 deleted the intent-refactor branch June 29, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants