diff options
author | 2022-04-30 21:41:49 -0500 | |
---|---|---|
committer | 2022-04-30 22:09:51 -0500 | |
commit | 3f90f2dd025572b6c06c609f7a800bc0561edd03 (patch) | |
tree | 26758f90ab1342e8a587d49a1d2f8b4c1bca6996 | |
parent | Turn on caching for windows (diff) | |
download | ferdium-app-3f90f2dd025572b6c06c609f7a800bc0561edd03.tar.gz ferdium-app-3f90f2dd025572b6c06c609f7a800bc0561edd03.tar.zst ferdium-app-3f90f2dd025572b6c06c609f7a800bc0561edd03.zip |
Fix issue where 'macos-notification-state' was being loaded in non-macos
-rw-r--r-- | src/electron/ipc-api/dnd.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/electron/ipc-api/dnd.ts b/src/electron/ipc-api/dnd.ts index 6b1777367..9bef0fe3c 100644 --- a/src/electron/ipc-api/dnd.ts +++ b/src/electron/ipc-api/dnd.ts | |||
@@ -1,8 +1,6 @@ | |||
1 | import { ipcMain } from 'electron'; | 1 | import { ipcMain } from 'electron'; |
2 | import { isMac } from '../../environment'; | 2 | import { isMac } from '../../environment'; |
3 | 3 | ||
4 | const { getDoNotDisturb } = require('macos-notification-state'); | ||
5 | |||
6 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:dnd'); | 4 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:dnd'); |
7 | 5 | ||
8 | export default async () => { | 6 | export default async () => { |
@@ -11,6 +9,14 @@ export default async () => { | |||
11 | return false; | 9 | return false; |
12 | } | 10 | } |
13 | 11 | ||
12 | // eslint-disable-next-line global-require | ||
13 | const { getDoNotDisturb } = require('macos-notification-state'); | ||
14 | |||
15 | if (!getDoNotDisturb) { | ||
16 | debug("Could not load 'macos-notification-state' module"); | ||
17 | return false; | ||
18 | } | ||
19 | |||
14 | try { | 20 | try { |
15 | const isDND = getDoNotDisturb(); | 21 | const isDND = getDoNotDisturb(); |
16 | debug('Fetching DND state, set to', isDND); | 22 | debug('Fetching DND state, set to', isDND); |