Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions MinimedKit/PumpManager/MinimedPumpManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ extension MinimedPumpManager {

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

delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastReconciliation: self.state.lastReconciliation, replacePendingEvents: true) { (error) in
// Called on an unknown queue by the delegate
if error == nil {
self.recents.lastAddedPumpEvents = self.dateGenerator()
Expand All @@ -793,7 +793,7 @@ extension MinimedPumpManager {
})
}
completion(error)
})
}
})
} catch let error {
self.troubleshootPumpComms(using: device)
Expand All @@ -815,15 +815,15 @@ extension MinimedPumpManager {
preconditionFailure("pumpManagerDelegate cannot be nil")
}

delegate.pumpManager(self, hasNewPumpEvents: events, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
delegate.pumpManager(self, hasNewPumpEvents: events, lastReconciliation: self.state.lastReconciliation, replacePendingEvents: true) { (error) in
// Called on an unknown queue by the delegate
if let error = error {
self.log.error("Pump event storage failed: %{public}@", String(describing: error))
completion(MinimedPumpManagerError.storageFailure)
} else {
completion(nil)
}
})
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion MinimedKitTests/Mocks/MockPumpManagerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MockPumpManagerDelegate: PumpManagerDelegate {

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

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