2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Fix notification sounds on macOS.

This commit is contained in:
John Preston
2025-01-24 20:37:12 +04:00
parent 1b16a84810
commit 22ec7a6d75

View File

@@ -697,6 +697,7 @@ void System::showNext() {
break; break;
} }
const auto notifyItem = notify->item; const auto notifyItem = notify->item;
const auto notifySilent = computeSkipState(*notify).silent;
const auto messageType = (notify->type const auto messageType = (notify->type
== Data::ItemNotificationType::Message); == Data::ItemNotificationType::Message);
const auto isForwarded = messageType const auto isForwarded = messageType
@@ -773,7 +774,7 @@ void System::showNext() {
if (!_lastHistoryItemId && groupedItem) { if (!_lastHistoryItemId && groupedItem) {
_lastHistorySessionId = groupedItem->history()->session().uniqueId(); _lastHistorySessionId = groupedItem->history()->session().uniqueId();
_lastHistoryItemId = groupedItem->fullId(); _lastHistoryItemId = groupedItem->fullId();
_lastSoundId = MaybeSoundFor( _lastSoundId = notifySilent ? std::nullopt : MaybeSoundFor(
notifyThread, notifyThread,
groupedItem->specialNotificationPeer()); groupedItem->specialNotificationPeer());
} }
@@ -794,7 +795,7 @@ void System::showNext() {
_lastForwardedCount += forwardedCount; _lastForwardedCount += forwardedCount;
_lastHistorySessionId = groupedItem->history()->session().uniqueId(); _lastHistorySessionId = groupedItem->history()->session().uniqueId();
_lastHistoryItemId = groupedItem->fullId(); _lastHistoryItemId = groupedItem->fullId();
_lastSoundId = MaybeSoundFor( _lastSoundId = notifySilent ? std::nullopt : MaybeSoundFor(
notifyThread, notifyThread,
groupedItem->specialNotificationPeer()); groupedItem->specialNotificationPeer());
_waitForAllGroupedTimer.callOnce(kWaitingForAllGroupedDelay); _waitForAllGroupedTimer.callOnce(kWaitingForAllGroupedDelay);
@@ -817,7 +818,9 @@ void System::showNext() {
.forwardedCount = forwardedCount, .forwardedCount = forwardedCount,
.reactionFrom = notify->reactionSender, .reactionFrom = notify->reactionSender,
.reactionId = reaction, .reactionId = reaction,
.soundId = MaybeSoundFor(notifyThread, soundFrom), .soundId = (notifySilent
? std::nullopt
: MaybeSoundFor(notifyThread, soundFrom)),
}); });
} }
} }