Skip to content

Commit 95d4a23

Browse files
committed
update progressCell for bolus display
1 parent 438096a commit 95d4a23

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Loop/View Controllers/StatusTableViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,15 @@ final class StatusTableViewController: LoopChartsTableViewController {
298298
didSet {
299299
if oldValue != bolusState {
300300
switch bolusState {
301-
case .inProgress(_):
301+
case .inProgress(let dose):
302302
guard case .inProgress = oldValue else {
303303
// Bolus starting
304304
bolusProgressReporter = deviceManager.pumpManager?.createBolusProgressReporter(reportingOn: DispatchQueue.main)
305+
// If there is an existing bolus progressCell, update its dose values now in case the app is currently in the
306+
// background as otherwise these values won't get initialized and can contain stale data from some earlier bolus.
307+
if let progressCell = tableView.cellForRow(at: IndexPath(row: StatusRow.status.rawValue, section: Section.status.rawValue)) as? BolusProgressTableViewCell {
308+
progressCell.configuration = .bolusing(delivered: 0, ofTotalVolume: dose.programmedUnits)
309+
}
305310
break
306311
}
307312
default:

0 commit comments

Comments
 (0)