From bedec2c9bae8aa080ad55a92dc191ca1d7554431 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 16 Jul 2022 15:45:30 +0300 Subject: [PATCH] Add StickersManager::get_sticker_set_thumbnail_object. --- td/telegram/StickersManager.cpp | 15 +++++++++------ td/telegram/StickersManager.h | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 804aa51bb..278b280b6 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1998,6 +1998,13 @@ double StickersManager::get_sticker_set_minithumbnail_zoom(const StickerSet *sti return 1.0; } +td_api::object_ptr StickersManager::get_sticker_set_thumbnail_object( + const StickerSet *sticker_set) const { + CHECK(sticker_set != nullptr); + auto thumbnail_format = get_sticker_set_thumbnail_format(sticker_set->sticker_format); + return get_thumbnail_object(td_->file_manager_.get(), sticker_set->thumbnail, thumbnail_format); +} + tl_object_ptr StickersManager::get_sticker_set_object(StickerSetId sticker_set_id) const { const StickerSet *sticker_set = get_sticker_set(sticker_set_id); CHECK(sticker_set != nullptr); @@ -2016,10 +2023,8 @@ tl_object_ptr StickersManager::get_sticker_set_object(Sticke } emojis.push_back(make_tl_object(std::move(sticker_emojis))); } - auto thumbnail_format = get_sticker_set_thumbnail_format(sticker_set->sticker_format); - auto thumbnail = get_thumbnail_object(td_->file_manager_.get(), sticker_set->thumbnail, thumbnail_format); return make_tl_object( - sticker_set->id.get(), sticker_set->title, sticker_set->short_name, std::move(thumbnail), + sticker_set->id.get(), sticker_set->title, sticker_set->short_name, get_sticker_set_thumbnail_object(sticker_set), get_sticker_minithumbnail(sticker_set->minithumbnail, sticker_set->id, -2, get_sticker_set_minithumbnail_zoom(sticker_set)), sticker_set->is_installed && !sticker_set->is_archived, sticker_set->is_archived, sticker_set->is_official, @@ -2091,11 +2096,9 @@ tl_object_ptr StickersManager::get_sticker_set_info_obje } } - auto thumbnail_format = get_sticker_set_thumbnail_format(sticker_set->sticker_format); - auto thumbnail = get_thumbnail_object(td_->file_manager_.get(), sticker_set->thumbnail, thumbnail_format); auto actual_count = narrow_cast(sticker_set->sticker_ids.size()); return make_tl_object( - sticker_set->id.get(), sticker_set->title, sticker_set->short_name, std::move(thumbnail), + sticker_set->id.get(), sticker_set->title, sticker_set->short_name, get_sticker_set_thumbnail_object(sticker_set), get_sticker_minithumbnail(sticker_set->minithumbnail, sticker_set->id, -3, get_sticker_set_minithumbnail_zoom(sticker_set)), sticker_set->is_installed && !sticker_set->is_archived, sticker_set->is_archived, sticker_set->is_official, diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index fb0876b46..1b2058fa6 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -498,6 +498,8 @@ class StickersManager final : public Actor { static tl_object_ptr get_mask_point_object(int32 point); + td_api::object_ptr get_sticker_set_thumbnail_object(const StickerSet *sticker_set) const; + tl_object_ptr get_sticker_set_info_object(StickerSetId sticker_set_id, size_t covers_limit, bool prefer_premium) const;