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

Update API scheme on layer 142: Premium reactions.

This commit is contained in:
John Preston
2022-04-21 19:34:00 +04:00
parent 2f6f432583
commit d87c9c72fb
11 changed files with 67 additions and 7 deletions

View File

@@ -73,6 +73,7 @@ void Reactions::refresh() {
const std::vector<Reaction> &Reactions::list(Type type) const {
switch (type) {
case Type::ActiveNonPremium: return _activeNonPremium;
case Type::Active: return _active;
case Type::All: return _available;
}
@@ -301,6 +302,7 @@ void Reactions::updateFromData(const MTPDmessages_availableReactions &data) {
_iconsCache.emplace(document, document->createMediaView());
}
};
_activeNonPremium.clear();
_active.clear();
_available.clear();
_active.reserve(list.size());
@@ -315,6 +317,9 @@ void Reactions::updateFromData(const MTPDmessages_availableReactions &data) {
toCache(parsed->selectAnimation);
toCache(parsed->centerIcon);
toCache(parsed->aroundAnimation);
if (!parsed->premium) {
_activeNonPremium.push_back(*parsed);
}
}
}
}
@@ -354,6 +359,7 @@ std::optional<Reaction> Reactions::parse(const MTPAvailableReaction &entry) {
*data.varound_animation()).get()
: nullptr),
.active = !data.is_inactive(),
.premium = data.is_premium(),
})
: std::nullopt;
});