aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-11-10 12:08:35 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-11-10 12:08:35 +0100
commitf5a9aa21e2ab958f60c143668f4836bc47e2b539 (patch)
tree7d7cb70dee56e6ca4a927f7789601cc428381659 /src/stores
parentfeat(Service): Add option to mute service (diff)
downloadferdium-app-f5a9aa21e2ab958f60c143668f4836bc47e2b539.tar.gz
ferdium-app-f5a9aa21e2ab958f60c143668f4836bc47e2b539.tar.zst
ferdium-app-f5a9aa21e2ab958f60c143668f4836bc47e2b539.zip
feat(App): Add option to mute all services in sidebar
Closes #8 #162
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/AppStore.js14
-rw-r--r--src/stores/ServicesStore.js17
2 files changed, 30 insertions, 1 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index ecfd621d3..6580157d4 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -57,6 +57,8 @@ export default class AppStore extends Store {
57 this.actions.app.installUpdate.listen(this._installUpdate.bind(this)); 57 this.actions.app.installUpdate.listen(this._installUpdate.bind(this));
58 this.actions.app.resetUpdateStatus.listen(this._resetUpdateStatus.bind(this)); 58 this.actions.app.resetUpdateStatus.listen(this._resetUpdateStatus.bind(this));
59 this.actions.app.healthCheck.listen(this._healthCheck.bind(this)); 59 this.actions.app.healthCheck.listen(this._healthCheck.bind(this));
60 this.actions.app.muteApp.listen(this._muteApp.bind(this));
61 this.actions.app.toggleMuteApp.listen(this._toggleMuteApp.bind(this));
60 62
61 this.registerReactions([ 63 this.registerReactions([
62 this._offlineCheck.bind(this), 64 this._offlineCheck.bind(this),
@@ -202,6 +204,18 @@ export default class AppStore extends Store {
202 this.healthCheckRequest.execute(); 204 this.healthCheckRequest.execute();
203 } 205 }
204 206
207 @action _muteApp({ isMuted }) {
208 this.actions.settings.update({
209 settings: {
210 isMuted,
211 },
212 });
213 }
214
215 @action _toggleMuteApp() {
216 this._muteApp({ isMuted: !this.stores.settings.all.isMuted });
217 }
218
205 // Reactions 219 // Reactions
206 _offlineCheck() { 220 _offlineCheck() {
207 if (!this.isOnline) { 221 if (!this.isOnline) {
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 96c503510..a20718eca 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -48,6 +48,7 @@ export default class ServicesStore extends Store {
48 this.actions.service.reloadUpdatedServices.listen(this._reloadUpdatedServices.bind(this)); 48 this.actions.service.reloadUpdatedServices.listen(this._reloadUpdatedServices.bind(this));
49 this.actions.service.reorder.listen(this._reorder.bind(this)); 49 this.actions.service.reorder.listen(this._reorder.bind(this));
50 this.actions.service.toggleNotifications.listen(this._toggleNotifications.bind(this)); 50 this.actions.service.toggleNotifications.listen(this._toggleNotifications.bind(this));
51 this.actions.service.toggleAudio.listen(this._toggleAudio.bind(this));
51 this.actions.service.openDevTools.listen(this._openDevTools.bind(this)); 52 this.actions.service.openDevTools.listen(this._openDevTools.bind(this));
52 this.actions.service.openDevToolsForActiveService.listen(this._openDevToolsForActiveService.bind(this)); 53 this.actions.service.openDevToolsForActiveService.listen(this._openDevToolsForActiveService.bind(this));
53 54
@@ -399,11 +400,25 @@ export default class ServicesStore extends Store {
399 @action _toggleNotifications({ serviceId }) { 400 @action _toggleNotifications({ serviceId }) {
400 const service = this.one(serviceId); 401 const service = this.one(serviceId);
401 402
403 this.actions.service.updateService({
404 serviceId,
405 serviceData: {
406 isNotificationEnabled: !service.isNotificationEnabled,
407 },
408 redirect: false,
409 });
410 }
411
412 @action _toggleAudio({ serviceId }) {
413 const service = this.one(serviceId);
414
402 service.isNotificationEnabled = !service.isNotificationEnabled; 415 service.isNotificationEnabled = !service.isNotificationEnabled;
403 416
404 this.actions.service.updateService({ 417 this.actions.service.updateService({
405 serviceId, 418 serviceId,
406 serviceData: service, 419 serviceData: {
420 isMuted: !service.isMuted,
421 },
407 redirect: false, 422 redirect: false,
408 }); 423 });
409 } 424 }