Add Live Activity for level sensor (surfaces on CarPlay automatically)
Replaces the ActivityKit boilerplate with a real lock screen/Dynamic Island UI driven by live pitch/roll readings, toggled from the leveling device's detail screen. Since iOS 17 shows any running Live Activity on CarPlay's dashboard without a dedicated CarPlay app entitlement, this covers the requested CarPlay use case without one. Also fixes the widget extension never being embedded into the app (missing Embed Foundation Extensions build phase and target dependency), which meant no widget or Live Activity could ever have rendered regardless of code changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
da64b1b6bd
commit
bfe2b00a5c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user