mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Environment display for sensor data
This commit is contained in:
parent
aea6fe045f
commit
4bfd70bf3b
4 changed files with 33 additions and 2 deletions
|
|
@ -6963,6 +6963,9 @@
|
|||
},
|
||||
"Enter DFU Mode" : {
|
||||
|
||||
},
|
||||
"environment" : {
|
||||
|
||||
},
|
||||
"Environment" : {
|
||||
|
||||
|
|
@ -22388,6 +22391,9 @@
|
|||
},
|
||||
"Waypoint Options" : {
|
||||
|
||||
},
|
||||
"Weather Conditions" : {
|
||||
|
||||
},
|
||||
"Web Flasher" : {
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ extension UserDefaults {
|
|||
case channelMessageNotifications
|
||||
case modemPreset
|
||||
case firmwareVersion
|
||||
case environmentEnableWeatherKit
|
||||
case testIntEnum
|
||||
}
|
||||
|
||||
|
|
@ -161,6 +162,9 @@ extension UserDefaults {
|
|||
|
||||
@UserDefault(.firmwareVersion, defaultValue: "0.0.0")
|
||||
static var firmwareVersion: String
|
||||
|
||||
@UserDefault(.environmentEnableWeatherKit, defaultValue: false)
|
||||
static var environmentEnableWeatherKit: Bool
|
||||
|
||||
@UserDefault(.testIntEnum, defaultValue: .one)
|
||||
static var testIntEnum: TestIntEnum
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import CoreLocation
|
|||
import OSLog
|
||||
|
||||
struct NodeDetail: View {
|
||||
private let gridItemLayout = Array(repeating: GridItem(.flexible(), spacing: 10), count: 2)
|
||||
private static let relativeFormatter: RelativeDateTimeFormatter = {
|
||||
let formatter = RelativeDateTimeFormatter()
|
||||
formatter.unitsStyle = .full
|
||||
|
|
@ -157,9 +158,20 @@ struct NodeDetail: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
if node.hasPositions || node.hasEnvironmentMetrics {
|
||||
if node.hasPositions && UserDefaults.environmentEnableWeatherKit || node.hasEnvironmentMetrics {
|
||||
Section("Environment") {
|
||||
LocalWeatherConditions(location: node.latestPosition?.nodeLocation)
|
||||
if !node.hasEnvironmentMetrics {
|
||||
LocalWeatherConditions(location: node.latestPosition?.nodeLocation)
|
||||
} else {
|
||||
VStack {
|
||||
LazyVGrid(columns: gridItemLayout) {
|
||||
WeatherConditionsCompactWidget(temperature: String(node.latestEnvironmentMetrics?.temperature.formattedTemperature() ?? "99°"), symbolName: "cloud.sun", description: "TEMP")
|
||||
HumidityCompactWidget(humidity: Int(node.latestEnvironmentMetrics?.relativeHumidity ?? 0), dewPoint: "99°")
|
||||
PressureCompactWidget(pressure: String(node.latestEnvironmentMetrics?.barometricPressure ?? 0.0), unit: "mbar")
|
||||
// WindCompactWidget(speed: windSpeed, gust: windGust, direction: windCompassDirection)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Section("Logs") {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ struct AppSettings: View {
|
|||
@State var totalDownloadedTileSize = ""
|
||||
@State private var isPresentingCoreDataResetConfirm = false
|
||||
@State private var isPresentingDeleteMapTilesConfirm = false
|
||||
@AppStorage("environmentEnableWeatherKit") private var environmentEnableWeatherKit: Bool = true
|
||||
var body: some View {
|
||||
VStack {
|
||||
Form {
|
||||
|
|
@ -23,6 +24,14 @@ struct AppSettings: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
Section(header: Text("environment")) {
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(isOn: $environmentEnableWeatherKit) {
|
||||
Label("Weather Conditions", systemImage: "cloud.sun")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
}
|
||||
}
|
||||
Section(header: Text("App Data")) {
|
||||
Button {
|
||||
isPresentingCoreDataResetConfirm = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue