mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
The Local Network warning fired at startup and the wizard then opened over it. _NavigationState.initState calls startEnabledConnectionMethod() synchronously, while the onboarding push happens later in an async block — so the toast lands first. The deferral rule required *both* "onboarding not yet run" and "no connection method enabled", so a pending wizard on a device that already had a method switched on still probed. Every method setting defaults to false, so that conjunction only ever differed in exactly this case: a rider re-entering the wizard with an existing configuration. Drop it — if the wizard is about to take the screen, defer, full stop. That also makes this gate and the getScanRequirements one identical. Guard inside startEnabledConnectionMethod() rather than at the navigation call site, so trainer_setup.dart's two calls are covered as well; the wizard hits those when the rider picks a trainer app, which is the same bug one step later. Nothing is lost while onboarding runs: setOnboardingMethodEnabled starts its servers directly. hasAnyConnectionMethodEnabled goes with it — it existed only to feed the clause that is now gone. The regression test was checked both ways: with the guard stubbed out it fails with Expected: empty / Actual: ['check']. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 1eee7644213e93201f7073d97c74f13c593b4cde)