diff options
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/AppStore.js | 4 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 3eb2c38d2..0b7c60bce 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -220,13 +220,13 @@ export default class AppStore extends Store { | |||
220 | @action _muteApp({ isMuted }) { | 220 | @action _muteApp({ isMuted }) { |
221 | this.actions.settings.update({ | 221 | this.actions.settings.update({ |
222 | settings: { | 222 | settings: { |
223 | isMuted, | 223 | isAppMuted: isMuted, |
224 | }, | 224 | }, |
225 | }); | 225 | }); |
226 | } | 226 | } |
227 | 227 | ||
228 | @action _toggleMuteApp() { | 228 | @action _toggleMuteApp() { |
229 | this._muteApp({ isMuted: !this.stores.settings.all.isMuted }); | 229 | this._muteApp({ isMuted: !this.stores.settings.all.isAppMuted }); |
230 | } | 230 | } |
231 | 231 | ||
232 | // Reactions | 232 | // Reactions |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index ad3c53ccf..30058f41d 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,11 +1,10 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable, extendObservable } from 'mobx'; |
3 | 3 | ||
4 | import Store from './lib/Store'; | 4 | import Store from './lib/Store'; |
5 | import Request from './lib/Request'; | 5 | import Request from './lib/Request'; |
6 | import CachedRequest from './lib/CachedRequest'; | 6 | import CachedRequest from './lib/CachedRequest'; |
7 | import { gaEvent } from '../lib/analytics'; | 7 | import { gaEvent } from '../lib/analytics'; |
8 | import { DEFAULT_APP_SETTINGS } from '../config'; | ||
9 | 8 | ||
10 | export default class SettingsStore extends Store { | 9 | export default class SettingsStore extends Store { |
11 | @observable allSettingsRequest = new CachedRequest(this.api.local, 'getSettings'); | 10 | @observable allSettingsRequest = new CachedRequest(this.api.local, 'getSettings'); |
@@ -18,10 +17,6 @@ export default class SettingsStore extends Store { | |||
18 | // Register action handlers | 17 | // Register action handlers |
19 | this.actions.settings.update.listen(this._update.bind(this)); | 18 | this.actions.settings.update.listen(this._update.bind(this)); |
20 | this.actions.settings.remove.listen(this._remove.bind(this)); | 19 | this.actions.settings.remove.listen(this._remove.bind(this)); |
21 | |||
22 | // this.registerReactions([ | ||
23 | // this._shareSettingsWithMainProcess.bind(this), | ||
24 | // ]); | ||
25 | } | 20 | } |
26 | 21 | ||
27 | setup() { | 22 | setup() { |
@@ -30,14 +25,14 @@ export default class SettingsStore extends Store { | |||
30 | } | 25 | } |
31 | 26 | ||
32 | @computed get all() { | 27 | @computed get all() { |
33 | return observable(Object.assign(DEFAULT_APP_SETTINGS, this.allSettingsRequest.result)); | 28 | return this.allSettingsRequest.result || {}; |
34 | } | 29 | } |
35 | 30 | ||
36 | @action async _update({ settings }) { | 31 | @action async _update({ settings }) { |
37 | await this.updateSettingsRequest.execute(settings)._promise; | 32 | await this.updateSettingsRequest.execute(settings)._promise; |
38 | this.allSettingsRequest.patch((result) => { | 33 | await this.allSettingsRequest.patch((result) => { |
39 | if (!result) return; | 34 | if (!result) return; |
40 | Object.assign(result, settings); | 35 | extendObservable(result, settings); |
41 | }); | 36 | }); |
42 | 37 | ||
43 | // We need a little hack to wait until everything is patched | 38 | // We need a little hack to wait until everything is patched |