manager: allow uninstall when update module
This commit is contained in:
@@ -84,6 +84,8 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
val failedEnable = stringResource(R.string.module_failed_to_enable)
|
val failedEnable = stringResource(R.string.module_failed_to_enable)
|
||||||
val failedDisable = stringResource(R.string.module_failed_to_disable)
|
val failedDisable = stringResource(R.string.module_failed_to_disable)
|
||||||
|
val failedUninstall = stringResource(R.string.module_uninstall_failed)
|
||||||
|
val successUninstall = stringResource(R.string.module_uninstall_success)
|
||||||
val swipeState = rememberSwipeRefreshState(viewModel.isRefreshing)
|
val swipeState = rememberSwipeRefreshState(viewModel.isRefreshing)
|
||||||
// TODO: Replace SwipeRefresh with RefreshIndicator when it's ready
|
// TODO: Replace SwipeRefresh with RefreshIndicator when it's ready
|
||||||
if (Natives.getVersion() < 8) {
|
if (Natives.getVersion() < 8) {
|
||||||
@@ -116,6 +118,13 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
onUninstall = {
|
onUninstall = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val result = uninstallModule(module.id)
|
val result = uninstallModule(module.id)
|
||||||
|
snackBarHost.showSnackbar(
|
||||||
|
if (result) {
|
||||||
|
successUninstall.format(module.name)
|
||||||
|
} else {
|
||||||
|
failedUninstall.format(module.name)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCheckChanged = {
|
onCheckChanged = {
|
||||||
@@ -224,7 +233,7 @@ private fun ModuleItem(
|
|||||||
Spacer(modifier = Modifier.weight(1f, true))
|
Spacer(modifier = Modifier.weight(1f, true))
|
||||||
|
|
||||||
TextButton(
|
TextButton(
|
||||||
enabled = !module.update && !module.remove,
|
enabled = !module.remove,
|
||||||
onClick = { onUninstall(module) },
|
onClick = { onUninstall(module) },
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -40,5 +40,7 @@
|
|||||||
<string name="settings_system_rw_summary">Use overlayfs to make system partition writable, reboot to take effect.</string>
|
<string name="settings_system_rw_summary">Use overlayfs to make system partition writable, reboot to take effect.</string>
|
||||||
<string name="about">About</string>
|
<string name="about">About</string>
|
||||||
<string name="require_kernel_version_8">Require KernelSU version 8+</string>
|
<string name="require_kernel_version_8">Require KernelSU version 8+</string>
|
||||||
|
<string name="module_uninstall_success">%s uninstalled</string>
|
||||||
|
<string name="module_uninstall_failed">Failed to uninstall: %s</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user