fix restarting after rotation

This commit is contained in:
qimiko committed 2024-06-18 04:30:08 -07:00
1 parent 8942971368
commit d4bacc4afb
2 files changed
+6 -2

No files matched your search

@@ -466,7 +466,7 @@ fun AltMainScreen(
launchViewModel.clearCrashInfo() launchViewModel.clearCrashInfo()
coroutineScope.launch { coroutineScope.launch {
launchViewModel.beginLaunchFlow() launchViewModel.beginLaunchFlow(true)
} }
}, },
onMore = { onMore = {
@@ -157,11 +157,15 @@ class LaunchViewModel(private val application: Application): ViewModel() {
_uiState.emit(LaunchUIState.Ready) _uiState.emit(LaunchUIState.Ready)
} }
suspend fun beginLaunchFlow() { suspend fun beginLaunchFlow(isRestart: Boolean = false) {
if (_uiState.value !is LaunchUIState.Initial && _uiState.value !is LaunchUIState.Cancelled) { if (_uiState.value !is LaunchUIState.Initial && _uiState.value !is LaunchUIState.Cancelled) {
return return
} }
if (_uiState.value is LaunchUIState.Cancelled && !isRestart) {
return
}
isCancelling = false isCancelling = false
if (!GamePackageUtils.isGameInstalled(application.packageManager)) { if (!GamePackageUtils.isGameInstalled(application.packageManager)) {