Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions G7SensorKitUI/Views/G7SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions G7SensorKitUI/Views/G7SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down