mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-01 02:02:33 +01:00
Redesign the Sensors page from device-first to quantity-first per direct author feedback after real-hardware testing: - SensorQuantitySelector: each quantity (Heart Rate, Cadence, Power) is now a row showing its live resolved value plus a shadcn toggle group (SelectedButton pills in a ButtonGroup — shadcn_flutter has no ToggleGroup class at any version through 0.0.54, checked against the actual package source) listing Trainer first, then every known sensor that provides the quantity, including ones not yet connected. Each pill shows the sensor's kind, connection state, and its own live reading. - Selecting a not-yet-connected sensor now connects it: persists the per-device auto-connect consent flag BEFORE calling connect() (ordering preserved exactly from the deleted SensorDiscoverySection), shows a connecting spinner, and a failure state (icon + text + toast + recordError) if it doesn't connect. - Delete the "Detect power meters" opt-in entirely (tile, Settings accessors, and the gate in BluetoothDevice.fromScanResult) — selection is now the consent. Preserve the narrow rule that keeps a power-meter- branded smart bike/trainer (Stages SB20, SRM) classified as ProxyDevice rather than BlePowerDevice: only the opt-in condition was dropped from it, the name/service/trainer-exclusion checks are untouched. - Delete SensorDiscoverySection; sensors now surface inside the quantity they serve instead of a separate "Nearby sensors" list. TDD: dropped the opt-in call from one detection test first to confirm RED before making the production change. 287 tests pass in test/widgets/sensors/, test/services/sensors/, test/bluetooth/, test/bluetooth_device_detection.dart. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>