2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Update API scheme on layer 148.

Extract message history corner buttons code.
This commit is contained in:
John Preston
2022-10-08 15:14:38 +04:00
parent 2c0b5b3210
commit 6a7f030ee7
24 changed files with 751 additions and 444 deletions

View File

@@ -41,24 +41,22 @@ constexpr auto kNextRequestLimit = 100;
UnreadThings::UnreadThings(not_null<ApiWrap*> api) : _api(api) {
}
bool UnreadThings::trackMentions(PeerData *peer) const {
bool UnreadThings::trackMentions(DialogsEntry *entry) const {
const auto peer = entry ? ResolveHistory(entry)->peer.get() : nullptr;
return peer && (peer->isChat() || peer->isMegagroup());
}
bool UnreadThings::trackReactions(PeerData *peer) const {
return trackMentions(peer) || (peer && peer->isUser());
bool UnreadThings::trackReactions(DialogsEntry *entry) const {
const auto peer = entry ? ResolveHistory(entry)->peer.get() : nullptr;
return peer && (peer->isChat() || peer->isMegagroup());
}
void UnreadThings::preloadEnough(DialogsEntry *entry) {
if (!entry) {
return;
if (trackMentions(entry)) {
preloadEnoughMentions(entry);
}
const auto history = ResolveHistory(entry);
if (trackMentions(history->peer)) {
preloadEnoughMentions(history);
}
if (trackReactions(history->peer)) {
preloadEnoughReactions(history);
if (trackReactions(entry)) {
preloadEnoughReactions(entry);
}
}