diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-12-01 12:26:41 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2017-12-01 12:26:41 +0100 |
commit | 893a9f6d9a1bcdbbfe925e718b2c907dcceaa64e (patch) | |
tree | 4f6ff5c4f82abe536107a38c9894fad7f41a0c62 /src/stores/ServicesStore.js | |
parent | fix(App): Allow to turn on notifications when system dnd is enabled (diff) | |
download | ferdium-app-893a9f6d9a1bcdbbfe925e718b2c907dcceaa64e.tar.gz ferdium-app-893a9f6d9a1bcdbbfe925e718b2c907dcceaa64e.tar.zst ferdium-app-893a9f6d9a1bcdbbfe925e718b2c907dcceaa64e.zip |
feat(App): Add option to show/hide notification badges for muted services (@maximiliancsuk)
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 22c376c06..e79677400 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -488,19 +488,28 @@ export default class ServicesStore extends Store { | |||
488 | } | 488 | } |
489 | 489 | ||
490 | _getUnreadMessageCountReaction() { | 490 | _getUnreadMessageCountReaction() { |
491 | const showMessageBadgeWhenMuted = this.stores.settings.all.showMessageBadgeWhenMuted; | ||
492 | const showMessageBadgesEvenWhenMuted = this.stores.ui.showMessageBadgesEvenWhenMuted; | ||
493 | |||
494 | // TODO: unfinished monkey business | ||
495 | |||
491 | const unreadDirectMessageCount = this.enabled | 496 | const unreadDirectMessageCount = this.enabled |
497 | .filter(s => (showMessageBadgeWhenMuted || s.isNotificationEnabled) && showMessageBadgesEvenWhenMuted) | ||
492 | .map(s => s.unreadDirectMessageCount) | 498 | .map(s => s.unreadDirectMessageCount) |
493 | .reduce((a, b) => a + b, 0); | 499 | .reduce((a, b) => a + b, 0); |
494 | 500 | ||
495 | const unreadIndirectMessageCount = this.enabled | 501 | const unreadIndirectMessageCount = this.enabled |
496 | .filter(s => s.isIndirectMessageBadgeEnabled) | 502 | // .filter(s => s.isIndirectMessageBadgeEnabled && (s.isNotificationEnabled && showMessageBadgeWhenMuted)) |
497 | .map(s => s.unreadIndirectMessageCount) | 503 | .map(s => s.unreadIndirectMessageCount) |
498 | .reduce((a, b) => a + b, 0); | 504 | .reduce((a, b) => a + b, 0); |
499 | 505 | ||
500 | this.actions.app.setBadge({ | 506 | // We can't just block this earlier, otherwise the mobx reaction won't be aware of the vars to watch in some cases |
501 | unreadDirectMessageCount, | 507 | if (showMessageBadgesEvenWhenMuted) { |
502 | unreadIndirectMessageCount, | 508 | this.actions.app.setBadge({ |
503 | }); | 509 | unreadDirectMessageCount, |
510 | unreadIndirectMessageCount, | ||
511 | }); | ||
512 | } | ||
504 | } | 513 | } |
505 | 514 | ||
506 | _logoutReaction() { | 515 | _logoutReaction() { |