mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-11 20:27:38 +02:00
fix: Patch process cancelation dialog conditions (#2554)
This commit is contained in:
@ -62,6 +62,10 @@ fun PatcherScreen(
|
||||
onBackClick: () -> Unit,
|
||||
viewModel: PatcherViewModel
|
||||
) {
|
||||
fun onLeave() {
|
||||
viewModel.onBack()
|
||||
onBackClick()
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
val exportApkLauncher =
|
||||
@ -72,7 +76,14 @@ fun PatcherScreen(
|
||||
var showInstallPicker by rememberSaveable { mutableStateOf(false) }
|
||||
var showDismissConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
BackHandler(onBack = { showDismissConfirmationDialog = true })
|
||||
fun onPageBack() {
|
||||
if(patcherSucceeded == null)
|
||||
showDismissConfirmationDialog = true
|
||||
else
|
||||
onLeave()
|
||||
}
|
||||
|
||||
BackHandler(onBack = ::onPageBack)
|
||||
|
||||
val steps by remember {
|
||||
derivedStateOf {
|
||||
@ -99,10 +110,7 @@ fun PatcherScreen(
|
||||
if (showDismissConfirmationDialog) {
|
||||
ConfirmDialog(
|
||||
onDismiss = { showDismissConfirmationDialog = false },
|
||||
onConfirm = {
|
||||
viewModel.onBack()
|
||||
onBackClick()
|
||||
},
|
||||
onConfirm = ::onLeave,
|
||||
title = stringResource(R.string.patcher_stop_confirm_title),
|
||||
description = stringResource(R.string.patcher_stop_confirm_description),
|
||||
icon = Icons.Outlined.Cancel
|
||||
@ -150,7 +158,7 @@ fun PatcherScreen(
|
||||
AppTopBar(
|
||||
title = stringResource(R.string.patcher),
|
||||
scrollBehavior = scrollBehavior,
|
||||
onBackClick = { showDismissConfirmationDialog = true }
|
||||
onBackClick = ::onPageBack
|
||||
)
|
||||
},
|
||||
bottomBar = {
|
||||
@ -229,4 +237,4 @@ fun PatcherScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ appcompat = "1.7.0"
|
||||
preferences-datastore = "1.1.2"
|
||||
work-runtime = "2.10.1"
|
||||
compose-bom = "2025.05.00"
|
||||
navigation = "2.9.0"
|
||||
navigation = "2.8.6"
|
||||
accompanist = "0.37.0"
|
||||
placeholder = "1.1.2"
|
||||
reorderable = "2.4.3"
|
||||
|
Reference in New Issue
Block a user