diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-02 21:20:15 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-02 21:20:15 +0100 |
commit | 4a0e7e95f247d66f4861751c1ad2a292129e69f9 (patch) | |
tree | c0de5fef5ca8852be9d9cecbaf6cedb3e3f3d616 /src | |
parent | Update changelog (diff) | |
parent | Make settings debug logs less confusing (diff) | |
download | ferdium-app-4a0e7e95f247d66f4861751c1ad2a292129e69f9.tar.gz ferdium-app-4a0e7e95f247d66f4861751c1ad2a292129e69f9.tar.zst ferdium-app-4a0e7e95f247d66f4861751c1ad2a292129e69f9.zip |
Merge branch 'develop'v5.0.0-beta.19
Diffstat (limited to 'src')
-rw-r--r-- | src/config.js | 3 | ||||
-rw-r--r-- | src/electron/Settings.js | 4 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 7 |
3 files changed, 6 insertions, 8 deletions
diff --git a/src/config.js b/src/config.js index 08dbb85f3..c612d1e2b 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -2,6 +2,7 @@ import electron from 'electron'; | |||
2 | import path from 'path'; | 2 | import path from 'path'; |
3 | 3 | ||
4 | const app = process.type === 'renderer' ? electron.remote.app : electron.app; | 4 | const app = process.type === 'renderer' ? electron.remote.app : electron.app; |
5 | const systemPreferences = process.type === 'renderer' ? electron.remote.systemPreferences : electron.systemPreferences; | ||
5 | 6 | ||
6 | export const CHECK_INTERVAL = 1000 * 3600; // How often should we perform checks | 7 | export const CHECK_INTERVAL = 1000 * 3600; // How often should we perform checks |
7 | export const LOCAL_API = 'http://localhost:3000'; | 8 | export const LOCAL_API = 'http://localhost:3000'; |
@@ -18,7 +19,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
18 | showMessageBadgeWhenMuted: true, | 19 | showMessageBadgeWhenMuted: true, |
19 | enableSpellchecking: true, | 20 | enableSpellchecking: true, |
20 | spellcheckerLanguage: 'en-us', | 21 | spellcheckerLanguage: 'en-us', |
21 | darkMode: false, | 22 | darkMode: process.platform === 'darwin' ? systemPreferences.isDarkMode() : false, // We can't use refs from `./environment` at this time |
22 | locale: '', | 23 | locale: '', |
23 | fallbackLocale: 'en-US', | 24 | fallbackLocale: 'en-US', |
24 | beta: false, | 25 | beta: false, |
diff --git a/src/electron/Settings.js b/src/electron/Settings.js index 6ac3b9177..ed9733bfe 100644 --- a/src/electron/Settings.js +++ b/src/electron/Settings.js | |||
@@ -42,12 +42,12 @@ export default class Settings { | |||
42 | 42 | ||
43 | _hydrate() { | 43 | _hydrate() { |
44 | this.store = this._merge(readJsonSync(this.settingsFile)); | 44 | this.store = this._merge(readJsonSync(this.settingsFile)); |
45 | debug('Hydrate store', toJS(this.store)); | 45 | debug('Hydrate store', this.type, toJS(this.store)); |
46 | } | 46 | } |
47 | 47 | ||
48 | _writeFile() { | 48 | _writeFile() { |
49 | outputJsonSync(this.settingsFile, this.store); | 49 | outputJsonSync(this.settingsFile, this.store); |
50 | debug('Write settings file', toJS(this.store)); | 50 | debug('Write settings file', this.type, toJS(this.store)); |
51 | } | 51 | } |
52 | 52 | ||
53 | get settingsFile() { | 53 | get settingsFile() { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 9ea14a911..4c01e9910 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,4 +1,4 @@ | |||
1 | import { remote, ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable } from 'mobx'; |
3 | import localStorage from 'mobx-localstorage'; | 3 | import localStorage from 'mobx-localstorage'; |
4 | 4 | ||
@@ -10,7 +10,6 @@ import { getLocale } from '../helpers/i18n-helpers'; | |||
10 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config'; | 10 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config'; |
11 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 11 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
12 | 12 | ||
13 | const { systemPreferences } = remote; | ||
14 | const debug = require('debug')('Franz:SettingsStore'); | 13 | const debug = require('debug')('Franz:SettingsStore'); |
15 | 14 | ||
16 | export default class SettingsStore extends Store { | 15 | export default class SettingsStore extends Store { |
@@ -37,7 +36,7 @@ export default class SettingsStore extends Store { | |||
37 | }); | 36 | }); |
38 | 37 | ||
39 | ipcRenderer.on('appSettings', (event, resp) => { | 38 | ipcRenderer.on('appSettings', (event, resp) => { |
40 | debug('Get appSettings resolves', resp, resp.type, resp.data); | 39 | debug('Get appSettings resolves', resp.type, resp.data); |
41 | 40 | ||
42 | this._fileSystemSettingsCache[resp.type] = resp.data; | 41 | this._fileSystemSettingsCache[resp.type] = resp.data; |
43 | }); | 42 | }); |
@@ -156,7 +155,6 @@ export default class SettingsStore extends Store { | |||
156 | debug('Migrated settings to split stores'); | 155 | debug('Migrated settings to split stores'); |
157 | } | 156 | } |
158 | 157 | ||
159 | // Enable dark mode once | ||
160 | if (!this.all.migration['5.0.0-beta.19-settings']) { | 158 | if (!this.all.migration['5.0.0-beta.19-settings']) { |
161 | const spellcheckerLanguage = getLocale({ | 159 | const spellcheckerLanguage = getLocale({ |
162 | locale: this.stores.settings.app.locale, | 160 | locale: this.stores.settings.app.locale, |
@@ -168,7 +166,6 @@ export default class SettingsStore extends Store { | |||
168 | this.actions.settings.update({ | 166 | this.actions.settings.update({ |
169 | type: 'app', | 167 | type: 'app', |
170 | data: { | 168 | data: { |
171 | darkMode: systemPreferences.isDarkMode(), | ||
172 | spellcheckerLanguage, | 169 | spellcheckerLanguage, |
173 | }, | 170 | }, |
174 | }); | 171 | }); |