From b0eeeaf8744c6a1a68e16c8b5b0a6cdb0a0266b0 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sat, 13 Sep 2025 18:51:34 -0700 Subject: [PATCH] 2.7.2 Device Metrics Crash Fix (#1400) * Bump version * iOS 26 styled keyboard toolbar Update tips backgrounds * Link the logo to the about page * Remove double logo on node list, update scary location log message, update tls toggle visibility and keyboard scroll dismiss on mqtt config * Remove redundant colorScheme check * Change background for textfield from a capsule to a RoundedRectangle * Fix device metrics crash * Add back rule marks for network colors --- Localizable.xcstrings | 2 +- Meshtastic/Views/Nodes/DeviceMetricsLog.swift | 100 ++++++++---------- 2 files changed, 46 insertions(+), 56 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 5efc6a1c..629f0153 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -42088,4 +42088,4 @@ } }, "version" : "1.1" -} +} \ No newline at end of file diff --git a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift index e21f9241..85352c5d 100644 --- a/Meshtastic/Views/Nodes/DeviceMetricsLog.swift +++ b/Meshtastic/Views/Nodes/DeviceMetricsLog.swift @@ -38,64 +38,54 @@ struct DeviceMetricsLog: View { GroupBox(label: Label("\(deviceMetrics.count) Readings Total", systemImage: "chart.xyaxis.line")) { Chart { ForEach(chartData, id: \.self) { point in - if let batteryLevel = point.batteryLevel { - Plot { - LineMark( - x: .value("x", point.time!), - y: .value("y", batteryLevel) - ) + if let pointTime = point.time { + if let batteryLevel = point.batteryLevel { + Plot { + LineMark( + x: .value("x", pointTime), + y: .value("y", batteryLevel) + ) + } + .accessibilityLabel("Line Series") + .accessibilityValue("X: \(pointTime), Y: \(batteryLevel)") + .foregroundStyle(batteryChartColor) + .interpolationMethod(.linear) } - .accessibilityLabel("Line Series") - .accessibilityValue("X: \(point.time!), Y: \(batteryLevel)") - .foregroundStyle(batteryChartColor) - .interpolationMethod(.linear) - } - if let channelUtilization = point.channelUtilization { - Plot { - PointMark( - x: .value("x", point.time!), - y: .value("y", channelUtilization) - ) - .symbolSize(25) + if let channelUtilization = point.channelUtilization { + Plot { + PointMark( + x: .value("x", pointTime), + y: .value("y", channelUtilization) + ) + .symbolSize(25) + } + .accessibilityLabel("Line Series") + .accessibilityValue("X: \(pointTime), Y: \(channelUtilization)") + .foregroundStyle(channelUtilizationChartColor) } - .accessibilityLabel("Line Series") - .accessibilityValue("X: \(point.time!), Y: \(channelUtilization)") - .foregroundStyle(channelUtilizationChartColor) - } - if let chartSelection { - RuleMark(x: .value("Second", chartSelection, unit: .second)) - .foregroundStyle(.tertiary.opacity(0.5)) -// .annotation( -// position: .automatic, -// overflowResolution: .init(x: .fit, y: .disabled) -// ) { -// ZStack { -// Text("\(getTelemetry(for: chartSelection))") -// } -// .padding() -// .background { -// RoundedRectangle(cornerRadius: 4) -// .foregroundStyle(Color.accentColor.opacity(0.2)) -// } -// } - } - RuleMark(y: .value("Network Status Orange", 25)) - .lineStyle(StrokeStyle(lineWidth: 1, dash: [5, 10])) - .foregroundStyle(.orange) - RuleMark(y: .value("Network Status Red", 50)) - .lineStyle(StrokeStyle(lineWidth: 1, dash: [5, 10])) - .foregroundStyle(.red) - if let airUtilTx = point.airUtilTx { - Plot { - PointMark( - x: .value("x", point.time!), - y: .value("y", airUtilTx) - ) - .symbolSize(25) + if let chartSelection { + RuleMark(x: .value("Second", chartSelection, unit: .second)) + .foregroundStyle(.tertiary.opacity(0.5)) + } + RuleMark(y: .value("Network Status Orange", 25)) + .lineStyle(StrokeStyle(lineWidth: 1, dash: [5, 10])) + .foregroundStyle(.orange) + RuleMark(y: .value("Network Status Red", 50)) + .lineStyle(StrokeStyle(lineWidth: 1, dash: [5, 10])) + .foregroundStyle(.red) + + if let airUtilTx = point.airUtilTx { + Plot { + PointMark( + x: .value("x", pointTime), + y: .value("y", airUtilTx) + ) + .symbolSize(25) + } + .accessibilityLabel("Line Series") + .accessibilityValue("X: \(pointTime), Y: \(airUtilTx)") + .foregroundStyle(airtimeChartColor) } - .accessibilityLabel("Line Series") - .accessibilityValue("X: \(point.time!), Y: \(airUtilTx)") - .foregroundStyle(airtimeChartColor) } } }