Skip to content

Commit b246a4b

Browse files
committed
fix: Eliminate background flash on InstalledAppInfo → patch flow transition
1 parent 15ae79a commit b246a4b

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

app/src/main/java/app/morphe/manager/ui/screen/home/HomeDialogs.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ fun HomeDialogs(
316316
packageName = packageName,
317317
onDismiss = homeViewModel::dismissInstalledAppInfo,
318318
onTriggerPatchFlow = { originalPackageName ->
319-
homeViewModel.dismissInstalledAppInfo()
320319
homeViewModel.showPatchDialog(originalPackageName)
321320
},
322321
homeViewModel = homeViewModel,

app/src/main/java/app/morphe/manager/ui/screen/home/InstalledAppInfoDialog.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ fun InstalledAppInfoDialog(
254254
}
255255
)
256256

257-
// Expert Mode Repatch Dialog is rendered by HomeDialogs via homeViewModel.showExpertModeDialog.
258257
// Patch flow always starts with onTriggerPatchFlow → showPatchDialog → ApkAvailabilityDialog,
259258
// where the user picks the APK source. Expert mode dialog opens after APK selection.
259+
// We do NOT call onDismiss() here. InstalledAppInfoDialog stays open (hidden behind
260+
// ApkAvailabilityDialog) and is dismissed in HomeViewModel.proceedWithPatching() right
261+
// before navigating to PatcherScreen. This eliminates the flash of background that would
262+
// appear between closing this dialog and opening the next one
260263
fun handlePatchClick() {
261-
onDismiss()
262264
onTriggerPatchFlow(viewModel.installedApp?.originalPackageName ?: return)
263265
}
264266

@@ -338,7 +340,6 @@ fun InstalledAppInfoDialog(
338340
buttonText = stringResource(R.string.patch),
339341
buttonIcon = Icons.Outlined.AutoFixHigh,
340342
onClick = {
341-
onDismiss()
342343
onTriggerPatchFlow(installedApp.originalPackageName)
343344
},
344345
isError = true
@@ -358,7 +359,6 @@ fun InstalledAppInfoDialog(
358359
buttonText = stringResource(R.string.patch),
359360
buttonIcon = Icons.Outlined.AutoFixHigh,
360361
onClick = {
361-
onDismiss()
362362
onTriggerPatchFlow(installedApp.originalPackageName)
363363
},
364364
isError = false
@@ -440,7 +440,6 @@ fun InstalledAppInfoDialog(
440440
buttonText = stringResource(R.string.patch),
441441
buttonIcon = Icons.Outlined.AutoFixHigh,
442442
onClick = {
443-
onDismiss()
444443
onTriggerPatchFlow(installedApp.originalPackageName)
445444
},
446445
isError = true,
@@ -464,7 +463,6 @@ fun InstalledAppInfoDialog(
464463
buttonText = stringResource(R.string.patch),
465464
buttonIcon = Icons.Outlined.AutoFixHigh,
466465
onClick = {
467-
onDismiss()
468466
onTriggerPatchFlow(installedApp.originalPackageName)
469467
},
470468
isError = false,

app/src/main/java/app/morphe/manager/ui/viewmodel/HomeViewModel.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ data class SavedApkInfo(
122122
)
123123

124124
/**
125-
* Combined home screen app state emitted atomically so visible and hidden lists
125+
* Combined home screen app state - emitted atomically so visible and hidden lists
126126
* are always in sync and never cause a transient empty-state flash.
127127
*/
128128
data class HomeAppState(
@@ -1859,6 +1859,10 @@ class HomeViewModel(
18591859
patches: PatchSelection,
18601860
options: Options
18611861
) {
1862+
// Dismiss InstalledAppInfoDialog here, right before navigating to PatcherScreen.
1863+
// This ensures there is never a gap between the info dialog closing and the next screen appearing
1864+
dismissInstalledAppInfo()
1865+
18621866
onStartQuickPatch?.invoke(
18631867
QuickPatchParams(
18641868
selectedApp = selectedApp,

0 commit comments

Comments
 (0)