commit
9c91fb365d
3 changed files with 12 additions and 5 deletions
|
@ -750,7 +750,13 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
keepScreenOn(false)
|
||||
|
||||
if (!isResuming) {
|
||||
lifecycleScope.launch {
|
||||
gameViewModel.saveGame()
|
||||
gameViewModel.saveStats()
|
||||
}
|
||||
|
||||
cloudSaveManager.uploadSave()
|
||||
|
||||
gameViewModel.addNewTip()
|
||||
|
||||
waitAndShowEndGameAlert(
|
||||
|
@ -773,8 +779,10 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
|
||||
if (!isResuming) {
|
||||
cloudSaveManager.uploadSave()
|
||||
GlobalScope.launch(context = Dispatchers.Main) {
|
||||
lifecycleScope.launch {
|
||||
gameViewModel.gameOver(isResuming)
|
||||
gameViewModel.saveGame()
|
||||
gameViewModel.saveStats()
|
||||
waitAndShowEndGameAlert(
|
||||
victory = false,
|
||||
await = true
|
||||
|
|
|
@ -73,6 +73,8 @@ class SplashViewModel(
|
|||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}.distinctBy {
|
||||
it.uid
|
||||
}.forEach {
|
||||
statsRepository.addStats(it)
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ open class GameViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun saveStats() {
|
||||
suspend fun saveStats() {
|
||||
if (initialized) {
|
||||
gameController.let {
|
||||
if (it.hasMines()) {
|
||||
|
@ -466,9 +466,6 @@ open class GameViewModel(
|
|||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
saveStats()
|
||||
saveGame()
|
||||
|
||||
checkVictoryAchievements()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue