Skip to content

Commit

Permalink
Show error when last glucose is old
Browse files Browse the repository at this point in the history
  • Loading branch information
gestrich committed Jul 17, 2024
1 parent 4b5e1ea commit 599e4a7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public struct TimelineProviderShared {
let futureValue = value.valueWithDate(nowDate.addingTimeInterval(60 * TimeInterval(index)))
entries.append(.success(futureValue))
}

// The last entry is an error entry as we don't want to show any older glucose info at that point.
let errorDate = nowDate.addingTimeInterval(60.0 * TimeInterval(indexCount))
let glucoseError = GlucoseTimeLineEntryError(error: TimelineProviderError.missingGlucose, date: errorDate, looper: looper)
entries.append(.failure(glucoseError))
return Timeline(entries: entries, policy: .after(nextRequestDate))
} catch {
return Timeline.createTimeline(error: error, looper: looper)
Expand Down

0 comments on commit 599e4a7

Please sign in to comment.