Skip to content

Commit 27c7014

Browse files
author
Rick Pasetto
authored
LOOP-1006: Make 60- and 120-minute "Loop not Looping" alert critical (#101)
* LOOP-1006: Make 60- and 120-minute "Loop not Looping" alert critical * PR Feedback * Also check feature flag and iOS > 12.0
1 parent 33c7463 commit 27c7014

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Loop/Managers/NotificationManager.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct NotificationManager {
131131
// Give a little extra time for a loop-in-progress to complete
132132
let gracePeriod = TimeInterval(minutes: 0.5)
133133

134-
for minutes: Double in [20, 40, 60, 120] {
134+
for (minutes, isCritical) in [(20.0, false), (40.0, false), (60.0, true), (120.0, true)] {
135135
let notification = UNMutableNotificationContent()
136136
let failureInterval = TimeInterval(minutes: minutes)
137137

@@ -145,7 +145,11 @@ struct NotificationManager {
145145
}
146146

147147
notification.title = NSLocalizedString("Loop Failure", comment: "The notification title for a loop failure")
148-
notification.sound = .default
148+
if isCritical, FeatureFlags.criticalAlertsEnabled, #available(iOS 12.0, *) {
149+
notification.sound = .defaultCritical
150+
} else {
151+
notification.sound = .default
152+
}
149153
notification.categoryIdentifier = LoopNotificationCategory.loopNotRunning.rawValue
150154
notification.threadIdentifier = LoopNotificationCategory.loopNotRunning.rawValue
151155

0 commit comments

Comments
 (0)