Notifications: Fix missing sound when notifications are not permitted (#1555)

This commit is contained in:
Alexander Zinchuk 2021-11-20 12:18:00 +03:00
parent 50db2eea77
commit a23e951b09

View File

@ -322,12 +322,13 @@ export async function notifyAboutNewMessage({
}: { chat: ApiChat; message: Partial<ApiMessage> }) { }: { chat: ApiChat; message: Partial<ApiMessage> }) {
const { hasWebNotifications } = await loadNotificationSettings(); const { hasWebNotifications } = await loadNotificationSettings();
if (!checkIfShouldNotify(chat)) return; if (!checkIfShouldNotify(chat)) return;
if (!hasWebNotifications) { const areNotificationsSupported = checkIfNotificationsSupported();
if (!hasWebNotifications || !areNotificationsSupported) {
// only play sound if web notifications are disabled // only play sound if web notifications are disabled
playNotifySoundDebounced(String(message.id) || chat.id); playNotifySoundDebounced(String(message.id) || chat.id);
return; return;
} }
if (!checkIfNotificationsSupported()) return; if (!areNotificationsSupported) return;
if (!message.id) return; if (!message.id) return;
const { const {