diff options
author | 2018-11-16 20:47:22 +0100 | |
---|---|---|
committer | 2018-11-16 20:47:22 +0100 | |
commit | 5c1aeaca015088272afa12ca76ebbdd78832ea60 (patch) | |
tree | eceec82c776e625e70cfa0fc025ae592450a4f71 | |
parent | Polishing & increasing contrast (diff) | |
download | ferdium-app-5c1aeaca015088272afa12ca76ebbdd78832ea60.tar.gz ferdium-app-5c1aeaca015088272afa12ca76ebbdd78832ea60.tar.zst ferdium-app-5c1aeaca015088272afa12ca76ebbdd78832ea60.zip |
use native electron.systemPreferences.isDarkMode()
-rw-r--r-- | package-lock.json | 23 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/stores/AppStore.js | 7 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 4 |
4 files changed, 5 insertions, 30 deletions
diff --git a/package-lock.json b/package-lock.json index d75356409..1311b2369 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -82,29 +82,6 @@ | |||
82 | } | 82 | } |
83 | } | 83 | } |
84 | }, | 84 | }, |
85 | "@adlk/mojave-isdarkmode": { | ||
86 | "version": "1.0.1", | ||
87 | "resolved": "https://registry.npmjs.org/@adlk/mojave-isdarkmode/-/mojave-isdarkmode-1.0.1.tgz", | ||
88 | "integrity": "sha512-vNecc2GQfSYZ5znFBbgDTc/VJezg6Rpe/jesTtcBv2ojgAppg9HllxWSrnriWFuSlYmsNI3/WKfvD0ag2768vw==", | ||
89 | "requires": { | ||
90 | "debug": "^4.1.0" | ||
91 | }, | ||
92 | "dependencies": { | ||
93 | "debug": { | ||
94 | "version": "4.1.0", | ||
95 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", | ||
96 | "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", | ||
97 | "requires": { | ||
98 | "ms": "^2.1.1" | ||
99 | } | ||
100 | }, | ||
101 | "ms": { | ||
102 | "version": "2.1.1", | ||
103 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", | ||
104 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" | ||
105 | } | ||
106 | } | ||
107 | }, | ||
108 | "@babel/code-frame": { | 85 | "@babel/code-frame": { |
109 | "version": "7.0.0", | 86 | "version": "7.0.0", |
110 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", | 87 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", |
diff --git a/package.json b/package.json index f12cb6001..259e42bda 100644 --- a/package.json +++ b/package.json | |||
@@ -27,7 +27,6 @@ | |||
27 | "author": "Stefan Malzner <stefan@adlk.io>", | 27 | "author": "Stefan Malzner <stefan@adlk.io>", |
28 | "license": "Apache-2.0", | 28 | "license": "Apache-2.0", |
29 | "dependencies": { | 29 | "dependencies": { |
30 | "@adlk/mojave-isdarkmode": "^1.0.1", | ||
31 | "@babel/polyfill": "^7.0.0", | 30 | "@babel/polyfill": "^7.0.0", |
32 | "@babel/runtime": "^7.0.0", | 31 | "@babel/runtime": "^7.0.0", |
33 | "@meetfranz/electron-notification-state": "^1.0.0", | 32 | "@meetfranz/electron-notification-state": "^1.0.0", |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index e24160b4c..d1ed2596b 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -1,11 +1,10 @@ | |||
1 | import { remote, ipcRenderer, shell } from 'electron'; | 1 | import { remote, ipcRenderer, shell, systemPreferences } from 'electron'; |
2 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable } from 'mobx'; |
3 | import moment from 'moment'; | 3 | import moment from 'moment'; |
4 | import key from 'keymaster'; | 4 | import key from 'keymaster'; |
5 | import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; | 5 | import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; |
6 | import AutoLaunch from 'auto-launch'; | 6 | import AutoLaunch from 'auto-launch'; |
7 | import prettyBytes from 'pretty-bytes'; | 7 | import prettyBytes from 'pretty-bytes'; |
8 | import isDarkMode from '@adlk/mojave-isdarkmode'; | ||
9 | 8 | ||
10 | import Store from './lib/Store'; | 9 | import Store from './lib/Store'; |
11 | import Request from './lib/Request'; | 10 | import Request from './lib/Request'; |
@@ -80,7 +79,7 @@ export default class AppStore extends Store { | |||
80 | ]); | 79 | ]); |
81 | } | 80 | } |
82 | 81 | ||
83 | async setup() { | 82 | setup() { |
84 | this._appStartsCounter(); | 83 | this._appStartsCounter(); |
85 | // Focus the active service | 84 | // Focus the active service |
86 | window.addEventListener('focus', this.actions.service.focusActiveService); | 85 | window.addEventListener('focus', this.actions.service.focusActiveService); |
@@ -163,7 +162,7 @@ export default class AppStore extends Store { | |||
163 | 162 | ||
164 | this._healthCheck(); | 163 | this._healthCheck(); |
165 | 164 | ||
166 | this.isSystemDarkModeEnabled = await isDarkMode(); | 165 | this.isSystemDarkModeEnabled = systemPreferences.isDarkMode(); |
167 | } | 166 | } |
168 | 167 | ||
169 | @computed get cacheSize() { | 168 | @computed get cacheSize() { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 019ec12bb..31165053d 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,6 +1,6 @@ | |||
1 | import { systemPreferences } from 'electron'; | ||
1 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable } from 'mobx'; |
2 | import localStorage from 'mobx-localstorage'; | 3 | import localStorage from 'mobx-localstorage'; |
3 | import isDarkMode from '@adlk/mojave-isdarkmode'; | ||
4 | 4 | ||
5 | import Store from './lib/Store'; | 5 | import Store from './lib/Store'; |
6 | import SettingsModel from '../models/Settings'; | 6 | import SettingsModel from '../models/Settings'; |
@@ -111,7 +111,7 @@ export default class SettingsStore extends Store { | |||
111 | this.actions.settings.update({ | 111 | this.actions.settings.update({ |
112 | type: 'app', | 112 | type: 'app', |
113 | data: { | 113 | data: { |
114 | darkMode: await isDarkMode(), | 114 | darkMode: systemPreferences.isDarkMode(), |
115 | }, | 115 | }, |
116 | }); | 116 | }); |
117 | 117 | ||