forked from fritob/Camper-Monitor
Fahrzeuggrafik-Stil (Vanster/California) auf die Watch ausweiten
Die Uhr zeigte in der Fahrzeug-Ansicht bislang immer Vanster fest verdrahtet, unabhängig von der Auswahl am iPhone – das galt schon vor dieser Session, nicht erst seit dem Solar-Merge. WatchDevice trägt jetzt vehicleGraphicStyle (nur beim Neigungsmesser belegt, wie orientation), von PhoneWatchLink beim Aufbau der Nutzlast gefüllt. WatchVehicleView nimmt den Stil als Parameter statt der fest verdrahteten Vanster-Bildnamen, WatchLevelView reicht ihn aus dem zuletzt vom iPhone übertragenen Stand durch. California-Bilder dafür zusätzlich in den Watch-eigenen Asset-Katalog kopiert (die Uhr hat einen eigenen, vom iPhone getrennten Katalog). Ausgewählt wird der Stil weiterhin nur am iPhone (Neigungsmesser einrichten → Fahrzeuggrafik). Persistenz war dafür schon vorhanden: vehicleGraphicStyle ist ein normales, codiertes Feld auf ConfiguredDevice ohne eigene encode(to:)-Überschreibung – wird also schon beim Speichern mitgeschrieben. Nebenbei: Xcode hat beim Bearbeiten den Build-Zähler auf 2 gesetzt und LSApplicationCategoryType (Dienstprogramme) ergänzt – unverändert übernommen. Build (App + Watch) und Tests grün. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
47ead9b006
commit
c45cf36920
Binary file not shown.
|
After Width: | Height: | Size: 326 KiB |
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "CaliforniaRear.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : { "author" : "xcode", "version" : 1 },
|
||||
"properties" : { "template-rendering-intent" : "template" }
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 323 KiB |
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "CaliforniaSide.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : { "author" : "xcode", "version" : 1 },
|
||||
"properties" : { "template-rendering-intent" : "template" }
|
||||
}
|
||||
@@ -50,7 +50,8 @@ struct LevelReadingPage: View {
|
||||
ScrollView {
|
||||
VStack(spacing: 8) {
|
||||
if showsVehicle {
|
||||
WatchVehicleView(pitch: reading.state.pitch, roll: reading.state.roll)
|
||||
WatchVehicleView(pitch: reading.state.pitch, roll: reading.state.roll,
|
||||
style: link.payload?.levelDevice?.vehicleGraphicStyle ?? .vanster)
|
||||
} else {
|
||||
WatchBubble(pitch: reading.state.pitch, roll: reading.state.roll)
|
||||
.frame(maxWidth: 110)
|
||||
|
||||
@@ -9,15 +9,18 @@ import SwiftUI
|
||||
struct WatchVehicleView: View {
|
||||
let pitch: Double?
|
||||
let roll: Double?
|
||||
/// Vom iPhone übernommen – ausgewählt wird sie nur dort, siehe
|
||||
/// `WatchDevice.vehicleGraphicStyle`.
|
||||
var style: VehicleGraphicStyle = .vanster
|
||||
|
||||
/// Wie am iPhone dreifach überhöht – zwei Grad wären sonst kaum zu sehen.
|
||||
/// Die angeschriebenen Gradzahlen bleiben echt.
|
||||
var body: some View {
|
||||
VStack(spacing: 8) {
|
||||
panel(image: "VansterSide", angle: pitch, title: "Längs",
|
||||
lower: "Front", upper: "Heck", aspect: VehicleTilt.sideAspect)
|
||||
panel(image: "VansterRear", angle: roll, title: "Quer",
|
||||
lower: "links", upper: "rechts", aspect: VehicleTilt.rearAspect)
|
||||
panel(image: style.sideImageName, angle: pitch, title: "Längs",
|
||||
lower: "Front", upper: "Heck", aspect: style.sideAspect)
|
||||
panel(image: style.rearImageName, angle: roll, title: "Quer",
|
||||
lower: "links", upper: "rechts", aspect: style.rearAspect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,17 @@ enum WatchDemo {
|
||||
devices: [
|
||||
WatchDevice(id: levelID, name: "Nivellierung", role: .leveling,
|
||||
link: .live, snapshot: level.snapshot(deviceID: levelID, rssi: -70),
|
||||
level: level, orientation: .identity, fridge: nil),
|
||||
level: level, orientation: .identity,
|
||||
vehicleGraphicStyle: .vanster, fridge: nil),
|
||||
WatchDevice(id: batteryID, name: "Bulltron 200 Ah", role: .bms,
|
||||
link: .live, snapshot: battery, level: nil,
|
||||
orientation: nil, fridge: nil),
|
||||
orientation: nil, vehicleGraphicStyle: nil, fridge: nil),
|
||||
WatchDevice(id: victronSolarID, name: "Solar Dach", role: .victronSolarCharger,
|
||||
link: .live, snapshot: victronSolar, level: nil,
|
||||
orientation: nil, fridge: nil),
|
||||
orientation: nil, vehicleGraphicStyle: nil, fridge: nil),
|
||||
WatchDevice(id: fridgeID, name: "Kühlbox", role: .fridge,
|
||||
link: .live, snapshot: fridge, level: nil, orientation: nil,
|
||||
vehicleGraphicStyle: nil,
|
||||
fridge: WatchFridge(isLive: true, updated: now,
|
||||
isPoweredOn: true, isEco: true, isLocked: false,
|
||||
isDualZone: false, unitSymbol: "°C",
|
||||
|
||||
Reference in New Issue
Block a user