Skip to content

Commit cdc6e5c

Browse files
author
Rick Pasetto
authored
LOOP-XXXX: Fix bolus error not showing notification in app (#106)
* LOOP-XXXX: Fix bolus error not showing notification in app Some UserNotifications have not yet been converted to use the new alert system. Until they are converted, this allows them to be shown in-app once again. * PR feedback
1 parent ab30d33 commit cdc6e5c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Loop/AppDelegate.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,19 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
148148
}
149149

150150
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
151-
// UserNotifications are not to be displayed while in the foreground
152-
completionHandler([])
151+
switch notification.request.identifier {
152+
// TODO: Until these notifications are converted to use the new alert system, they shall still show in the foreground
153+
case LoopNotificationCategory.bolusFailure.rawValue,
154+
LoopNotificationCategory.pumpReservoirLow.rawValue,
155+
LoopNotificationCategory.pumpReservoirEmpty.rawValue,
156+
LoopNotificationCategory.pumpBatteryLow.rawValue,
157+
LoopNotificationCategory.pumpExpired.rawValue,
158+
LoopNotificationCategory.pumpFault.rawValue:
159+
completionHandler([.badge, .sound, .alert])
160+
default:
161+
// All other userNotifications are not to be displayed while in the foreground
162+
completionHandler([])
163+
}
153164
}
154165

155166
}

0 commit comments

Comments
 (0)