mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(apple/macOS): Don't log notificationsNotAllowed (#7762)
This can happen if the user hasn't granted notifications and isn't worth reporting.
This commit is contained in:
@@ -107,9 +107,17 @@ private class NotificationAdapter: NSObject, UNUserNotificationCenterDelegate {
|
||||
|
||||
notificationCenter.delegate = self
|
||||
notificationCenter.requestAuthorization(options: [.sound, .badge, .alert]) { _, error in
|
||||
if let error = error {
|
||||
Log.error(error)
|
||||
guard let error = error else { return }
|
||||
|
||||
// If the user hasn't enabled notifications for Firezone, we may receive
|
||||
// a notificationsNotAllowed error here. Don't log it.
|
||||
if let unError = error as? UNError,
|
||||
unError.code == .notificationsNotAllowed {
|
||||
return
|
||||
}
|
||||
|
||||
// Log all other errors
|
||||
Log.error(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user