Avoid haptic feedback on complete game overs
This commit is contained in:
parent
f134b3fc09
commit
460e92bee2
2 changed files with 5 additions and 5 deletions
|
@ -804,13 +804,13 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
||||||
gameViewModel.stopClock()
|
gameViewModel.stopClock()
|
||||||
|
|
||||||
if (!isResuming) {
|
if (!isResuming) {
|
||||||
|
val isGameCompleted = gameViewModel.isCompletedWithMistakes()
|
||||||
cloudSaveManager.uploadSave()
|
cloudSaveManager.uploadSave()
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
gameViewModel.gameOver(isResuming)
|
gameViewModel.gameOver(isResuming, !isGameCompleted)
|
||||||
gameViewModel.saveGame()
|
gameViewModel.saveGame()
|
||||||
waitAndShowEndGameAlert(
|
waitAndShowEndGameAlert(
|
||||||
gameResult = if (gameViewModel.isCompletedWithMistakes())
|
gameResult = if (isGameCompleted) GameResult.Completed else GameResult.GameOver,
|
||||||
GameResult.Completed else GameResult.GameOver,
|
|
||||||
await = true,
|
await = true,
|
||||||
canContinue = gameViewModel.hasUnknownMines(),
|
canContinue = gameViewModel.hasUnknownMines(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -428,11 +428,11 @@ open class GameViewModel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun gameOver(fromResumeGame: Boolean) {
|
suspend fun gameOver(fromResumeGame: Boolean, useGameOverFeedback: Boolean) {
|
||||||
gameController.run {
|
gameController.run {
|
||||||
analyticsManager.sentEvent(Analytics.GameOver(clock.time(), getScore()))
|
analyticsManager.sentEvent(Analytics.GameOver(clock.time(), getScore()))
|
||||||
|
|
||||||
if (!fromResumeGame) {
|
if (!fromResumeGame && useGameOverFeedback) {
|
||||||
if (preferencesRepository.useHapticFeedback()) {
|
if (preferencesRepository.useHapticFeedback()) {
|
||||||
hapticFeedbackManager.explosionFeedback()
|
hapticFeedbackManager.explosionFeedback()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue