2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Moved out public api for notify settings from Data::Session.

This commit is contained in:
23rd
2022-04-01 13:36:33 +03:00
committed by John Preston
parent 36bb23c54c
commit 9478798a47
13 changed files with 113 additions and 114 deletions

View File

@@ -3798,66 +3798,6 @@ auto Session::dialogsRowReplacements() const
return _dialogsRowReplacements.events();
}
bool Session::notifyIsMuted(not_null<const PeerData*> peer) const {
return notifySettings().notifyIsMuted(peer, nullptr);
}
bool Session::notifySilentPosts(not_null<const PeerData*> peer) const {
if (const auto silent = peer->notifySilentPosts()) {
return *silent;
}
const auto &settings = notifySettings().defaultNotifySettings(peer);
if (const auto silent = settings.silentPosts()) {
return *silent;
}
return false;
}
bool Session::notifySoundIsNone(not_null<const PeerData*> peer) const {
if (const auto soundIsNone = peer->notifySoundIsNone()) {
return *soundIsNone;
}
const auto &settings = notifySettings().defaultNotifySettings(peer);
if (const auto soundIsNone = settings.soundIsNone()) {
return *soundIsNone;
}
return false;
}
bool Session::notifyMuteUnknown(not_null<const PeerData*> peer) const {
if (peer->notifySettingsUnknown()) {
return true;
} else if (const auto nonDefault = peer->notifyMuteUntil()) {
return false;
}
return notifySettings().defaultNotifySettings(peer).settingsUnknown();
}
bool Session::notifySilentPostsUnknown(
not_null<const PeerData*> peer) const {
if (peer->notifySettingsUnknown()) {
return true;
} else if (const auto nonDefault = peer->notifySilentPosts()) {
return false;
}
return notifySettings().defaultNotifySettings(peer).settingsUnknown();
}
bool Session::notifySoundIsNoneUnknown(not_null<const PeerData*> peer) const {
if (peer->notifySettingsUnknown()) {
return true;
} else if (const auto nonDefault = peer->notifySoundIsNone()) {
return false;
}
return notifySettings().defaultNotifySettings(peer).settingsUnknown();
}
bool Session::notifySettingsUnknown(not_null<const PeerData*> peer) const {
return notifyMuteUnknown(peer)
|| notifySilentPostsUnknown(peer)
|| notifySoundIsNoneUnknown(peer);
}
void Session::serviceNotification(
const TextWithEntities &message,
const MTPMessageMedia &media) {