Fix device signing/companion ID, duplicate-device crash, background updates, and add level bubble to Live Activity

- Assign the shared development team to the widget extension and watch
  complication targets, and correct the watch app's companion bundle
  identifier so on-device installs succeed after the bundle ID rename
  to de.s0.fototeddy.VanAligneiOS.
- Guard against two ConfiguredDevices sharing a peripheralID (e.g. a
  double-tapped "Sichern"), which crashed BluetoothManager's
  Dictionary(uniqueKeysWithValues:) on launch.
- Keep Bluetooth running in the background while a Live Activity is
  active, so lock screen/CarPlay keep receiving fresh readings instead
  of freezing at the last value before backgrounding.
- Render the actual bubble-level graphic (not just a static icon) in
  the Live Activity's lock screen view and expanded Dynamic Island.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
fototeddy
2026-09-04 23:50:08 +02:00
co-authored by Claude Sonnet 5
parent bfe2b00a5c
commit 9a3b5cb472
6 changed files with 114 additions and 37 deletions
@@ -517,7 +517,11 @@ final class BluetoothManager: NSObject {
// MARK: - Ablauf auf der Funk-Queue
private func applyConfiguration(_ devices: [ManagedDevice]) {
managed = Dictionary(uniqueKeysWithValues: devices.map { ($0.peripheralID, $0) })
// Mit `uniqueKeysWithValues` stürzt das bei doppelt eingerichteten
// Geräten (gleiches Peripheral, aus Versehen zweimal hinzugefügt) ab.
// Der letzte Eintrag gewinnt besser eine überschriebene Dublette als
// ein Absturz der ganzen Funk-Schicht.
managed = Dictionary(devices.map { ($0.peripheralID, $0) }, uniquingKeysWith: { _, latest in latest })
// Verbindungen zu Geräten lösen, die nicht mehr dazugehören.
let wanted = Set(devices.filter { shouldStayConnected($0) }.map(\.peripheralID))