From 0e90468e3e504c40ebd525c4be22e423e5ecdcce Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Mon, 16 Jan 2023 06:08:56 +0530 Subject: Use service icon in notification; Decouple notification sound from notification badge (#860) --- src/stores/ServicesStore.ts | 25 +++++++++++-------------- 1 file 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 { break; } case 'notification': { - const { options } = args[0]; - // Check if we are in scheduled Do-not-Disturb time const { scheduledDNDEnabled, scheduledDNDStart, scheduledDNDEnd } = this.stores.settings.all.app; @@ -839,30 +837,29 @@ export default class ServicesStore extends TypedStore { return; } - if ( - service.recipe.hasNotificationSound || - service.isMuted || - this.stores.settings.all.app.isAppMuted - ) { + const { notificationId, options } = args[0]; + + if (service.isMuted || this.stores.settings.all.app.isAppMuted) { Object.assign(options, { silent: true, }); } if (service.isNotificationEnabled) { - let title = `Notification from ${service.name}`; - if (!this.stores.settings.all.app.privateNotifications) { + let title: string; + options.icon = service.iconUrl; + if (this.stores.settings.all.app.privateNotifications === true) { + // Remove message data from notification in private mode + options.body = ''; + title = `Notification from ${service.name}`; + } else { options.body = typeof options.body === 'string' ? options.body : ''; title = typeof args[0].title === 'string' ? args[0].title : service.name; - } else { - // Remove message data from notification in private mode - options.body = ''; - options.icon = '/assets/img/notification-badge.gif'; } this.actions.app.notify({ - notificationId: args[0].notificationId, + notificationId, title, options, serviceId, -- cgit v1.2.3-54-g00ecf