diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-13 14:01:33 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-13 14:01:33 +0100 |
commit | b5937bd427e02d64b675c9c4719ec8148c68c224 (patch) | |
tree | 3e67ca01935eb36ab6d40a1e197d7c2c0f38b587 /src/stores/SettingsStore.js | |
parent | Update CHANGELOG.md (diff) | |
parent | Ignore clicks on premium elements (diff) | |
download | ferdium-app-b5937bd427e02d64b675c9c4719ec8148c68c224.tar.gz ferdium-app-b5937bd427e02d64b675c9c4719ec8148c68c224.tar.zst ferdium-app-b5937bd427e02d64b675c9c4719ec8148c68c224.zip |
Merge branch 'develop'v5.0.0-beta.21
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r-- | src/stores/SettingsStore.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 4c01e9910..a456195bf 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,5 +1,7 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { action, computed, observable } from 'mobx'; | 2 | import { |
3 | action, computed, observable, set, | ||
4 | } from 'mobx'; | ||
3 | import localStorage from 'mobx-localstorage'; | 5 | import localStorage from 'mobx-localstorage'; |
4 | 6 | ||
5 | import Store from './lib/Store'; | 7 | import Store from './lib/Store'; |
@@ -14,11 +16,13 @@ const debug = require('debug')('Franz:SettingsStore'); | |||
14 | 16 | ||
15 | export default class SettingsStore extends Store { | 17 | export default class SettingsStore extends Store { |
16 | @observable appSettingsRequest = new CachedRequest(this.api.local, 'getAppSettings'); | 18 | @observable appSettingsRequest = new CachedRequest(this.api.local, 'getAppSettings'); |
19 | |||
17 | @observable updateAppSettingsRequest = new Request(this.api.local, 'updateAppSettings'); | 20 | @observable updateAppSettingsRequest = new Request(this.api.local, 'updateAppSettings'); |
18 | 21 | ||
19 | @observable fileSystemSettingsRequests = []; | 22 | fileSystemSettingsRequests = []; |
20 | 23 | ||
21 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; | 24 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; |
25 | |||
22 | @observable _fileSystemSettingsCache = { | 26 | @observable _fileSystemSettingsCache = { |
23 | app: DEFAULT_APP_SETTINGS, | 27 | app: DEFAULT_APP_SETTINGS, |
24 | proxy: {}, | 28 | proxy: {}, |
@@ -57,6 +61,21 @@ export default class SettingsStore extends Store { | |||
57 | } | 61 | } |
58 | 62 | ||
59 | @computed get proxy() { | 63 | @computed get proxy() { |
64 | // // We need to provide the final data structure as mobx autoruns won't work | ||
65 | // const proxySettings = observable({}); | ||
66 | // this.stores.services.all.forEach((service) => { | ||
67 | // proxySettings[service.id] = { | ||
68 | // isEnabled: false, | ||
69 | // host: null, | ||
70 | // user: null, | ||
71 | // password: null, | ||
72 | // }; | ||
73 | // }); | ||
74 | |||
75 | // debug('this._fileSystemSettingsCache.proxy', this._fileSystemSettingsCache.proxy, proxySettings); | ||
76 | |||
77 | // return Object.assign(proxySettings, this._fileSystemSettingsCache.proxy); | ||
78 | |||
60 | return this._fileSystemSettingsCache.proxy || {}; | 79 | return this._fileSystemSettingsCache.proxy || {}; |
61 | } | 80 | } |
62 | 81 | ||
@@ -98,7 +117,7 @@ export default class SettingsStore extends Store { | |||
98 | data, | 117 | data, |
99 | }); | 118 | }); |
100 | 119 | ||
101 | Object.assign(this._fileSystemSettingsCache[type], data); | 120 | set(this._fileSystemSettingsCache[type], data); |
102 | } | 121 | } |
103 | } | 122 | } |
104 | 123 | ||