From 74f55dd807f09e984426d0fdc51df554301329c1 Mon Sep 17 00:00:00 2001 From: rifsxd Date: Sun, 16 Feb 2025 03:07:36 +0600 Subject: [PATCH] manager: disable restore module button on overlayfs mount mode (since the restore module code for overlayfs mount never got out of internal testing, wull be implemented in the future) --- .../rifsxd/ksunext/ui/screen/BackupRestore.kt | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/BackupRestore.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/BackupRestore.kt index 0fbe46f1..176c5d79 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/BackupRestore.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/BackupRestore.kt @@ -188,27 +188,45 @@ fun BackupRestoreScreen(navigator: DestinationsNavigator) { ) } + val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE) + + var useOverlayFs by rememberSaveable { + mutableStateOf( + prefs.getBoolean("use_overlay_fs", false) + ) + } + val moduleRestore = stringResource(id = R.string.module_restore) val restoreMessage = stringResource(id = R.string.module_restore_message) + ListItem( leadingContent = { Icon( Icons.Filled.Restore, - moduleRestore + moduleRestore, + tint = if (useOverlayFs) androidx.compose.material3.MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f) else androidx.compose.material3.MaterialTheme.colorScheme.onSurface ) }, - headlineContent = { Text(moduleRestore) }, - modifier = Modifier.clickable { - scope.launch { - val result = restoreDialog.awaitConfirm(title = moduleRestore, content = restoreMessage) - if (result == ConfirmResult.Confirmed) { - loadingDialog.withLoading { - moduleRestore() - showRebootDialog = true + headlineContent = { + Text( + moduleRestore, + color = if (useOverlayFs) androidx.compose.material3.MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f) else androidx.compose.material3.MaterialTheme.colorScheme.onSurface + ) + }, + modifier = Modifier.clickable( + enabled = !useOverlayFs, + onClick = { + scope.launch { + val result = restoreDialog.awaitConfirm(title = moduleRestore, content = restoreMessage) + if (result == ConfirmResult.Confirmed) { + loadingDialog.withLoading { + moduleRestore() + showRebootDialog = true + } } } } - } + ) ) HorizontalDivider(thickness = Dp.Hairline)