-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MM-58455] Add error handling when FocusStatus is not authorized on macOS #3053
Conversation
@amyblais I'm looking to do a dot release for this one if possible. |
Ok 👍 |
src/main/notifications/index.ts
Outdated
@@ -27,6 +27,11 @@ class NotificationManager { | |||
private upgradeNotification?: NewVersionNotification; | |||
private restartToUpgradeNotification?: UpgradeNotification; | |||
|
|||
constructor() { | |||
// Run this very early to perform an early permission check | |||
getDoNotDisturb(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this trigger a permission modal before getting a notification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it shows the macOS one that people were missing.
src/main/notifications/index.ts
Outdated
@@ -27,6 +27,11 @@ class NotificationManager { | |||
private upgradeNotification?: NewVersionNotification; | |||
private restartToUpgradeNotification?: UpgradeNotification; | |||
|
|||
constructor() { | |||
// Run this very early to perform an early permission check | |||
getDoNotDisturb(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this happen as an explicit call from somewhere in the initialization code? It feels a bit weird to have this be a side effect of importing this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess that would be better, I wanted to keep everything centralized but the import case does make that a bit awkward.
Cherry pick is scheduled. |
…acOS (#3053) (#3054) * [MM-58455] Add error handling when FocusStatus is not authorized on macOS * Do the permission check very early so that it's less likely for users to miss it * Move permissions check to initialize (cherry picked from commit d11752e) Co-authored-by: Devin Binnie <[email protected]>
Summary
A recent change that allowed the macOS app to correctly use the
FocusStatus
to prevent notifications under DND was completely stopping notifications if permission wasn't given. This was caused by the app not performing any error handling from the DND check, which would throw an error if the app wasn't authorized to check the status.This PR adds that error handling, and logs a warning in the logs to denote that the check failed.
Ticket Link
Closes #3052
https://mattermost.atlassian.net/browse/MM-58455