forked from fritob/Camper-Monitor
Solar-Integration und dev_watch-Geräte zusammenführen
solar-integration (aus dem separaten VanAligneiOS-Repo) und dev_watch haben unabhängige Git-Historien, decken aber überlappende und sich ergänzende Funktionen ab. Übernommen aus solar-integration: Votronic- Solar-ESP-Anbindung samt Geräterolle, die Live-Activity/Widget-Extension fürs Sperrbildschirm/Dynamic-Island/CarPlay, das Querformat-Layout für Libelle/Fahrzeug-Ansicht und Ausrichtungs-Assistent, sowie die mehreren Fahrzeuggrafik-Stile (Vanster/California). Beibehalten aus dev_watch: alle zusätzlichen Geräteprotokolle (Daly-/JBD-BMS, Alpicool- Kühlbox, WattCycle, Victron), die dort zwischenzeitlich entstanden. Die Xcode-Projektdatei wurde von Hand um die neue Widget-Extension samt SharedActivity-Gruppe erweitert (Datei-synchronisierte Gruppen, kein App-Group-Entitlement nötig). Build für App, Watch und Widget-Extension geprüft (Debug und Release). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
812874baef
commit
e9b9c5bcd5
@@ -5,14 +5,18 @@ struct CamperMonitorApp: App {
|
||||
@State private var store: DeviceStore
|
||||
@State private var bluetooth: BluetoothManager
|
||||
@State private var watch: PhoneWatchLink
|
||||
@State private var levelActivity: LevelActivityManager
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
init() {
|
||||
let store = DeviceStore()
|
||||
let bluetooth = BluetoothManager(store: store)
|
||||
let levelActivity = LevelActivityManager()
|
||||
bluetooth.activityManager = levelActivity
|
||||
_store = State(initialValue: store)
|
||||
_bluetooth = State(initialValue: bluetooth)
|
||||
_watch = State(initialValue: PhoneWatchLink(store: store, bluetooth: bluetooth))
|
||||
_levelActivity = State(initialValue: levelActivity)
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
@@ -21,6 +25,7 @@ struct CamperMonitorApp: App {
|
||||
.environment(store)
|
||||
.environment(bluetooth)
|
||||
.environment(watch)
|
||||
.environment(levelActivity)
|
||||
.task { watch.activate() }
|
||||
}
|
||||
.onChange(of: scenePhase) { _, phase in
|
||||
@@ -38,7 +43,11 @@ struct CamperMonitorApp: App {
|
||||
case .active:
|
||||
bluetooth.start()
|
||||
case .background:
|
||||
if !watch.wantsLiveUpdates { bluetooth.stop() }
|
||||
// Läuft gerade eine Live Activity, muss der Neigungsmesser
|
||||
// auch mit dunklem Bildschirm weiter Werte liefern – sonst
|
||||
// friert die Anzeige auf Sperrbildschirm und CarPlay beim
|
||||
// ersten Wegdrücken der App ein.
|
||||
if !watch.wantsLiveUpdates && !levelActivity.isActive { bluetooth.stop() }
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user