From ff2a1c1307a46445fe0324659cbd8a6fdf0e78ba Mon Sep 17 00:00:00 2001 From: bryanyee33 <65088428+bryanyee33@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:10:16 +0800 Subject: [PATCH] manager: module: refresh after webui usage (#2317) - This commit fixes issue tiann#2250 https://github.com/user-attachments/assets/19dcca12-cb34-4e6e-88b4-72c26c2773f3 Tested by: backslashxx <118538522+backslashxx@users.noreply.github.com> --- .../src/main/java/me/weishu/kernelsu/ui/screen/Module.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt index e655352fc7d3..81d1cc965ed7 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt @@ -126,6 +126,10 @@ fun ModuleScreen(navigator: DestinationsNavigator) { var zipUri by remember { mutableStateOf(null) } var showConfirmDialog by remember { mutableStateOf(false) } + + val webUILauncher = rememberLauncherForActivityResult( + contract = ActivityResultContracts.StartActivityForResult() + ) { viewModel.fetchModuleList() } Scaffold( topBar = { @@ -225,7 +229,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) { }, onClickModule = { id, name, hasWebUi -> if (hasWebUi) { - context.startActivity( + webUILauncher.launch( Intent(context, WebUIActivity::class.java) .setData(Uri.parse("kernelsu://webui/$id")) .putExtra("id", id) @@ -702,4 +706,4 @@ fun ModuleItemPreview() { hasActionScript = false ) ModuleItem(EmptyDestinationsNavigator, module, true, "", {}, {}, {}, {}) -} \ No newline at end of file +}