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:
Jamil
2025-01-15 08:34:55 -08:00
committed by GitHub
parent 01c1e629d2
commit 55485c71e6

View File

@@ -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)
}
}