From 22ec7a6d7555954fe3083ca6db2595ebbc0c3be6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 24 Jan 2025 20:37:12 +0400 Subject: [PATCH] Fix notification sounds on macOS. --- Telegram/SourceFiles/window/notifications_manager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 15aa20444d..6b8666bfc0 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -697,6 +697,7 @@ void System::showNext() { break; } const auto notifyItem = notify->item; + const auto notifySilent = computeSkipState(*notify).silent; const auto messageType = (notify->type == Data::ItemNotificationType::Message); const auto isForwarded = messageType @@ -773,7 +774,7 @@ void System::showNext() { if (!_lastHistoryItemId && groupedItem) { _lastHistorySessionId = groupedItem->history()->session().uniqueId(); _lastHistoryItemId = groupedItem->fullId(); - _lastSoundId = MaybeSoundFor( + _lastSoundId = notifySilent ? std::nullopt : MaybeSoundFor( notifyThread, groupedItem->specialNotificationPeer()); } @@ -794,7 +795,7 @@ void System::showNext() { _lastForwardedCount += forwardedCount; _lastHistorySessionId = groupedItem->history()->session().uniqueId(); _lastHistoryItemId = groupedItem->fullId(); - _lastSoundId = MaybeSoundFor( + _lastSoundId = notifySilent ? std::nullopt : MaybeSoundFor( notifyThread, groupedItem->specialNotificationPeer()); _waitForAllGroupedTimer.callOnce(kWaitingForAllGroupedDelay); @@ -817,7 +818,9 @@ void System::showNext() { .forwardedCount = forwardedCount, .reactionFrom = notify->reactionSender, .reactionId = reaction, - .soundId = MaybeSoundFor(notifyThread, soundFrom), + .soundId = (notifySilent + ? std::nullopt + : MaybeSoundFor(notifyThread, soundFrom)), }); } }