mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
commit
321a41d3f8
6 changed files with 58 additions and 45 deletions
|
|
@ -8530,6 +8530,9 @@
|
|||
},
|
||||
"Indoor Air Quality" : {
|
||||
|
||||
},
|
||||
"Indoor Air Quality (IAQ)" : {
|
||||
|
||||
},
|
||||
"inputevent.back" : {
|
||||
"extractionState" : "migrated",
|
||||
|
|
|
|||
|
|
@ -603,8 +603,8 @@
|
|||
DD5E523E298F5A9E00D21B61 /* AirQualityIndex.swift */,
|
||||
DDFEB3BA29900C1200EE7472 /* CurrentConditionsCompact.swift */,
|
||||
DDA9515D2BC6F56F00CEA535 /* IndoorAirQuality.swift */,
|
||||
DD41A61429AB0035003C5A37 /* NodeWeatherForecast.swift */,
|
||||
DD354FD82BD96A0B0061A25F /* IAQScale.swift */,
|
||||
DD41A61429AB0035003C5A37 /* NodeWeatherForecast.swift */,
|
||||
);
|
||||
path = Weather;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ struct IAQScale: View {
|
|||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Indoor Air Quality (IAQ)")
|
||||
.font(.title3)
|
||||
ForEach(Iaq.allCases) { iaq in
|
||||
HStack {
|
||||
RoundedRectangle(cornerRadius: 5)
|
||||
|
|
@ -22,11 +24,6 @@ struct IAQScale: View {
|
|||
}
|
||||
}
|
||||
.padding()
|
||||
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
|
||||
// .overlay(
|
||||
// RoundedRectangle(cornerRadius: 20)
|
||||
// .stroke(.secondary, lineWidth: 5)
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,59 +20,70 @@ enum IaqDisplayMode: Int, CaseIterable, Identifiable {
|
|||
}
|
||||
|
||||
struct IndoorAirQuality: View {
|
||||
@State var isLegendOpen = false
|
||||
var iaq: Int = 0
|
||||
var displayMode: IaqDisplayMode = .pill
|
||||
let gradient = Gradient(colors: [.green, .mint, .yellow, .orange, .red, .purple, .purple, .brown, .brown, .brown, .brown])
|
||||
|
||||
var body: some View {
|
||||
let iaqEnum = Iaq.getIaq(for: iaq)
|
||||
switch displayMode {
|
||||
case .pill:
|
||||
ZStack(alignment: .leading) {
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(iaqEnum.color)
|
||||
.frame(width: 125, height: 30)
|
||||
Label("IAQ \(iaq)", systemImage: iaq < 100 ? "aqi.low" : ((iaq > 100 && iaq < 201) ? "aqi.medium" : "aqi.high"))
|
||||
.padding(.leading, 4)
|
||||
}
|
||||
case .dot:
|
||||
VStack {
|
||||
HStack {
|
||||
Text("\(iaq)")
|
||||
Circle()
|
||||
VStack {
|
||||
switch displayMode {
|
||||
case .pill:
|
||||
ZStack(alignment: .leading) {
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(iaqEnum.color)
|
||||
.frame(width: 10, height: 10)
|
||||
.frame(width: 125, height: 30)
|
||||
Label("IAQ \(iaq)", systemImage: iaq < 100 ? "aqi.low" : ((iaq > 100 && iaq < 201) ? "aqi.medium" : "aqi.high"))
|
||||
.padding(.leading, 4)
|
||||
}
|
||||
}
|
||||
case .text:
|
||||
Text(iaqEnum.description)
|
||||
.font(.caption)
|
||||
case .gauge:
|
||||
Gauge(value: Double(iaq), in: 0...500) {
|
||||
|
||||
case .dot:
|
||||
VStack {
|
||||
HStack {
|
||||
Text("\(iaq)")
|
||||
Circle()
|
||||
.fill(iaqEnum.color)
|
||||
.frame(width: 10, height: 10)
|
||||
}
|
||||
}
|
||||
case .text:
|
||||
Text(iaqEnum.description)
|
||||
.font(.caption)
|
||||
case .gauge:
|
||||
Gauge(value: Double(iaq), in: 0...500) {
|
||||
Text("IAQ")
|
||||
.foregroundColor(iaqEnum.color)
|
||||
} currentValueLabel: {
|
||||
Text("\(Int(iaq))")
|
||||
}
|
||||
.tint(gradient)
|
||||
.gaugeStyle(.accessoryCircular)
|
||||
case .gradient:
|
||||
HStack {
|
||||
Gauge(value: Double(iaq), in: 0...500) {
|
||||
Text("IAQ")
|
||||
.foregroundColor(iaqEnum.color)
|
||||
} currentValueLabel: {
|
||||
Text("\(Int(iaq))")
|
||||
Text("IAQ ")+Text("\(Int(iaq))")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
.tint(gradient)
|
||||
.gaugeStyle(.accessoryCircular)
|
||||
case .gradient:
|
||||
HStack {
|
||||
Gauge(value: Double(iaq), in: 0...500) {
|
||||
Text("IAQ")
|
||||
.foregroundColor(iaqEnum.color)
|
||||
} currentValueLabel: {
|
||||
Text("IAQ ")+Text("\(Int(iaq))")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
.tint(gradient)
|
||||
.gaugeStyle(.accessoryLinear)
|
||||
Text(iaqEnum.description)
|
||||
.font(.caption)
|
||||
.gaugeStyle(.accessoryLinear)
|
||||
Text(iaqEnum.description)
|
||||
.font(.caption)
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
}
|
||||
.onTapGesture {
|
||||
isLegendOpen.toggle()
|
||||
}
|
||||
.popover(isPresented: self.$isLegendOpen, arrowEdge: .bottom, content: {
|
||||
VStack(spacing: 0.5) {
|
||||
IAQScale()
|
||||
}
|
||||
.presentationCompactAdaptation(.popover)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct NodeInfoItem: View {
|
|||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
CircleText(
|
||||
text: node.user?.shortName ?? "?",
|
||||
color: Color(UIColor(hex: UInt32(node.num))),
|
||||
|
|
@ -68,6 +69,7 @@ struct NodeInfoItem: View {
|
|||
BatteryGauge(node: node)
|
||||
.padding()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0fd5023a0aa67eefdf2292a624e8fbbda4489a6c
|
||||
Subproject commit d191975ebc572527c6d9eec48d5b0a1e3331999f
|
||||
Loading…
Add table
Add a link
Reference in a new issue