@@ -775,7 +775,7 @@ extension DeviceDataManager: DeviceManagerDelegate {
775775 }
776776}
777777
778- // MARK: - UserAlertHandler
778+ // MARK: - AlertIssuer
779779extension DeviceDataManager : AlertIssuer {
780780 static let managerIdentifier = " DeviceDataManager "
781781
@@ -786,22 +786,6 @@ extension DeviceDataManager: AlertIssuer {
786786 func retractAlert( identifier: Alert . Identifier ) {
787787 alertManager? . retractAlert ( identifier: identifier)
788788 }
789-
790- static var pumpBatteryLowAlertIdentifier : Alert . Identifier {
791- return Alert . Identifier ( managerIdentifier: managerIdentifier, alertIdentifier: " PumpBatteryLow " )
792- }
793-
794- public var pumpBatteryLowAlert : Alert {
795- let title = NSLocalizedString ( " Pump Battery Low " , comment: " The notification title for a low pump battery " )
796- let body = NSLocalizedString ( " Change the pump battery immediately " , comment: " The notification alert describing a low pump battery " )
797- let content = Alert . Content ( title: title,
798- body: body,
799- acknowledgeActionButtonLabel: NSLocalizedString ( " Dismiss " , comment: " Default alert dismissal " ) )
800- return Alert ( identifier: DeviceDataManager . pumpBatteryLowAlertIdentifier,
801- foregroundContent: content,
802- backgroundContent: content,
803- trigger: . immediate)
804- }
805789}
806790
807791// MARK: - CGMManagerDelegate
@@ -963,19 +947,11 @@ extension DeviceDataManager: PumpManagerDelegate {
963947 log. default ( " PumpManager:%{public}@ did update status: %{public}@ " , String ( describing: type ( of: pumpManager) ) , String ( describing: status) )
964948
965949 doseStore. device = status. device
966-
967- if let newBatteryValue = status. pumpBatteryChargeRemaining {
968-
969- if newBatteryValue != oldStatus. pumpBatteryChargeRemaining,
970- newBatteryValue == 0
971- {
972- issueAlert ( pumpBatteryLowAlert)
973- }
974-
975- if let oldBatteryValue = oldStatus. pumpBatteryChargeRemaining, newBatteryValue - oldBatteryValue >= LoopConstants . batteryReplacementDetectionThreshold {
976- retractAlert ( identifier: DeviceDataManager . pumpBatteryLowAlertIdentifier)
977- analyticsServicesManager. pumpBatteryWasReplaced ( )
978- }
950+
951+ if let newBatteryValue = status. pumpBatteryChargeRemaining,
952+ let oldBatteryValue = oldStatus. pumpBatteryChargeRemaining,
953+ newBatteryValue - oldBatteryValue >= LoopConstants . batteryReplacementDetectionThreshold {
954+ analyticsServicesManager. pumpBatteryWasReplaced ( )
979955 }
980956
981957 if status. basalDeliveryState != oldStatus. basalDeliveryState {
0 commit comments