diff --git a/lib/bluetooth/connection.dart b/lib/bluetooth/connection.dart index 1a67c221..6814f334 100644 --- a/lib/bluetooth/connection.dart +++ b/lib/bluetooth/connection.dart @@ -501,6 +501,16 @@ class Connection { } } + /// Connect a device that is already in the list — used by the in-place + /// picker ("No connection" -> Virtual Shifting / Proxy on the same object). + /// + /// Routes through the same [_connect] path the auto-connect queue uses so the + /// action / connection-state listeners are (re)attached. A bare + /// [ProxyDevice.startProxy] would reconnect the BLE upstream but leave + /// `isConnected` stuck — the listener that flips it is torn down on + /// disconnect and only [_connect] re-establishes it. + Future connectDevice(BaseDevice device) => _connect(device); + Future _connect(BaseDevice device) async { // Cancel any stale subscriptions from a previous connect attempt so a retry // doesn't stack listeners on the same device's streams. diff --git a/lib/pages/proxy_device_details/connection_card.dart b/lib/pages/proxy_device_details/connection_card.dart index d524aa8a..a1edf0af 100644 --- a/lib/pages/proxy_device_details/connection_card.dart +++ b/lib/pages/proxy_device_details/connection_card.dart @@ -166,7 +166,12 @@ class _ConnectionCardState extends State { device.setRetrofitMode(next); await core.settings.setRetrofitMode(device.trainerKey, next); await core.settings.setAutoConnect(device.trainerKey, true); - await device.startProxy(); + // Route through the connection manager (not device.startProxy directly) so + // the action / connection-state listeners are re-attached. After an + // in-place "No connection" disconnect those listeners are gone, and a bare + // startProxy reconnects BLE but never flips isConnected — the connect + // appears to hang. + await core.connection.connectDevice(device); } }