Skip to content
Open
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
7 changes: 4 additions & 3 deletions G7SensorKitUI/G7CGMManager/G7CGMManager+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ extension G7CGMManager: CGMManagerUI {
public var cgmLifecycleProgress: DeviceLifecycleProgress? {
switch lifecycleState {
case .ok:
// show remaining lifetime, if < 24 hours
// show remaining lifetime, if < 48 hours
guard let expiration = sensorExpiresAt else {
return nil
}
let remaining = max(0, expiration.timeIntervalSinceNow)

if remaining < .hours(24) {
return G7LifecycleProgress(percentComplete: 1-(remaining/lifetime), progressState: .warning)
if remaining < .hours(48) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is starting to show warning state at 48 hours. I think it's fine showing the progress bar earlier, but it should probably still be non-warning, until 24 hours before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapted in 6f86bb3

let progressState: DeviceLifecycleProgressState = remaining < .hours(24) ? .warning : .normalCGM
return G7LifecycleProgress(percentComplete: 1-(remaining/lifetime), progressState: progressState)
}
return nil
case .gracePeriod:
Expand Down