diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 5fdd81a9f..2b63502e8 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3261,10 +3261,11 @@ emojis emojis:vector = Emojis; //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set @@ -3277,10 +3278,11 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets stickerSets total_count:int32 sets:vector = StickerSets; diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index a4076a30a..45cc57f08 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -2480,7 +2480,7 @@ tl_object_ptr StickersManager::get_sticker_set_object(Sticke get_sticker_set_minithumbnail_zoom(sticker_set)), sticker_set->is_installed_ && !sticker_set->is_archived_, sticker_set->is_archived_, sticker_set->is_official_, get_sticker_format_object(sticker_set->sticker_format_), get_sticker_type_object(sticker_set->sticker_type_), - sticker_set->is_viewed_, std::move(stickers), std::move(emojis)); + sticker_set->has_text_color_, sticker_set->is_viewed_, std::move(stickers), std::move(emojis)); } tl_object_ptr StickersManager::get_sticker_sets_object(int32 total_count, @@ -2556,8 +2556,8 @@ tl_object_ptr StickersManager::get_sticker_set_info_obje get_sticker_set_minithumbnail_zoom(sticker_set)), sticker_set->is_installed_ && !sticker_set->is_archived_, sticker_set->is_archived_, sticker_set->is_official_, get_sticker_format_object(sticker_set->sticker_format_), get_sticker_type_object(sticker_set->sticker_type_), - sticker_set->is_viewed_, sticker_set->was_loaded_ ? actual_count : max(actual_count, sticker_set->sticker_count_), - std::move(stickers)); + sticker_set->has_text_color_, sticker_set->is_viewed_, + sticker_set->was_loaded_ ? actual_count : max(actual_count, sticker_set->sticker_count_), std::move(stickers)); } td_api::object_ptr StickersManager::get_premium_gift_sticker_object(int32 month_count) { @@ -3557,6 +3557,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptrflags_ & telegram_api::stickerSet::INSTALLED_DATE_MASK) != 0; bool is_archived = set->archived_; bool is_official = set->official_; + bool has_text_color = set->text_color_; StickerFormat sticker_format = set->videos_ ? StickerFormat::Webm : (set->animated_ ? StickerFormat::Tgs : StickerFormat::Webp); StickerType sticker_type = @@ -3595,6 +3596,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptris_official_ = is_official; s->sticker_format_ = sticker_format; s->sticker_type_ = sticker_type; + s->has_text_color_ = has_text_color; s->is_changed_ = true; } else { CHECK(s->id_ == set_id); @@ -3665,6 +3667,11 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptris_official_ = is_official; s->is_changed_ = true; } + if (s->has_text_color_ != has_text_color) { + LOG(INFO) << "Needs repainting flag of " << set_id << " changed to " << has_text_color; + s->has_text_color_ = has_text_color; + s->is_changed_ = true; + } if (s->sticker_format_ != sticker_format) { LOG(ERROR) << "Format of stickers in " << set_id << '/' << s->short_name_ << " has changed from " << s->sticker_format_ << " to " << sticker_format << " from " << source; diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index 097662010..08eec26b8 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -492,6 +492,7 @@ class StickersManager final : public Actor { bool is_installed_ = false; bool is_archived_ = false; bool is_official_ = false; + bool has_text_color_ = false; bool is_viewed_ = true; bool is_thumbnail_reloaded_ = false; // stored in telegram_api::stickerSet bool are_legacy_sticker_thumbnails_reloaded_ = false; // stored in telegram_api::stickerSet diff --git a/td/telegram/StickersManager.hpp b/td/telegram/StickersManager.hpp index ad64127db..5b2d4d305 100644 --- a/td/telegram/StickersManager.hpp +++ b/td/telegram/StickersManager.hpp @@ -201,6 +201,7 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with STORE_FLAG(has_thumbnail_document_id); STORE_FLAG(sticker_set->are_keywords_loaded_); STORE_FLAG(sticker_set->is_sticker_has_text_color_loaded_); + STORE_FLAG(sticker_set->has_text_color_); END_STORE_FLAGS(); store(sticker_set->id_.get(), storer); store(sticker_set->access_hash_, storer); @@ -264,6 +265,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser bool is_webm; bool is_emojis; bool has_thumbnail_document_id; + bool has_text_color; BEGIN_PARSE_FLAGS(); PARSE_FLAG(sticker_set->is_inited_); PARSE_FLAG(sticker_set->was_loaded_); @@ -284,6 +286,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser PARSE_FLAG(has_thumbnail_document_id); PARSE_FLAG(sticker_set->are_keywords_loaded_); PARSE_FLAG(sticker_set->is_sticker_has_text_color_loaded_); + PARSE_FLAG(has_text_color); END_PARSE_FLAGS(); int64 sticker_set_id; int64 access_hash; @@ -345,6 +348,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser sticker_set->is_official_ = is_official; sticker_set->sticker_type_ = sticker_type; sticker_set->sticker_format_ = sticker_format; + sticker_set->has_text_color_ = has_text_color; auto cleaned_username = clean_username(sticker_set->short_name_); if (!cleaned_username.empty()) { @@ -354,7 +358,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser } else { if (sticker_set->title_ != title || sticker_set->minithumbnail_ != minithumbnail || sticker_set->thumbnail_ != thumbnail || sticker_set->thumbnail_document_id_ != thumbnail_document_id || - sticker_set->is_official_ != is_official) { + sticker_set->is_official_ != is_official || sticker_set->has_text_color_ != has_text_color) { sticker_set->is_changed_ = true; } if (sticker_set->short_name_ != short_name) { @@ -401,6 +405,9 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser if (sticker->set_id_ != sticker_set->id_) { LOG_IF(ERROR, sticker->set_id_.is_valid()) << "Sticker " << sticker_id << " set_id has changed"; sticker->set_id_ = sticker_set->id_; + if (sticker->has_text_color_) { + sticker_set->has_text_color_ = true; + } } if (sticker->is_premium_) { sticker_set->premium_sticker_positions_.push_back(static_cast(sticker_set->sticker_ids_.size() - 1));