From 95df3522a15631abc51a4295cae0ea401a8d4e1e Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 14 Sep 2021 19:58:52 +0200 Subject: feat: add eslint-plugin-unicorn (#1936) --- src/stores/SettingsStore.js | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'src/stores/SettingsStore.js') diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 9aade974c..690a18374 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js @@ -1,11 +1,11 @@ import { ipcRenderer } from 'electron'; import { getCurrentWindow } from '@electron/remote'; -import { - action, computed, observable, reaction, -} from 'mobx'; +import { action, computed, observable, reaction } from 'mobx'; import localStorage from 'mobx-localstorage'; import { - FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER, SEARCH_ENGINE_DDG, + FILE_SYSTEM_SETTINGS_TYPES, + LOCAL_SERVER, + SEARCH_ENGINE_DDG, } from '../config'; import { API, DEFAULT_APP_SETTINGS } from '../environment'; import { getLocale } from '../helpers/i18n-helpers'; @@ -17,7 +17,10 @@ import Store from './lib/Store'; const debug = require('debug')('Ferdi:SettingsStore'); export default class SettingsStore extends Store { - @observable updateAppSettingsRequest = new Request(this.api.local, 'updateAppSettings'); + @observable updateAppSettingsRequest = new Request( + this.api.local, + 'updateAppSettings', + ); startup = true; @@ -40,9 +43,7 @@ export default class SettingsStore extends Store { await this._migrate(); reaction( - () => ( - this.all.app.autohideMenuBar - ), + () => this.all.app.autohideMenuBar, () => { const currentWindow = getCurrentWindow(); currentWindow.setMenuBarVisibility(!this.all.app.autohideMenuBar); @@ -51,10 +52,8 @@ export default class SettingsStore extends Store { ); reaction( - () => ( - this.all.app.server - ), - (server) => { + () => this.all.app.server, + server => { if (server === LOCAL_SERVER) { ipcRenderer.send('startLocalServer'); } @@ -65,7 +64,10 @@ export default class SettingsStore extends Store { // Inactivity lock timer let inactivityTimer; getCurrentWindow().on('blur', () => { - if (this.all.app.lockingFeatureEnabled && this.all.app.inactivityLock !== 0) { + if ( + this.all.app.lockingFeatureEnabled && + this.all.app.inactivityLock !== 0 + ) { inactivityTimer = setTimeout(() => { this.actions.settings.update({ type: 'app', @@ -84,7 +86,11 @@ export default class SettingsStore extends Store { ipcRenderer.on('appSettings', (event, resp) => { // Lock on startup if enabled in settings - if (this.startup && resp.type === 'app' && resp.data.lockingFeatureEnabled) { + if ( + this.startup && + resp.type === 'app' && + resp.data.lockingFeatureEnabled + ) { this.startup = false; process.nextTick(() => { if (!this.all.app.locked) { @@ -97,9 +103,9 @@ export default class SettingsStore extends Store { ipcRenderer.send('initialAppSettings', resp); }); - this.fileSystemSettingsTypes.forEach((type) => { + for (const type of this.fileSystemSettingsTypes) { ipcRenderer.send('getAppSettings', type); - }); + } } @computed get app() { @@ -111,15 +117,19 @@ export default class SettingsStore extends Store { } @computed get service() { - return localStorage.getItem('service') || { - activeService: '', - }; + return ( + localStorage.getItem('service') || { + activeService: '', + } + ); } @computed get stats() { - return localStorage.getItem('stats') || { - activeService: '', - }; + return ( + localStorage.getItem('stats') || { + activeService: '', + } + ); } @computed get migration() { @@ -230,9 +240,7 @@ export default class SettingsStore extends Store { }); this._ensureMigrationAndMarkDone('5.4.4-beta.2-settings', () => { - const { - showServiceNavigationBar, - } = this.all.app; + const { showServiceNavigationBar } = this.all.app; this.actions.settings.update({ type: 'app', @@ -248,7 +256,7 @@ export default class SettingsStore extends Store { data: { todoServer: 'isUsingCustomTodoService', customTodoServer: legacySettings.todoServer, - automaticUpdates: !(legacySettings.noUpdates), + automaticUpdates: !legacySettings.noUpdates, }, }); -- cgit v1.2.3-54-g00ecf