aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/ServicesStore.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-03-27 21:25:56 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-03-27 21:25:56 +0200
commit8aab8699e02ed9ec736bb6dfab0edd3fe9156c8d (patch)
tree9b853e0d343f4bf2f60625431275bdc2dd08e027 /src/stores/ServicesStore.js
parentMove "locale" to user data (diff)
downloadferdium-app-8aab8699e02ed9ec736bb6dfab0edd3fe9156c8d.tar.gz
ferdium-app-8aab8699e02ed9ec736bb6dfab0edd3fe9156c8d.tar.zst
ferdium-app-8aab8699e02ed9ec736bb6dfab0edd3fe9156c8d.zip
Split settings into multiple stores; app specific settings are now stored in config file
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r--src/stores/ServicesStore.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index f7d92b1ff..b96bc506b 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -86,13 +86,13 @@ export default class ServicesStore extends Store {
86 } 86 }
87 87
88 @computed get allDisplayed() { 88 @computed get allDisplayed() {
89 return this.stores.settings.all.showDisabledServices ? this.all : this.enabled; 89 return this.stores.settings.all.service.showDisabledServices ? this.all : this.enabled;
90 } 90 }
91 91
92 // This is just used to avoid unnecessary rerendering of resource-heavy webviews 92 // This is just used to avoid unnecessary rerendering of resource-heavy webviews
93 @computed get allDisplayedUnordered() { 93 @computed get allDisplayedUnordered() {
94 const services = this.allServicesRequest.execute().result || []; 94 const services = this.allServicesRequest.execute().result || [];
95 return this.stores.settings.all.showDisabledServices ? services : services.filter(service => service.isEnabled); 95 return this.stores.settings.all.service.showDisabledServices ? services : services.filter(service => service.isEnabled);
96 } 96 }
97 97
98 @computed get filtered() { 98 @computed get filtered() {
@@ -334,7 +334,7 @@ export default class ServicesStore extends Store {
334 }); 334 });
335 } else if (channel === 'notification') { 335 } else if (channel === 'notification') {
336 const options = args[0].options; 336 const options = args[0].options;
337 if (service.recipe.hasNotificationSound || service.isMuted || this.stores.settings.all.isAppMuted) { 337 if (service.recipe.hasNotificationSound || service.isMuted || this.stores.settings.all.app.isAppMuted) {
338 Object.assign(options, { 338 Object.assign(options, {
339 silent: true, 339 silent: true,
340 }); 340 });
@@ -434,7 +434,7 @@ export default class ServicesStore extends Store {
434 } 434 }
435 435
436 @action _reorder({ oldIndex, newIndex }) { 436 @action _reorder({ oldIndex, newIndex }) {
437 const showDisabledServices = this.stores.settings.all.showDisabledServices; 437 const showDisabledServices = this.stores.settings.all.service.showDisabledServices;
438 const oldEnabledSortIndex = showDisabledServices ? oldIndex : this.all.indexOf(this.enabled[oldIndex]); 438 const oldEnabledSortIndex = showDisabledServices ? oldIndex : this.all.indexOf(this.enabled[oldIndex]);
439 const newEnabledSortIndex = showDisabledServices ? newIndex : this.all.indexOf(this.enabled[newIndex]); 439 const newEnabledSortIndex = showDisabledServices ? newIndex : this.all.indexOf(this.enabled[newIndex]);
440 440
@@ -512,7 +512,8 @@ export default class ServicesStore extends Store {
512 512
513 if (service) { 513 if (service) {
514 this.actions.settings.update({ 514 this.actions.settings.update({
515 settings: { 515 type: 'service',
516 data: {
516 activeService: service.id, 517 activeService: service.id,
517 }, 518 },
518 }); 519 });
@@ -520,7 +521,7 @@ export default class ServicesStore extends Store {
520 } 521 }
521 522
522 _mapActiveServiceToServiceModelReaction() { 523 _mapActiveServiceToServiceModelReaction() {
523 const { activeService } = this.stores.settings.all; 524 const { activeService } = this.stores.settings.all.service;
524 if (this.allDisplayed.length) { 525 if (this.allDisplayed.length) {
525 this.allDisplayed.map(service => Object.assign(service, { 526 this.allDisplayed.map(service => Object.assign(service, {
526 isActive: activeService ? activeService === service.id : this.allDisplayed[0].id === service.id, 527 isActive: activeService ? activeService === service.id : this.allDisplayed[0].id === service.id,
@@ -529,7 +530,7 @@ export default class ServicesStore extends Store {
529 } 530 }
530 531
531 _getUnreadMessageCountReaction() { 532 _getUnreadMessageCountReaction() {
532 const showMessageBadgeWhenMuted = this.stores.settings.all.showMessageBadgeWhenMuted; 533 const showMessageBadgeWhenMuted = this.stores.settings.all.app.showMessageBadgeWhenMuted;
533 const showMessageBadgesEvenWhenMuted = this.stores.ui.showMessageBadgesEvenWhenMuted; 534 const showMessageBadgesEvenWhenMuted = this.stores.ui.showMessageBadgesEvenWhenMuted;
534 535
535 const unreadDirectMessageCount = this.allDisplayed 536 const unreadDirectMessageCount = this.allDisplayed