mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Update API scheme on layer 148.
Extract message history corner buttons code.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,8 +23,8 @@ public:
|
||||
|
||||
explicit UnreadThings(not_null<ApiWrap*> api);
|
||||
|
||||
[[nodiscard]] bool trackMentions(PeerData *peer) const;
|
||||
[[nodiscard]] bool trackReactions(PeerData *peer) const;
|
||||
[[nodiscard]] bool trackMentions(DialogsEntry *entry) const;
|
||||
[[nodiscard]] bool trackReactions(DialogsEntry *entry) const;
|
||||
|
||||
void preloadEnough(DialogsEntry *entry);
|
||||
|
||||
|
Reference in New Issue
Block a user