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