-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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. |
||
} | ||
|
||
public async displayMention(title: string, body: string, channelId: string, teamId: string, url: string, silent: boolean, webcontents: Electron.WebContents, soundName: string) { | ||
log.debug('displayMention', {title, channelId, teamId, url, silent, soundName}); | ||
|
||
|
@@ -204,7 +209,13 @@ async function getDoNotDisturb() { | |
|
||
// We have to turn this off for dev mode because the Electron binary doesn't have the focus center API entitlement | ||
if (process.platform === 'darwin' && !isDev) { | ||
return getDarwinDoNotDisturb(); | ||
try { | ||
const dnd = await getDarwinDoNotDisturb(); | ||
return dnd; | ||
} catch (e) { | ||
log.warn('macOS DND check threw an error', e); | ||
return false; | ||
} | ||
} | ||
|
||
if (process.platform === 'linux') { | ||
|
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.