Skip to content

Commit d52edb3

Browse files
authored
Merge pull request #9 from LoopKit/pump-event-store-update
Updates to match protocol changes in LoopKit
2 parents e654e17 + 1118051 commit d52edb3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

MinimedKit/PumpManager/MinimedPumpManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ extension MinimedPumpManager {
772772

773773
self.log.default("Reporting new pump events: %{public}@", String(describing: remainingHistoryEvents + pendingEvents))
774774

775-
delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
775+
delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastReconciliation: self.state.lastReconciliation, replacePendingEvents: true) { (error) in
776776
// Called on an unknown queue by the delegate
777777
if error == nil {
778778
self.recents.lastAddedPumpEvents = self.dateGenerator()
@@ -793,7 +793,7 @@ extension MinimedPumpManager {
793793
})
794794
}
795795
completion(error)
796-
})
796+
}
797797
})
798798
} catch let error {
799799
self.troubleshootPumpComms(using: device)
@@ -815,15 +815,15 @@ extension MinimedPumpManager {
815815
preconditionFailure("pumpManagerDelegate cannot be nil")
816816
}
817817

818-
delegate.pumpManager(self, hasNewPumpEvents: events, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
818+
delegate.pumpManager(self, hasNewPumpEvents: events, lastReconciliation: self.state.lastReconciliation, replacePendingEvents: true) { (error) in
819819
// Called on an unknown queue by the delegate
820820
if let error = error {
821821
self.log.error("Pump event storage failed: %{public}@", String(describing: error))
822822
completion(MinimedPumpManagerError.storageFailure)
823823
} else {
824824
completion(nil)
825825
}
826-
})
826+
}
827827
})
828828
}
829829

MinimedKitTests/Mocks/MockPumpManagerDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MockPumpManagerDelegate: PumpManagerDelegate {
3030

3131
var reportedPumpEvents: [(events: [NewPumpEvent], lastReconciliation: Date?)] = []
3232

33-
func pumpManager(_ pumpManager: PumpManager, hasNewPumpEvents events: [NewPumpEvent], lastReconciliation: Date?, completion: @escaping (Error?) -> Void) {
33+
func pumpManager(_ pumpManager: PumpManager, hasNewPumpEvents events: [NewPumpEvent], lastReconciliation: Date?, replacePendingEvents: Bool, completion: @escaping (Error?) -> Void) {
3434
reportedPumpEvents.append((events: events, lastReconciliation: lastReconciliation))
3535
completion(nil)
3636
}

0 commit comments

Comments
 (0)