diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/stores/ServicesStore.ts | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/stores/ServicesStore.ts b/src/stores/ServicesStore.ts index 4fdd9d5ad..0ab4dbc5b 100644 --- a/src/stores/ServicesStore.ts +++ b/src/stores/ServicesStore.ts | |||
@@ -826,8 +826,6 @@ export default class ServicesStore extends TypedStore { | |||
826 | break; | 826 | break; |
827 | } | 827 | } |
828 | case 'notification': { | 828 | case 'notification': { |
829 | const { options } = args[0]; | ||
830 | |||
831 | // Check if we are in scheduled Do-not-Disturb time | 829 | // Check if we are in scheduled Do-not-Disturb time |
832 | const { scheduledDNDEnabled, scheduledDNDStart, scheduledDNDEnd } = | 830 | const { scheduledDNDEnabled, scheduledDNDStart, scheduledDNDEnd } = |
833 | this.stores.settings.all.app; | 831 | this.stores.settings.all.app; |
@@ -839,30 +837,29 @@ export default class ServicesStore extends TypedStore { | |||
839 | return; | 837 | return; |
840 | } | 838 | } |
841 | 839 | ||
842 | if ( | 840 | const { notificationId, options } = args[0]; |
843 | service.recipe.hasNotificationSound || | 841 | |
844 | service.isMuted || | 842 | if (service.isMuted || this.stores.settings.all.app.isAppMuted) { |
845 | this.stores.settings.all.app.isAppMuted | ||
846 | ) { | ||
847 | Object.assign(options, { | 843 | Object.assign(options, { |
848 | silent: true, | 844 | silent: true, |
849 | }); | 845 | }); |
850 | } | 846 | } |
851 | 847 | ||
852 | if (service.isNotificationEnabled) { | 848 | if (service.isNotificationEnabled) { |
853 | let title = `Notification from ${service.name}`; | 849 | let title: string; |
854 | if (!this.stores.settings.all.app.privateNotifications) { | 850 | options.icon = service.iconUrl; |
851 | if (this.stores.settings.all.app.privateNotifications === true) { | ||
852 | // Remove message data from notification in private mode | ||
853 | options.body = ''; | ||
854 | title = `Notification from ${service.name}`; | ||
855 | } else { | ||
855 | options.body = typeof options.body === 'string' ? options.body : ''; | 856 | options.body = typeof options.body === 'string' ? options.body : ''; |
856 | title = | 857 | title = |
857 | typeof args[0].title === 'string' ? args[0].title : service.name; | 858 | typeof args[0].title === 'string' ? args[0].title : service.name; |
858 | } else { | ||
859 | // Remove message data from notification in private mode | ||
860 | options.body = ''; | ||
861 | options.icon = '/assets/img/notification-badge.gif'; | ||
862 | } | 859 | } |
863 | 860 | ||
864 | this.actions.app.notify({ | 861 | this.actions.app.notify({ |
865 | notificationId: args[0].notificationId, | 862 | notificationId, |
866 | title, | 863 | title, |
867 | options, | 864 | options, |
868 | serviceId, | 865 | serviceId, |