diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Flash.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Flash.kt index efa0f42e..b3b9e82a 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Flash.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Flash.kt @@ -216,14 +216,43 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) { } if (flashIt is FlashIt.FlashBoot && (flashing == FlashingStatus.SUCCESS || flashing == FlashingStatus.FAILED)) { - // Close button for LKM flashing - ExtendedFloatingActionButton( - text = { Text(text = stringResource(R.string.close)) }, - icon = { Icon(Icons.Filled.Close, contentDescription = null) }, - onClick = { - navigator.popBackStack() + val isLocalPatch = flashIt.boot != null && !flashIt.ota + val isDirectOrOta = flashIt.boot == null || flashIt.ota + + if (flashing == FlashingStatus.FAILED) { + // Always show close on failure + ExtendedFloatingActionButton( + text = { Text(text = stringResource(R.string.close)) }, + icon = { Icon(Icons.Filled.Close, contentDescription = null) }, + onClick = { + navigator.popBackStack() + } + ) + } else if (flashing == FlashingStatus.SUCCESS) { + if (isLocalPatch) { + // Local patching: show only Close + ExtendedFloatingActionButton( + text = { Text(text = stringResource(R.string.close)) }, + icon = { Icon(Icons.Filled.Close, contentDescription = null) }, + onClick = { + navigator.popBackStack() + } + ) + } else if (isDirectOrOta) { + // Direct install or OTA inactive slot: show only Reboot + ExtendedFloatingActionButton( + onClick = { + scope.launch { + withContext(Dispatchers.IO) { + reboot() + } + } + }, + icon = { Icon(Icons.Filled.Refresh, contentDescription = stringResource(R.string.reboot)) }, + text = { Text(text = stringResource(R.string.reboot)) } + ) } - ) + } } }, contentWindowInsets = WindowInsets.safeDrawing,