diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/electron/ipc-api/cld.ts | 4 | ||||
-rw-r--r-- | src/electron/ipc-api/dnd.ts | 5 | ||||
-rw-r--r-- | src/styles/main.scss | 2 | ||||
-rw-r--r-- | src/webview/recipe.js | 3 |
4 files changed, 10 insertions, 4 deletions
diff --git a/src/electron/ipc-api/cld.ts b/src/electron/ipc-api/cld.ts index 4221f9b22..5e958b102 100644 --- a/src/electron/ipc-api/cld.ts +++ b/src/electron/ipc-api/cld.ts | |||
@@ -5,6 +5,9 @@ const debug = require('debug')('Ferdi:ipcApi:cld'); | |||
5 | 5 | ||
6 | export default async () => { | 6 | export default async () => { |
7 | ipcMain.handle('detect-language', async (_event, { sample }) => { | 7 | ipcMain.handle('detect-language', async (_event, { sample }) => { |
8 | if (!cld) { | ||
9 | return null; | ||
10 | } | ||
8 | try { | 11 | try { |
9 | const result = await cld.detect(sample); | 12 | const result = await cld.detect(sample); |
10 | debug('Checking language', 'probability', result.languages); | 13 | debug('Checking language', 'probability', result.languages); |
@@ -18,6 +21,7 @@ export default async () => { | |||
18 | } | 21 | } |
19 | } catch (error) { | 22 | } catch (error) { |
20 | console.error(error); | 23 | console.error(error); |
24 | return null; | ||
21 | } | 25 | } |
22 | }); | 26 | }); |
23 | }; | 27 | }; |
diff --git a/src/electron/ipc-api/dnd.ts b/src/electron/ipc-api/dnd.ts index afaef9a66..d8958d9b0 100644 --- a/src/electron/ipc-api/dnd.ts +++ b/src/electron/ipc-api/dnd.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { ipcMain } from 'electron'; | 1 | import { ipcMain } from 'electron'; |
2 | import { getDoNotDisturb } from 'macos-notification-state'; | 2 | import doNotDisturb from '@sindresorhus/do-not-disturb'; |
3 | import { isMac } from '../../environment'; | 3 | import { isMac } from '../../environment'; |
4 | 4 | ||
5 | const debug = require('debug')('Ferdi:ipcApi:dnd'); | 5 | const debug = require('debug')('Ferdi:ipcApi:dnd'); |
@@ -7,12 +7,11 @@ const debug = require('debug')('Ferdi:ipcApi:dnd'); | |||
7 | export default async () => { | 7 | export default async () => { |
8 | ipcMain.handle('get-dnd', async () => { | 8 | ipcMain.handle('get-dnd', async () => { |
9 | if (!isMac) { | 9 | if (!isMac) { |
10 | debug('Not on macOS, returning', false); | ||
11 | return false; | 10 | return false; |
12 | } | 11 | } |
13 | 12 | ||
14 | try { | 13 | try { |
15 | const isDND = getDoNotDisturb(); | 14 | const isDND = await doNotDisturb.isEnabled(); |
16 | debug('Fetching DND state, set to', isDND); | 15 | debug('Fetching DND state, set to', isDND); |
17 | return isDND; | 16 | return isDND; |
18 | } catch (error) { | 17 | } catch (error) { |
diff --git a/src/styles/main.scss b/src/styles/main.scss index bd1226b31..e6278efd0 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss | |||
@@ -1,4 +1,4 @@ | |||
1 | @import '~electron-react-titlebar/assets/style.css'; | 1 | @import './node_modules/electron-react-titlebar/assets/style'; |
2 | 2 | ||
3 | // modules | 3 | // modules |
4 | @import './reset.scss'; | 4 | @import './reset.scss'; |
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 92c1ee2f0..70241419a 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -436,6 +436,9 @@ class RecipeController { | |||
436 | const locale = await ipcRenderer.invoke('detect-language', { | 436 | const locale = await ipcRenderer.invoke('detect-language', { |
437 | sample: value, | 437 | sample: value, |
438 | }); | 438 | }); |
439 | if (!locale) { | ||
440 | return; | ||
441 | } | ||
439 | 442 | ||
440 | const spellcheckerLocale = | 443 | const spellcheckerLocale = |
441 | getSpellcheckerLocaleByFuzzyIdentifier(locale); | 444 | getSpellcheckerLocaleByFuzzyIdentifier(locale); |