Android: the engine button turns the engine off again
The button kept toggleEngine as it was when the screen was first drawn, so it saw the engine off forever; the function now reads the states when pressed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f8c2f11e46
commit
cb61f546ba
2 changed files with 9 additions and 2 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Android: the engine button turns the engine off again (in 0.11.1 it only turned it on).
|
||||
|
||||
## [0.11.1] — 2026-10-23
|
||||
|
||||
- Android: **boards and pieces** — Settings → «Board and pieces» offers the 37 boards and
|
||||
|
|
|
|||
|
|
@ -277,9 +277,12 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
go(n.id.toInt())
|
||||
}
|
||||
fun toggleEngine() {
|
||||
// Read from the states now: the button may hold this function as it was when the
|
||||
// screen was first drawn.
|
||||
val ready = files.state.value == NetState.Ready
|
||||
when {
|
||||
engineWanted && engineReady -> engineVisit = null
|
||||
engineReady -> engineVisit = app.visit
|
||||
ready && engineVisit == app.visit -> engineVisit = null
|
||||
ready -> engineVisit = app.visit
|
||||
files.builtIn -> {
|
||||
wantEngine = true
|
||||
files.prepare()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue