diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt index dda0df36..381f5d06 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt @@ -319,6 +319,54 @@ fun SettingScreen(navigator: DestinationsNavigator) { } } + if (ksuVersion != null) { + val backupRestore = stringResource(id = R.string.backup_restore) + ListItem( + leadingContent = { + Icon( + Icons.Filled.Backup, + backupRestore + ) + }, + headlineContent = { Text(backupRestore) }, + modifier = Modifier.clickable { + navigator.navigate(BackupRestoreScreenDestination) + } + ) + } + + if (useOverlayFs) { + val shrink = stringResource(id = R.string.shrink_sparse_image) + val shrinkMessage = stringResource(id = R.string.shrink_sparse_image_message) + ListItem( + leadingContent = { + Icon( + Icons.Filled.Compress, + shrink + ) + }, + headlineContent = { Text(shrink) }, + modifier = Modifier.clickable { + scope.launch { + val result = shrinkDialog.awaitConfirm(title = shrink, content = shrinkMessage) + if (result == ConfirmResult.Confirmed) { + loadingDialog.withLoading { + shrinkModules() + } + } + } + } + ) + } + + + val lkmMode = Natives.version >= Natives.MINIMAL_SUPPORTED_KERNEL_LKM && Natives.isLkmMode + if (lkmMode) { + UninstallItem(navigator) { + loadingDialog.withLoading(it) + } + } + var showBottomsheet by remember { mutableStateOf(false) } ListItem( @@ -428,54 +476,6 @@ fun SettingScreen(navigator: DestinationsNavigator) { ) } - if (ksuVersion != null) { - val backupRestore = stringResource(id = R.string.backup_restore) - ListItem( - leadingContent = { - Icon( - Icons.Filled.Backup, - backupRestore - ) - }, - headlineContent = { Text(backupRestore) }, - modifier = Modifier.clickable { - navigator.navigate(BackupRestoreScreenDestination) - } - ) - } - - if (useOverlayFs) { - val shrink = stringResource(id = R.string.shrink_sparse_image) - val shrinkMessage = stringResource(id = R.string.shrink_sparse_image_message) - ListItem( - leadingContent = { - Icon( - Icons.Filled.Compress, - shrink - ) - }, - headlineContent = { Text(shrink) }, - modifier = Modifier.clickable { - scope.launch { - val result = shrinkDialog.awaitConfirm(title = shrink, content = shrinkMessage) - if (result == ConfirmResult.Confirmed) { - loadingDialog.withLoading { - shrinkModules() - } - } - } - } - ) - } - - - val lkmMode = Natives.version >= Natives.MINIMAL_SUPPORTED_KERNEL_LKM && Natives.isLkmMode - if (lkmMode) { - UninstallItem(navigator) { - loadingDialog.withLoading(it) - } - } - val about = stringResource(id = R.string.about) ListItem( leadingContent = { diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt index 34c7c86d..016cf6f3 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt @@ -443,7 +443,7 @@ fun getFileName(context: Context, uri: Uri): String { fun moduleBackupDir(): String? { val shell = getRootShell() - val baseBackupDir = "/data/adb/modules_bak" + val baseBackupDir = "/data/adb/ksu/modules_bak" val resultBase = ShellUtils.fastCmd(shell, "mkdir -p $baseBackupDir").trim() if (resultBase.isNotEmpty()) return null @@ -485,12 +485,12 @@ fun moduleMigration(): Boolean { fun moduleRestore(): Boolean { val shell = getRootShell() - val command = "ls -t /data/adb/modules_bak | head -n 1" + val command = "ls -t /data/adb/ksu/modules_bak | head -n 1" val latestBackupDir = ShellUtils.fastCmd(shell, command).trim() if (latestBackupDir.isEmpty()) return false - val sourceDir = "/data/adb/modules_bak/$latestBackupDir" + val sourceDir = "/data/adb/ksu/modules_bak/$latestBackupDir" val destinationDir = "/data/adb/modules_update" val createDestDirCommand = "mkdir -p $destinationDir" @@ -504,7 +504,7 @@ fun moduleRestore(): Boolean { fun allowlistBackupDir(): String? { val shell = getRootShell() - val baseBackupDir = "/data/adb/allowlist_bak" + val baseBackupDir = "/data/adb/ksu/allowlist_bak" val resultBase = ShellUtils.fastCmd(shell, "mkdir -p $baseBackupDir").trim() if (resultBase.isNotEmpty()) return null @@ -538,12 +538,12 @@ fun allowlistBackup(): Boolean { fun allowlistRestore(): Boolean { val shell = getRootShell() - val command = "ls -t /data/adb/allowlist_bak | head -n 1" + val command = "ls -t /data/adb/ksu/allowlist_bak | head -n 1" val latestBackupDir = ShellUtils.fastCmd(shell, command).trim() if (latestBackupDir.isEmpty()) return false - val sourceDir = "/data/adb/allowlist_bak/$latestBackupDir" + val sourceDir = "/data/adb/ksu/allowlist_bak/$latestBackupDir" val destinationDir = "/data/adb/ksu/" val createDestDirCommand = "mkdir -p $destinationDir"