|
|
@@ -704,7 +704,16 @@ extension Home {
|
|
|
return sim.simulatedSensorExpiresAt
|
|
|
}
|
|
|
guard let manager else { return nil }
|
|
|
- if let g7 = manager as? G7CGMManager, let exp = g7.sensorExpiresAt { return exp }
|
|
|
+ // Once a G7 enters grace period, `sensorExpiresAt` is in the past
|
|
|
+ // and would collapse the bobble countdown to "<1m" while the arc
|
|
|
+ // (driven by lifecycle.percentComplete against `sensorEndsAt`) is
|
|
|
+ // still mid-progress. Fall back to `sensorEndsAt` so bobble and
|
|
|
+ // arc agree, and the user sees grace-period time remaining.
|
|
|
+ if let g7 = manager as? G7CGMManager {
|
|
|
+ let now = Date()
|
|
|
+ if let exp = g7.sensorExpiresAt, exp > now { return exp }
|
|
|
+ return g7.sensorEndsAt ?? g7.sensorExpiresAt
|
|
|
+ }
|
|
|
if let g6 = manager as? G6CGMManager, let exp = g6.latestReading?.sessionExpDate { return exp }
|
|
|
if let g5 = manager as? G5CGMManager, let exp = g5.latestReading?.sessionExpDate { return exp }
|
|
|
|