forked from fritob/Camper-Monitor
CamperMonitor (Haupt-Repo) und VanAligneiOS (aus dem gemergten solar-integration-Branch) liefen unter zwei verschiedenen internen Namen, obwohl die App nach aussen längst einheitlich "VanControl Pro" heisst. Jetzt durchgängig VanControl: - Ordner: CamperMonitor/, CamperMonitorWatch/, CamperMonitorComplication/, VanAligneiOSWidget/ → VanControl/, VanControlWatch/, VanControlComplication/, VanControlWidget/ - Xcode-Projekt: CamperMonitor.xcodeproj → VanControl.xcodeproj, alle Targets/Schemes/Produktnamen entsprechend umbenannt - Bundle-Identifier auf Wunsch mitgeändert: de.s0.fototeddy.VanControl* (App noch nicht veröffentlicht); dabei auch die WKCompanionAppBundleIdentifier-Werte korrigiert, die noch das alte de.fritob-Präfix statt des tatsächlichen de.s0.fototeddy-Präfixes trugen - Swift-Dateien/Typen: CamperMonitorApp → VanControlApp, VanAligneiOSWidget* → VanControlWidget* - Config/*-Info.plist umbenannt, README.md/Tools/README.md/run-tests.sh auf die neuen Pfade angepasst Bewusst unverändert: firmware/vanalign und alle Bezüge auf "VanAlign" als Namen der Neigungsmesser-Hardware (eigenständiges Produkt, kein App-Name) sowie der komplette Android/-Ordner. Build (App, Watch, Debug) und Protokoll-Testlauf grün. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
70 lines
2.6 KiB
Swift
70 lines
2.6 KiB
Swift
import SwiftUI
|
||
|
||
/// Alle Werte eines Geräts. Am iPhone stehen hier zusätzlich Verlauf und
|
||
/// Diagnose – auf der Uhr wäre beides unlesbar und ist deshalb weggelassen.
|
||
struct WatchDeviceDetailView: View {
|
||
let deviceID: UUID
|
||
|
||
@Environment(PhoneLink.self) private var link
|
||
|
||
private var device: WatchDevice? {
|
||
link.payload?.devices.first { $0.id == deviceID }
|
||
}
|
||
|
||
var body: some View {
|
||
List {
|
||
if let device {
|
||
if let fridge = device.fridge {
|
||
WatchFridgeControls(deviceID: device.id, fridge: fridge)
|
||
}
|
||
|
||
Section {
|
||
ForEach(device.snapshot?.metrics.filter { $0.value != nil } ?? []) { metric in
|
||
LabeledContent(metric.label) {
|
||
Text(metric.formattedWithUnit)
|
||
.monospacedDigit()
|
||
}
|
||
.font(.footnote)
|
||
}
|
||
} header: {
|
||
Text("Messwerte")
|
||
}
|
||
|
||
Section {
|
||
if let fault = device.snapshot?.fault {
|
||
Label(fault, systemImage: "exclamationmark.triangle.fill")
|
||
.font(.caption2)
|
||
.foregroundStyle(.red)
|
||
}
|
||
if let state = device.snapshot?.state {
|
||
Text(state).font(.caption2)
|
||
}
|
||
ForEach(device.snapshot?.offReasons ?? [], id: \.self) { reason in
|
||
Text(reason)
|
||
.font(.caption2)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
Label(device.link.label, systemImage: "antenna.radiowaves.left.and.right")
|
||
.font(.caption2)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
} else {
|
||
Text("Gerät ist nicht mehr im Fahrzeugprofil.")
|
||
.font(.footnote)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
}
|
||
.navigationTitle(device?.name ?? "Gerät")
|
||
// Die Kühlbox wird nur verbunden, solange jemand sie ansieht. Das gilt
|
||
// auch von hier aus – das iPhone verbindet auf Zuruf.
|
||
.onAppear {
|
||
guard device?.fridge != nil else { return }
|
||
link.send(.fridgeSession(device: deviceID, wanted: true))
|
||
}
|
||
.onDisappear {
|
||
guard device?.fridge != nil else { return }
|
||
link.send(.fridgeSession(device: deviceID, wanted: false))
|
||
}
|
||
}
|
||
}
|