Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COASTAL-1449-LOOP-5216] if delivery states are not changed, still update UI #749

Merged
merged 2 commits into from
Jan 22, 2025
Merged
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
20 changes: 17 additions & 3 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1924,8 +1924,19 @@ extension StatusTableViewController: CompletionDelegate {
extension StatusTableViewController: PumpManagerStatusObserver {
func pumpManager(_ pumpManager: PumpManager, didUpdate status: PumpManagerStatus, oldStatus: PumpManagerStatus) {
log.default("PumpManager:%{public}@ did update status", String(describing: type(of: pumpManager)))
basalDeliveryState = status.basalDeliveryState
bolusState = status.bolusState

if basalDeliveryState == status.basalDeliveryState,
bolusState == status.bolusState
{
// if the basal and bolus states have not changed, still update UI
Task { @MainActor in
refreshContext.update(with: .status)
await self.reloadData(animated: true)
}
} else {
basalDeliveryState = status.basalDeliveryState
bolusState = status.bolusState
}
}
}

Expand All @@ -1946,7 +1957,10 @@ extension StatusTableViewController: DoseProgressObserver {
self.bolusProgressReporter = nil
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
self.bolusState = .noBolus
Task { await self.reloadData(animated: true) }
Task {
self.refreshContext.update(with: .insulin)
await self.reloadData(animated: true)
}
})
}
}
Expand Down