Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Dec 2, 2018
2 parents 8ee6fdc + b089a6d commit 4a0e7e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import electron from 'electron';
import path from 'path';

const app = process.type === 'renderer' ? electron.remote.app : electron.app;
const systemPreferences = process.type === 'renderer' ? electron.remote.systemPreferences : electron.systemPreferences;

export const CHECK_INTERVAL = 1000 * 3600; // How often should we perform checks
export const LOCAL_API = 'http://localhost:3000';
Expand All @@ -18,7 +19,7 @@ export const DEFAULT_APP_SETTINGS = {
showMessageBadgeWhenMuted: true,
enableSpellchecking: true,
spellcheckerLanguage: 'en-us',
darkMode: false,
darkMode: process.platform === 'darwin' ? systemPreferences.isDarkMode() : false, // We can't use refs from `./environment` at this time
locale: '',
fallbackLocale: 'en-US',
beta: false,
Expand Down
4 changes: 2 additions & 2 deletions src/electron/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export default class Settings {

_hydrate() {
this.store = this._merge(readJsonSync(this.settingsFile));
debug('Hydrate store', toJS(this.store));
debug('Hydrate store', this.type, toJS(this.store));
}

_writeFile() {
outputJsonSync(this.settingsFile, this.store);
debug('Write settings file', toJS(this.store));
debug('Write settings file', this.type, toJS(this.store));
}

get settingsFile() {
Expand Down
7 changes: 2 additions & 5 deletions src/stores/SettingsStore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { remote, ipcRenderer } from 'electron';
import { ipcRenderer } from 'electron';
import { action, computed, observable } from 'mobx';
import localStorage from 'mobx-localstorage';

Expand All @@ -10,7 +10,6 @@ import { getLocale } from '../helpers/i18n-helpers';
import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config';
import { SPELLCHECKER_LOCALES } from '../i18n/languages';

const { systemPreferences } = remote;
const debug = require('debug')('Franz:SettingsStore');

export default class SettingsStore extends Store {
Expand All @@ -37,7 +36,7 @@ export default class SettingsStore extends Store {
});

ipcRenderer.on('appSettings', (event, resp) => {
debug('Get appSettings resolves', resp, resp.type, resp.data);
debug('Get appSettings resolves', resp.type, resp.data);

this._fileSystemSettingsCache[resp.type] = resp.data;
});
Expand Down Expand Up @@ -156,7 +155,6 @@ export default class SettingsStore extends Store {
debug('Migrated settings to split stores');
}

// Enable dark mode once
if (!this.all.migration['5.0.0-beta.19-settings']) {
const spellcheckerLanguage = getLocale({
locale: this.stores.settings.app.locale,
Expand All @@ -168,7 +166,6 @@ export default class SettingsStore extends Store {
this.actions.settings.update({
type: 'app',
data: {
darkMode: systemPreferences.isDarkMode(),
spellcheckerLanguage,
},
});
Expand Down

0 comments on commit 4a0e7e9

Please sign in to comment.