|
|
@@ -3,6 +3,7 @@ import Foundation
|
|
|
import LoopKit
|
|
|
import LoopKitUI
|
|
|
import OmniBLE
|
|
|
+import OmniKit
|
|
|
import RileyLinkKit
|
|
|
import SwiftDate
|
|
|
import Swinject
|
|
|
@@ -476,7 +477,16 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
let roundedAmount = pump.roundToSupportedBolusVolume(units: Double(amount))
|
|
|
pump.enactBolus(units: roundedAmount, activationType: .manualRecommendationAccepted) { error in
|
|
|
if let error = error {
|
|
|
- warning(.apsManager, "Announcement Bolus failed with error: \(error.localizedDescription)")
|
|
|
+ // warning(.apsManager, "Announcement Bolus failed with error: \(error.localizedDescription)")
|
|
|
+ switch error {
|
|
|
+ case .uncertainDelivery:
|
|
|
+ // Do not generate notification on uncertain delivery error
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ // Do not generate notifications for automatic boluses that fail.
|
|
|
+ warning(.apsManager, "Announcement Bolus failed with error: \(error.localizedDescription)")
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
debug(.apsManager, "Announcement Bolus succeeded")
|
|
|
self.announcementsStorage.storeAnnouncements([announcement], enacted: true)
|
|
|
@@ -638,11 +648,26 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
bolusReporter?.addObserver(self)
|
|
|
}
|
|
|
|
|
|
+ private func updateStatus() {
|
|
|
+ debug(.apsManager, "force update status")
|
|
|
+ guard let pump = pumpManager else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if let omnipod = pump as? OmnipodPumpManager {
|
|
|
+ omnipod.getPodStatus { _ in }
|
|
|
+ }
|
|
|
+ if let omnipodBLE = pump as? OmniBLEPumpManager {
|
|
|
+ omnipodBLE.getPodStatus { _ in }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private func clearBolusReporter() {
|
|
|
bolusReporter?.removeObserver(self)
|
|
|
bolusReporter = nil
|
|
|
- processQueue.asyncAfter(deadline: .now() + 1) {
|
|
|
+ processQueue.asyncAfter(deadline: .now() + 0.5) {
|
|
|
self.bolusProgress.send(nil)
|
|
|
+ self.updateStatus()
|
|
|
}
|
|
|
}
|
|
|
}
|