From 95d4a23f24ba66106042f7f7e6d2f43426ecb4d0 Mon Sep 17 00:00:00 2001 From: marionbarker Date: Sat, 16 Nov 2024 16:55:05 -0800 Subject: [PATCH] update progressCell for bolus display --- Loop/View Controllers/StatusTableViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Loop/View Controllers/StatusTableViewController.swift b/Loop/View Controllers/StatusTableViewController.swift index 9fe356cccf..4ef74b7b0d 100644 --- a/Loop/View Controllers/StatusTableViewController.swift +++ b/Loop/View Controllers/StatusTableViewController.swift @@ -298,10 +298,15 @@ final class StatusTableViewController: LoopChartsTableViewController { didSet { if oldValue != bolusState { switch bolusState { - case .inProgress(_): + case .inProgress(let dose): guard case .inProgress = oldValue else { // Bolus starting bolusProgressReporter = deviceManager.pumpManager?.createBolusProgressReporter(reportingOn: DispatchQueue.main) + // If there is an existing bolus progressCell, update its dose values now in case the app is currently in the + // background as otherwise these values won't get initialized and can contain stale data from some earlier bolus. + if let progressCell = tableView.cellForRow(at: IndexPath(row: StatusRow.status.rawValue, section: Section.status.rawValue)) as? BolusProgressTableViewCell { + progressCell.configuration = .bolusing(delivered: 0, ofTotalVolume: dose.programmedUnits) + } break } default: