Skip to content

Commit 65caad7

Browse files
authored
[LOOP-4760] vibrate for none critical alerts (#754)
1 parent df37176 commit 65caad7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Loop/Managers/Alerts/UserNotificationAlertScheduler.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import LoopKit
1010
import UIKit
11+
import AudioToolbox
1112

1213
public protocol UserNotificationCenter {
1314
func add(_ request: UNNotificationRequest, withCompletionHandler: ((Error?) -> Void)?)
@@ -84,8 +85,12 @@ fileprivate extension Alert {
8485

8586
switch sound {
8687
case .vibrate:
88+
guard interruptionLevel == .critical else {
89+
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
90+
return nil
91+
}
8792
// setting the audio volume of critical alert to 0 only vibrates
88-
return interruptionLevel == .critical ? .defaultCriticalSound(withAudioVolume: 0) : nil
93+
return .defaultCriticalSound(withAudioVolume: 0)
8994
default:
9095
if let actualFileName = AlertManager.soundURL(for: self)?.lastPathComponent {
9196
let unname = UNNotificationSoundName(rawValue: actualFileName)

0 commit comments

Comments
 (0)