fix: prevent back presses during installation

This commit is contained in:
Ax333l
2025-10-06 19:40:21 +02:00
parent e5097b5ecd
commit 2ff70728b4
2 changed files with 6 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ import app.revanced.manager.ui.model.StepCategory
import app.revanced.manager.ui.viewmodel.PatcherViewModel import app.revanced.manager.ui.viewmodel.PatcherViewModel
import app.revanced.manager.util.APK_MIMETYPE import app.revanced.manager.util.APK_MIMETYPE
import app.revanced.manager.util.EventEffect import app.revanced.manager.util.EventEffect
import app.revanced.manager.util.toast
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@@ -76,11 +77,10 @@ fun PatcherScreen(
var showInstallPicker by rememberSaveable { mutableStateOf(false) } var showInstallPicker by rememberSaveable { mutableStateOf(false) }
var showDismissConfirmationDialog by rememberSaveable { mutableStateOf(false) } var showDismissConfirmationDialog by rememberSaveable { mutableStateOf(false) }
fun onPageBack() { fun onPageBack() = when {
if(patcherSucceeded == null) patcherSucceeded == null -> showDismissConfirmationDialog = true
showDismissConfirmationDialog = true viewModel.isInstalling -> context.toast(context.getString(R.string.patcher_install_in_progress))
else else -> onLeave()
onLeave()
} }
BackHandler(onBack = ::onPageBack) BackHandler(onBack = ::onPageBack)

View File

@@ -318,6 +318,7 @@
<string name="patcher_notification_text">Tap to return to the patcher</string> <string name="patcher_notification_text">Tap to return to the patcher</string>
<string name="patcher_stop_confirm_title">Stop patcher</string> <string name="patcher_stop_confirm_title">Stop patcher</string>
<string name="patcher_stop_confirm_description">Are you sure you want to stop the patching process?</string> <string name="patcher_stop_confirm_description">Are you sure you want to stop the patching process?</string>
<string name="patcher_install_in_progress">Installation is in progress. Please wait</string>
<string name="execute_patches">Execute patches</string> <string name="execute_patches">Execute patches</string>
<string name="executing_patch">Execute %s</string> <string name="executing_patch">Execute %s</string>
<string name="failed_to_execute_patch">Failed to execute %s</string> <string name="failed_to_execute_patch">Failed to execute %s</string>