diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/ExecuteModuleAction.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/ExecuteModuleAction.kt index d79955e2c200..16cfe11109cd 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/ExecuteModuleAction.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/ExecuteModuleAction.kt @@ -24,7 +24,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue -import androidx.lifecycle.viewmodel.compose.viewModel import androidx.compose.ui.Modifier import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.key @@ -41,7 +40,6 @@ import me.weishu.kernelsu.R import me.weishu.kernelsu.ui.component.KeyEventBlocker import me.weishu.kernelsu.ui.util.LocalSnackbarHost import me.weishu.kernelsu.ui.util.runModuleAction -import me.weishu.kernelsu.ui.viewmodel.ModuleViewModel import java.io.File import java.text.SimpleDateFormat import java.util.Date @@ -76,19 +74,13 @@ fun ExecuteModuleActionScreen(navigator: DestinationsNavigator, moduleId: String actionResult = it } } - if (actionResult) { - viewModel.fetchModuleList() - navigator.popBackStack() - } else { - viewModel.fetchModuleList() - } + if (actionResult) navigator.popBackStack() } Scaffold( topBar = { TopBar( onBack = { - viewModel.fetchModuleList() navigator.popBackStack() }, onSave = { 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 a0d28f093189..193f76b21c46 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 @@ -477,6 +477,7 @@ fun ModuleItem( val textDecoration = if (!module.remove) null else TextDecoration.LineThrough val interactionSource = remember { MutableInteractionSource() } val indication = LocalIndication.current + val viewModel = viewModel() Column( modifier = Modifier @@ -580,7 +581,10 @@ fun ModuleItem( if (module.hasActionScript) { FilledTonalButton( modifier = Modifier.defaultMinSize(52.dp, 32.dp), - onClick = { navigator.navigate(ExecuteModuleActionScreenDestination(module.id)) }, + onClick = { + navigator.navigate(ExecuteModuleActionScreenDestination(module.id)) + viewModel.markNeedRefresh() + }, contentPadding = ButtonDefaults.TextButtonContentPadding ) { Icon(