Skip to content

Commit c68b4be

Browse files
bryanyee33backslashxx
authored andcommitted
manager: module: refresh after webui usage (tiann#2317)
- This commit fixes issue tiann#2250 https://github.com/user-attachments/assets/19dcca12-cb34-4e6e-88b4-72c26c2773f3 Tested by: backslashxx <[email protected]>
1 parent 9336779 commit c68b4be

File tree

1 file changed

+6
-2
lines changed
  • manager/app/src/main/java/me/weishu/kernelsu/ui/screen

1 file changed

+6
-2
lines changed

manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
133133

134134
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
135135

136+
val webUILauncher = rememberLauncherForActivityResult(
137+
contract = ActivityResultContracts.StartActivityForResult()
138+
) { viewModel.fetchModuleList() }
139+
136140
Scaffold(
137141
topBar = {
138142
TopAppBar(
@@ -253,7 +257,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
253257
},
254258
onClickModule = { id, name, hasWebUi ->
255259
if (hasWebUi) {
256-
context.startActivity(
260+
webUILauncher.launch(
257261
Intent(context, WebUIActivity::class.java)
258262
.setData(Uri.parse("kernelsu://webui/$id"))
259263
.putExtra("id", id)
@@ -753,4 +757,4 @@ fun ModuleItemPreview() {
753757
hasActionScript = false
754758
)
755759
ModuleItem(EmptyDestinationsNavigator, module, true, "", {}, {}, {}, {})
756-
}
760+
}

0 commit comments

Comments
 (0)