mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-04 20:52:23 +01:00
The reverse lookup that turns a trainer app's renamed action back into the Zwift controller action returned the whole MapEntry instead of its key. The expression's static type collapsed to Object?, so it compiled, matched no case in the button switch, fell through to `_ => null` and came back NotHandled — which the action chain reports as "No connection method active". Only actions the selected app actually renames were affected; everything else took the `?? action` fallback and worked. With the app that renames the Y and Z buttons, that is exactly Kudos and Pause: shifting, steering and A/B kept working while those two silently did nothing over the network. The same broken line sat in all three Zwift emulators (network, shared DirCon/FTMS, BLE), so all three are fixed through one shared helper, resolveControllerAction. In the BLE emulator that also makes the `action == InGameAction.frontShift` comparison right below it type-safe instead of comparing an Object? against an enum. KeyPair.hasActiveAction matched the raw action against the emulators' supported actions while the button editor lists them through the mapping, so a renamed action read as unsupported there too. It now resolves the action the same way the emulators do. (No current caller in lib/ — the getter is only exercised by tests today — but the check is now consistent with the delivery path it describes.) Covered by test/emulator_mapped_action_test.dart: both renamed actions reach their physical button on all three emulators, the unmapped actions and the raw controller actions behind the mapping keep working, an action no emulator handles is still reported unhandled, and the mapping does not leak into apps that define none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>