From e54bf92a1f955bd394e0e309506bbf9a0bc09ed6 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 1 Apr 2022 20:43:51 +0200 Subject: [PATCH] Notifications: Temporarily turn off sound for reactions (#1808) --- src/global/actions/apiUpdaters/chats.ts | 1 + src/serviceWorker/pushNotification.ts | 3 ++- src/util/notifications.ts | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/global/actions/apiUpdaters/chats.ts b/src/global/actions/apiUpdaters/chats.ts index 37f312f9f..634d9fe15 100644 --- a/src/global/actions/apiUpdaters/chats.ts +++ b/src/global/actions/apiUpdaters/chats.ts @@ -137,6 +137,7 @@ addActionHandler('apiUpdate', (global, actions, update) => { notifyAboutMessage({ chat, message, + isReaction: true, }); } diff --git a/src/serviceWorker/pushNotification.ts b/src/serviceWorker/pushNotification.ts index d68ff43d4..686d01f87 100644 --- a/src/serviceWorker/pushNotification.ts +++ b/src/serviceWorker/pushNotification.ts @@ -129,7 +129,8 @@ function showNotification({ }; return Promise.all([ - playNotificationSound(String(messageId) || chatId || ''), + // TODO Remove condition when reaction badges are implemented + !reaction ? playNotificationSound(String(messageId) || chatId || '') : undefined, self.registration.showNotification(title, options), ]); } diff --git a/src/util/notifications.ts b/src/util/notifications.ts index 63f607da6..0145ae0ef 100644 --- a/src/util/notifications.ts +++ b/src/util/notifications.ts @@ -409,6 +409,8 @@ export async function notifyAboutMessage({ // Play sound when notification is displayed notification.onshow = () => { + // TODO Remove when reaction badges are implemented + if (isReaction) return; playNotifySoundDebounced(String(message.id) || chat.id); }; }