diff --git a/Shared/WatchLink/WatchLink.swift b/Shared/WatchLink/WatchLink.swift index f84dcf2..ad154a2 100644 --- a/Shared/WatchLink/WatchLink.swift +++ b/Shared/WatchLink/WatchLink.swift @@ -92,6 +92,10 @@ struct WatchDevice: Codable, Equatable, Identifiable, Sendable { /// den Neigungsmesser selbst an und braucht die Zuordnung deshalb auch – /// eingestellt wird sie weiterhin nur am iPhone. var orientation: SensorOrientation? + /// Ebenfalls nur beim Neigungsmesser: welche Fahrzeuggrafik die + /// Fahrzeug-Ansicht zeigt. Ausgewählt wird sie nur am iPhone, die Uhr + /// übernimmt nur die Anzeige. + var vehicleGraphicStyle: VehicleGraphicStyle? /// Nur bei der Kühlbox belegt. var fridge: WatchFridge? diff --git a/Tests/main.swift b/Tests/main.swift index 63e3d04..ce8e454 100644 --- a/Tests/main.swift +++ b/Tests/main.swift @@ -1190,13 +1190,14 @@ let watchPayload = WatchPayload( devices: [ WatchDevice(id: watchLevelID, name: "Nivellierung", role: .leveling, link: .live, snapshot: watchLevelSnapshot, - level: watchLevel, orientation: watchOrientation, fridge: nil), + level: watchLevel, orientation: watchOrientation, + vehicleGraphicStyle: .vanster, fridge: nil), WatchDevice(id: watchBoosterID, name: "Ladebooster", role: .chargeBooster, link: .failed("Nicht gefunden"), snapshot: boosterSnapshot, - level: nil, orientation: nil, fridge: nil), + level: nil, orientation: nil, vehicleGraphicStyle: nil, fridge: nil), WatchDevice(id: watchFridgeID, name: "Kühlbox", role: .fridge, link: .live, snapshot: nil, level: nil, - orientation: nil, fridge: watchFridge), + orientation: nil, vehicleGraphicStyle: nil, fridge: watchFridge), ]) // Der ganze Weg: verpacken, als WatchConnectivity-Wörterbuch lesen, vergleichen. diff --git a/VanControl.xcodeproj/project.pbxproj b/VanControl.xcodeproj/project.pbxproj index 04705a5..17165af 100644 --- a/VanControl.xcodeproj/project.pbxproj +++ b/VanControl.xcodeproj/project.pbxproj @@ -501,7 +501,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = V5C6Q86XJR; ENABLE_PREVIEWS = YES; @@ -509,6 +509,7 @@ INFOPLIST_FILE = "Config/VanControl-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = "VanControl Pro"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Zum Auslesen von Victron-Geraeten und dem Daly BMS per Bluetooth."; INFOPLIST_KEY_NSSupportsLiveActivities = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -536,7 +537,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = V5C6Q86XJR; ENABLE_PREVIEWS = YES; @@ -544,6 +545,7 @@ INFOPLIST_FILE = "Config/VanControl-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = "VanControl Pro"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Zum Auslesen von Victron-Geraeten und dem Daly BMS per Bluetooth."; INFOPLIST_KEY_NSSupportsLiveActivities = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -569,7 +571,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = V5C6Q86XJR; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -601,7 +603,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = V5C6Q86XJR; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -631,7 +633,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = V5C6Q86XJR; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Config/VanControlComplication-Info.plist"; @@ -660,7 +662,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = V5C6Q86XJR; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Config/VanControlComplication-Info.plist"; @@ -691,7 +693,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = V5C6Q86XJR; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VanControlLiveActivity/Info.plist; @@ -720,7 +722,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = V5C6Q86XJR; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VanControlLiveActivity/Info.plist; diff --git a/VanControl/Watch/PhoneWatchLink.swift b/VanControl/Watch/PhoneWatchLink.swift index dd4fc2a..3f7d0e8 100644 --- a/VanControl/Watch/PhoneWatchLink.swift +++ b/VanControl/Watch/PhoneWatchLink.swift @@ -135,6 +135,7 @@ final class PhoneWatchLink: NSObject { snapshot: bluetooth.snapshots[device.id], level: device.role == .leveling ? bluetooth.levelStates[device.id] : nil, orientation: device.role == .leveling ? device.sensorOrientation : nil, + vehicleGraphicStyle: device.role == .leveling ? device.vehicleGraphicStyle : nil, fridge: device.role == .fridge ? fridgeState(for: device) : nil) } return WatchPayload(generatedAt: Date(), diff --git a/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/CaliforniaRear.png b/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/CaliforniaRear.png new file mode 100644 index 0000000..a06e444 Binary files /dev/null and b/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/CaliforniaRear.png differ diff --git a/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/Contents.json b/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/Contents.json new file mode 100644 index 0000000..90e4a2e --- /dev/null +++ b/VanControlWatch/Assets.xcassets/CaliforniaRear.imageset/Contents.json @@ -0,0 +1,10 @@ +{ + "images" : [ + { + "filename" : "CaliforniaRear.png", + "idiom" : "universal" + } + ], + "info" : { "author" : "xcode", "version" : 1 }, + "properties" : { "template-rendering-intent" : "template" } +} diff --git a/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/CaliforniaSide.png b/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/CaliforniaSide.png new file mode 100644 index 0000000..69e25ff Binary files /dev/null and b/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/CaliforniaSide.png differ diff --git a/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/Contents.json b/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/Contents.json new file mode 100644 index 0000000..ceefcab --- /dev/null +++ b/VanControlWatch/Assets.xcassets/CaliforniaSide.imageset/Contents.json @@ -0,0 +1,10 @@ +{ + "images" : [ + { + "filename" : "CaliforniaSide.png", + "idiom" : "universal" + } + ], + "info" : { "author" : "xcode", "version" : 1 }, + "properties" : { "template-rendering-intent" : "template" } +} diff --git a/VanControlWatch/Views/WatchLevelView.swift b/VanControlWatch/Views/WatchLevelView.swift index 58aa213..4cc3d3c 100644 --- a/VanControlWatch/Views/WatchLevelView.swift +++ b/VanControlWatch/Views/WatchLevelView.swift @@ -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) diff --git a/VanControlWatch/Views/WatchVehicleView.swift b/VanControlWatch/Views/WatchVehicleView.swift index ce95873..a672c85 100644 --- a/VanControlWatch/Views/WatchVehicleView.swift +++ b/VanControlWatch/Views/WatchVehicleView.swift @@ -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) } } diff --git a/VanControlWatch/WatchDemo.swift b/VanControlWatch/WatchDemo.swift index f64196f..188a24e 100644 --- a/VanControlWatch/WatchDemo.swift +++ b/VanControlWatch/WatchDemo.swift @@ -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",