diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 20799de5..ce641b9a 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -8,6 +8,7 @@ const win = global.process.platform === 'win32' const electron = require('electron') const { ipcRenderer } = electron const consts = require('browser/lib/consts') +const electronConfig = new (require('electron-config'))() let isInitialized = false @@ -26,6 +27,7 @@ export const DEFAULT_CONFIG = { sortTagsBy: 'ALPHABETICAL', // 'ALPHABETICAL', 'COUNTER' listStyle: 'DEFAULT', // 'DEFAULT', 'SMALL' amaEnabled: true, + autoUpdateEnabled: true, hotkey: { toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E', toggleMode: OSX ? 'Command + Alt + M' : 'Ctrl + M', @@ -141,6 +143,8 @@ function get () { _save(config) } + config.autoUpdateEnabled = electronConfig.get('autoUpdateEnabled', config.autoUpdateEnabled) + if (!isInitialized) { isInitialized = true let editorTheme = document.getElementById('editorTheme') @@ -205,6 +209,8 @@ function set (updates) { editorTheme.setAttribute('href', newTheme.path) } + electronConfig.set('autoUpdateEnabled', newConfig.autoUpdateEnabled) + ipcRenderer.send('config-renew', { config: get() }) diff --git a/browser/main/modals/PreferencesModal/InfoTab.js b/browser/main/modals/PreferencesModal/InfoTab.js index 71e99da9..66250412 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.js +++ b/browser/main/modals/PreferencesModal/InfoTab.js @@ -61,6 +61,15 @@ class InfoTab extends React.Component { }) } + toggleAutoUpdate () { + const newConfig = { + autoUpdateEnabled: !this.state.config.autoUpdateEnabled + } + + this.setState({ config: newConfig }) + ConfigManager.set(newConfig) + } + infoMessage () { const { amaMessage } = this.state return amaMessage ?
{amaMessage}
: null @@ -140,6 +149,8 @@ class InfoTab extends React.Component { + +