Skip to content

Commit 1cc71b2

Browse files
committed
Added a potential fix for a bug where the game activity is launched just after being terminated
1 parent ebf16c1 commit 1cc71b2

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

watch/app/src/main/java/com/imsproject/watch/view/MainActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class MainActivity : ComponentActivity() {
114114
}
115115

116116
private fun afterGame(result: Result) {
117+
viewModel.setState(State.AFTER_GAME)
117118
setupUncaughtExceptionHandler()
118119
viewModel.afterGame(result)
119120
}
@@ -186,6 +187,8 @@ class MainActivity : ComponentActivity() {
186187
}
187188
}
188189

190+
State.AFTER_GAME -> BlankScreen()
191+
189192
State.UPLOADING_EVENTS -> LoadingScreen("Uploading events...")
190193

191194
State.ERROR -> {

watch/app/src/main/java/com/imsproject/watch/viewmodel/MainViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class MainViewModel() : ViewModel() {
3131
IN_GAME,
3232
UPLOADING_EVENTS,
3333
ERROR,
34-
ALREADY_CONNECTED
34+
ALREADY_CONNECTED,
35+
AFTER_GAME
3536
}
3637

3738
private var model = MainModel(viewModelScope)
@@ -151,7 +152,6 @@ class MainViewModel() : ViewModel() {
151152
}
152153
setState(State.CONNECTED_IN_LOBBY)
153154
}
154-
155155
else -> {
156156
// typically, when reaching here, the game ended due to a network error
157157
// or some other issue that hasn't been discovered yet.

0 commit comments

Comments
 (0)