Skip to content

Commit 2ff7072

Browse files
committed
fix: prevent back presses during installation
1 parent e5097b5 commit 2ff7072

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/src/main/java/app/revanced/manager/ui/screen/PatcherScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import app.revanced.manager.ui.model.StepCategory
5555
import app.revanced.manager.ui.viewmodel.PatcherViewModel
5656
import app.revanced.manager.util.APK_MIMETYPE
5757
import app.revanced.manager.util.EventEffect
58+
import app.revanced.manager.util.toast
5859

5960
@OptIn(ExperimentalMaterial3Api::class)
6061
@Composable
@@ -76,11 +77,10 @@ fun PatcherScreen(
7677
var showInstallPicker by rememberSaveable { mutableStateOf(false) }
7778
var showDismissConfirmationDialog by rememberSaveable { mutableStateOf(false) }
7879

79-
fun onPageBack() {
80-
if(patcherSucceeded == null)
81-
showDismissConfirmationDialog = true
82-
else
83-
onLeave()
80+
fun onPageBack() = when {
81+
patcherSucceeded == null -> showDismissConfirmationDialog = true
82+
viewModel.isInstalling -> context.toast(context.getString(R.string.patcher_install_in_progress))
83+
else -> onLeave()
8484
}
8585

8686
BackHandler(onBack = ::onPageBack)

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
<string name="patcher_notification_text">Tap to return to the patcher</string>
319319
<string name="patcher_stop_confirm_title">Stop patcher</string>
320320
<string name="patcher_stop_confirm_description">Are you sure you want to stop the patching process?</string>
321+
<string name="patcher_install_in_progress">Installation is in progress. Please wait</string>
321322
<string name="execute_patches">Execute patches</string>
322323
<string name="executing_patch">Execute %s</string>
323324
<string name="failed_to_execute_patch">Failed to execute %s</string>

0 commit comments

Comments
 (0)