Fix long press issue with auto-flag

This commit is contained in:
Lucas Lima 2020-03-02 01:02:17 -03:00
parent eede5b9494
commit 9825ed6159
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
2 changed files with 4 additions and 5 deletions

View file

@ -81,8 +81,6 @@ class LevelFacade {
fun hasMarkOn(index: Int): Boolean = getArea(index).mark != Mark.None
fun hasMineOn(index: Int): Boolean = getArea(index).hasMine
fun plantMinesExcept(index: Int, includeSafeArea: Boolean = false) {
plantRandomMines(index, includeSafeArea)
putMinesTips()

View file

@ -176,6 +176,10 @@ class GameViewModel(
field.postValue(levelFacade.field.toList())
}
if (preferencesRepository.useFlagAssistant() && !levelFacade.hasAnyMineExploded()){
levelFacade.runFlagAssistant()
}
refreshGameStatus()
analyticsManager.sentEvent(Event.PressArea(index))
}
@ -189,9 +193,6 @@ class GameViewModel(
eventObserver.postValue(GameEvent.GameOver)
}
else -> {
if (preferencesRepository.useFlagAssistant()){
levelFacade.runFlagAssistant()
}
eventObserver.postValue(GameEvent.Running)
}
}