diff options
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r-- | src/stores/SettingsStore.js | 82 |
1 files changed, 3 insertions, 79 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 690a18374..4b203101a 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -2,15 +2,9 @@ import { ipcRenderer } from 'electron'; | |||
2 | import { getCurrentWindow } from '@electron/remote'; | 2 | import { getCurrentWindow } from '@electron/remote'; |
3 | import { action, computed, observable, reaction } from 'mobx'; | 3 | import { action, computed, observable, reaction } from 'mobx'; |
4 | import localStorage from 'mobx-localstorage'; | 4 | import localStorage from 'mobx-localstorage'; |
5 | import { | 5 | import { FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; |
6 | FILE_SYSTEM_SETTINGS_TYPES, | 6 | import { DEFAULT_APP_SETTINGS } from '../environment'; |
7 | LOCAL_SERVER, | ||
8 | SEARCH_ENGINE_DDG, | ||
9 | } from '../config'; | ||
10 | import { API, DEFAULT_APP_SETTINGS } from '../environment'; | ||
11 | import { getLocale } from '../helpers/i18n-helpers'; | ||
12 | import { hash } from '../helpers/password-helpers'; | 7 | import { hash } from '../helpers/password-helpers'; |
13 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | ||
14 | import Request from './lib/Request'; | 8 | import Request from './lib/Request'; |
15 | import Store from './lib/Store'; | 9 | import Store from './lib/Store'; |
16 | 10 | ||
@@ -193,76 +187,6 @@ export default class SettingsStore extends Store { | |||
193 | async _migrate() { | 187 | async _migrate() { |
194 | const legacySettings = localStorage.getItem('app') || {}; | 188 | const legacySettings = localStorage.getItem('app') || {}; |
195 | 189 | ||
196 | this._ensureMigrationAndMarkDone('5.0.0-beta.17-settings', () => { | ||
197 | this.actions.settings.update({ | ||
198 | type: 'app', | ||
199 | data: { | ||
200 | autoLaunchInBackground: legacySettings.autoLaunchInBackground, | ||
201 | runInBackground: legacySettings.runInBackground, | ||
202 | enableSystemTray: legacySettings.enableSystemTray, | ||
203 | minimizeToSystemTray: legacySettings.minimizeToSystemTray, | ||
204 | closeToSystemTray: legacySettings.closeToSystemTray, | ||
205 | server: API, | ||
206 | isAppMuted: legacySettings.isAppMuted, | ||
207 | enableGPUAcceleration: legacySettings.enableGPUAcceleration, | ||
208 | showMessageBadgeWhenMuted: legacySettings.showMessageBadgeWhenMuted, | ||
209 | showDisabledServices: legacySettings.showDisabledServices, | ||
210 | enableSpellchecking: legacySettings.enableSpellchecking, | ||
211 | }, | ||
212 | }); | ||
213 | |||
214 | this.actions.settings.update({ | ||
215 | type: 'service', | ||
216 | data: { | ||
217 | activeService: legacySettings.activeService, | ||
218 | }, | ||
219 | }); | ||
220 | |||
221 | localStorage.removeItem('app'); | ||
222 | |||
223 | debug('Migrated settings to split stores'); | ||
224 | }); | ||
225 | |||
226 | this._ensureMigrationAndMarkDone('5.0.0-beta.19-settings', () => { | ||
227 | const spellcheckerLanguage = getLocale({ | ||
228 | locale: this.stores.settings.app.locale, | ||
229 | locales: SPELLCHECKER_LOCALES, | ||
230 | defaultLocale: DEFAULT_APP_SETTINGS.spellcheckerLanguage, | ||
231 | fallbackLocale: DEFAULT_APP_SETTINGS.spellcheckerLanguage, | ||
232 | }); | ||
233 | |||
234 | this.actions.settings.update({ | ||
235 | type: 'app', | ||
236 | data: { | ||
237 | spellcheckerLanguage, | ||
238 | }, | ||
239 | }); | ||
240 | }); | ||
241 | |||
242 | this._ensureMigrationAndMarkDone('5.4.4-beta.2-settings', () => { | ||
243 | const { showServiceNavigationBar } = this.all.app; | ||
244 | |||
245 | this.actions.settings.update({ | ||
246 | type: 'app', | ||
247 | data: { | ||
248 | navigationBarBehaviour: showServiceNavigationBar ? 'custom' : 'never', | ||
249 | }, | ||
250 | }); | ||
251 | }); | ||
252 | |||
253 | this._ensureMigrationAndMarkDone('5.4.4-beta.4-settings', () => { | ||
254 | this.actions.settings.update({ | ||
255 | type: 'app', | ||
256 | data: { | ||
257 | todoServer: 'isUsingCustomTodoService', | ||
258 | customTodoServer: legacySettings.todoServer, | ||
259 | automaticUpdates: !legacySettings.noUpdates, | ||
260 | }, | ||
261 | }); | ||
262 | |||
263 | debug('Migrated old todo setting to new custom todo setting'); | ||
264 | }); | ||
265 | |||
266 | this._ensureMigrationAndMarkDone('password-hashing', () => { | 190 | this._ensureMigrationAndMarkDone('password-hashing', () => { |
267 | if (this.stores.settings.app.lockedPassword !== '') { | 191 | if (this.stores.settings.app.lockedPassword !== '') { |
268 | this.actions.settings.update({ | 192 | this.actions.settings.update({ |
@@ -280,7 +204,7 @@ export default class SettingsStore extends Store { | |||
280 | this.actions.settings.update({ | 204 | this.actions.settings.update({ |
281 | type: 'app', | 205 | type: 'app', |
282 | data: { | 206 | data: { |
283 | searchEngine: SEARCH_ENGINE_DDG, | 207 | searchEngine: DEFAULT_APP_SETTINGS.searchEngine, |
284 | }, | 208 | }, |
285 | }); | 209 | }); |
286 | }); | 210 | }); |