diff --git a/Localizable.xcstrings b/Localizable.xcstrings index fd5400d29..e58123c20 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -8530,6 +8530,9 @@ }, "Indoor Air Quality" : { + }, + "Indoor Air Quality (IAQ)" : { + }, "inputevent.back" : { "extractionState" : "migrated", diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index f51a741ef..f336ce5f5 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -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 = ""; diff --git a/Meshtastic/Views/Helpers/Weather/IAQScale.swift b/Meshtastic/Views/Helpers/Weather/IAQScale.swift index e83d5e87e..ad5d7e7cd 100644 --- a/Meshtastic/Views/Helpers/Weather/IAQScale.swift +++ b/Meshtastic/Views/Helpers/Weather/IAQScale.swift @@ -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) -// ) } } diff --git a/Meshtastic/Views/Helpers/Weather/IndoorAirQuality.swift b/Meshtastic/Views/Helpers/Weather/IndoorAirQuality.swift index 8e3773b97..4e7db17a9 100644 --- a/Meshtastic/Views/Helpers/Weather/IndoorAirQuality.swift +++ b/Meshtastic/Views/Helpers/Weather/IndoorAirQuality.swift @@ -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) + }) } } diff --git a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift index 0ca9d012c..784e2b7bb 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeInfoItem.swift @@ -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) } diff --git a/protobufs b/protobufs index 0fd5023a0..d191975eb 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 0fd5023a0aa67eefdf2292a624e8fbbda4489a6c +Subproject commit d191975ebc572527c6d9eec48d5b0a1e3331999f