Skip to content

Commit e2898de

Browse files
authored
[LOOP-4877] need to keep track of bolusState during transitions (#683)
1 parent 451935a commit e2898de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Loop/View Controllers/StatusTableViewController.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,14 @@ final class StatusTableViewController: LoopChartsTableViewController {
786786
if oldDose != newDose {
787787
tableView.reloadRows(at: [statusIndexPath], with: animated ? .fade : .none)
788788
}
789-
case (.cancelingBolus, .cancelingBolus), (.cancelingBolus, .bolusing(_)), (.canceledBolus(_), .cancelingBolus), (.canceledBolus(_), .bolusing(_)):
790-
// these updates cause flickering and/or confusion.
789+
// these updates cause flickering and/or confusion.
790+
case (.cancelingBolus, .cancelingBolus):
791+
break
792+
case (.cancelingBolus, .bolusing(_)):
793+
break
794+
case (.canceledBolus(_), .cancelingBolus):
795+
break
796+
case (.canceledBolus(_), .bolusing(_)):
791797
break
792798
default:
793799
tableView.reloadRows(at: [statusIndexPath], with: animated ? .fade : .none)
@@ -1082,6 +1088,7 @@ final class StatusTableViewController: LoopChartsTableViewController {
10821088
let progressCell = tableView.dequeueReusableCell(withIdentifier: BolusProgressTableViewCell.className, for: indexPath) as! BolusProgressTableViewCell
10831089
progressCell.selectionStyle = .none
10841090
progressCell.configuration = .canceling
1091+
progressCell.activityIndicator.startAnimating()
10851092
return progressCell
10861093
case .canceledBolus(let dose):
10871094
let progressCell = tableView.dequeueReusableCell(withIdentifier: BolusProgressTableViewCell.className, for: indexPath) as! BolusProgressTableViewCell
@@ -1234,6 +1241,7 @@ final class StatusTableViewController: LoopChartsTableViewController {
12341241
show(vc, sender: tableView.cellForRow(at: indexPath))
12351242
}
12361243
case .bolusing(var dose):
1244+
bolusState = .canceling
12371245
updateBannerAndHUDandStatusRows(statusRowMode: .cancelingBolus, newSize: nil, animated: true)
12381246
Task {
12391247
try? await Task.sleep(nanoseconds: NSEC_PER_SEC)
@@ -1243,6 +1251,8 @@ final class StatusTableViewController: LoopChartsTableViewController {
12431251
DispatchQueue.main.async {
12441252
switch result {
12451253
case .success:
1254+
self.updateBannerAndHUDandStatusRows(statusRowMode: .canceledBolus(dose: dose), newSize: nil, animated: true)
1255+
self.bolusState = .noBolus
12461256
Task {
12471257
try? await Task.sleep(nanoseconds: NSEC_PER_SEC * 10)
12481258
self.canceledDose = nil

0 commit comments

Comments
 (0)