From 506b8eab62e0722396f49bea58203c8434d3fac5 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Thu, 22 Oct 2026 13:15:18 -0500 Subject: [PATCH] Show a temporary sensor issue in G7 settings While the latest reading reports a temporary sensor issue (state 18), the last-reading row shows "Sensor Issue" instead of dashes, and the Sensor section explains that readings usually resume on their own. Same check as the "Sensor Issue" status highlight. --- G7SensorKitUI/Views/G7SettingsView.swift | 14 ++++++++++++++ G7SensorKitUI/Views/G7SettingsViewModel.swift | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/G7SensorKitUI/Views/G7SettingsView.swift b/G7SensorKitUI/Views/G7SettingsView.swift index f46cc10..00935cc 100644 --- a/G7SensorKitUI/Views/G7SettingsView.swift +++ b/G7SensorKitUI/Views/G7SettingsView.swift @@ -228,6 +228,13 @@ if viewModel.sessionMode == .eavesdropping { ) } } + if viewModel.hasSensorIssue && !sessionIsOver { + warning( + title: LocalizedString("Sensor Issue", comment: "Settings warning title while the sensor reports a temporary issue"), + message: LocalizedString("The sensor is reporting a temporary problem and is not sending glucose readings. They usually come back on their own, which can take up to 3 hours; you do not need to remove the sensor. Use a meter for treatment decisions until they do.", comment: "Settings warning body while the sensor reports a temporary issue"), + style: .informational + ) + } // Eavesdropping sessions lead with the way out of them. if viewModel.sessionMode == .eavesdropping { if viewModel.isDexcomAppInstalled { @@ -721,6 +728,13 @@ if viewModel.sessionMode == .eavesdropping { .foregroundColor(.secondary) } } + } else if viewModel.hasSensorIssue { + HStack(spacing: 8) { + badge(systemName: "exclamationmark", color: guidanceColors.warning) + Text(LocalizedString("Sensor Issue", comment: "Last reading row text while the sensor reports a temporary issue")) + .font(.headline) + .lineLimit(2) + } } else if viewModel.lifecycleState == .warmup { HStack(spacing: 8) { outlinedBadge(systemName: "clock", color: glucoseTintColor) diff --git a/G7SensorKitUI/Views/G7SettingsViewModel.swift b/G7SensorKitUI/Views/G7SettingsViewModel.swift index 7764d6a..73c8928 100644 --- a/G7SensorKitUI/Views/G7SettingsViewModel.swift +++ b/G7SensorKitUI/Views/G7SettingsViewModel.swift @@ -322,6 +322,12 @@ class G7SettingsViewModel: ObservableObject { updateValues() } + /// Whether the last reading reports a temporary sensor issue, the same + /// check behind the "Sensor Issue" status highlight. + var hasSensorIssue: Bool { + lastReading?.algorithmState.hasTemporaryError == true + } + /// Whether the last reading carries a glucose value worth showing. var hasLastGlucose: Bool { guard let lastReading = lastReading, lastReading.hasReliableGlucose else {