Add sticker.has_text_color.

This commit is contained in:
levlam 2022-12-09 13:39:29 +03:00
parent 8e7d5f5594
commit 9cc023111d
5 changed files with 24 additions and 9 deletions

View File

@ -312,10 +312,10 @@ photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector<photoSize> = Ph
//@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender
//@emoji Emoji corresponding to the sticker @format Sticker format @type Sticker type @mask_position Position where the mask is placed; may be null even the sticker is a mask
//@custom_emoji_id Identifier of the emoji if the sticker is a custom emoji
//@custom_emoji_id Identifier of the emoji if the sticker is a custom emoji @has_text_color True, if the sticker must be repainted to a text color; for custom emoji only
//@outline Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner
//@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @is_premium True, if only Premium users can use the sticker @premium_animation Premium animation of the sticker; may be null @sticker File containing the sticker
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType mask_position:maskPosition custom_emoji_id:int64 outline:vector<closedVectorPath> thumbnail:thumbnail is_premium:Bool premium_animation:file sticker:file = Sticker;
sticker set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat type:StickerType mask_position:maskPosition custom_emoji_id:int64 has_text_color:Bool outline:vector<closedVectorPath> thumbnail:thumbnail is_premium:Bool premium_animation:file sticker:file = Sticker;
//@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender
//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender

View File

@ -1269,10 +1269,10 @@ tl_object_ptr<td_api::photo> copy(const td_api::photo &obj) {
template <>
tl_object_ptr<td_api::sticker> copy(const td_api::sticker &obj) {
return td_api::make_object<td_api::sticker>(obj.set_id_, obj.width_, obj.height_, obj.emoji_, copy(obj.format_),
copy(obj.type_), copy(obj.mask_position_), obj.custom_emoji_id_,
transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_),
obj.is_premium_, copy(obj.premium_animation_), copy(obj.sticker_));
return td_api::make_object<td_api::sticker>(
obj.set_id_, obj.width_, obj.height_, obj.emoji_, copy(obj.format_), copy(obj.type_), copy(obj.mask_position_),
obj.custom_emoji_id_, obj.has_text_color_, transform(obj.outline_, copy_closed_vector_path), copy(obj.thumbnail_),
obj.is_premium_, copy(obj.premium_animation_), copy(obj.sticker_));
}
template <>

View File

@ -2228,7 +2228,7 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
return td_api::make_object<td_api::sticker>(
sticker->set_id_.get(), width, height, sticker->alt_, get_sticker_format_object(sticker->format_),
get_sticker_type_object(sticker->type_), std::move(mask_position), custom_emoji_id.get(),
get_sticker_minithumbnail(sticker->minithumbnail_, sticker->set_id_, document_id, zoom),
sticker->has_text_color_, get_sticker_minithumbnail(sticker->minithumbnail_, sticker->set_id_, document_id, zoom),
std::move(thumbnail_object), sticker->is_premium_, std::move(premium_animation_object),
td_->file_manager_->get_file_object(file_id));
}
@ -2740,8 +2740,19 @@ FileId StickersManager::on_get_sticker(unique_ptr<Sticker> new_sticker, bool rep
s->m_thumbnail_ = std::move(new_sticker->m_thumbnail_);
is_changed = true;
}
s->is_premium_ = new_sticker->is_premium_;
s->premium_animation_file_id_ = new_sticker->premium_animation_file_id_;
if (s->is_premium_ != new_sticker->is_premium_) {
s->is_premium_ = new_sticker->is_premium_;
is_changed = true;
}
if (s->has_text_color_ != new_sticker->has_text_color_) {
s->has_text_color_ = new_sticker->has_text_color_;
is_changed = true;
}
if (s->premium_animation_file_id_ != new_sticker->premium_animation_file_id_ &&
new_sticker->premium_animation_file_id_.is_valid()) {
s->premium_animation_file_id_ = new_sticker->premium_animation_file_id_;
is_changed = true;
}
if (s->format_ != new_sticker->format_ && new_sticker->format_ != StickerFormat::Unknown) {
s->format_ = new_sticker->format_;
is_changed = true;
@ -3267,6 +3278,7 @@ void StickersManager::create_sticker(FileId file_id, FileId premium_animation_fi
s->alt_ = std::move(custom_emoji->alt_);
s->type_ = StickerType::CustomEmoji;
s->is_premium_ = !custom_emoji->free_;
s->has_text_color_ = custom_emoji->text_color_;
s->emoji_receive_date_ = G()->unix_time();
}
s->format_ = format;

View File

@ -433,6 +433,7 @@ class StickersManager final : public Actor {
StickerFormat format_ = StickerFormat::Unknown;
StickerType type_ = StickerType::Regular;
bool is_premium_ = false;
bool has_text_color_ = false;
bool is_from_database_ = false;
bool is_being_reloaded_ = false;
int32 point_ = -1;

View File

@ -47,6 +47,7 @@ void StickersManager::store_sticker(FileId file_id, bool in_sticker_set, StorerT
STORE_FLAG(is_emoji);
STORE_FLAG(sticker->is_premium_);
STORE_FLAG(has_emoji_receive_date);
STORE_FLAG(sticker->has_text_color_);
END_STORE_FLAGS();
if (!in_sticker_set) {
store(sticker->set_id_.get(), storer);
@ -105,6 +106,7 @@ FileId StickersManager::parse_sticker(bool in_sticker_set, ParserT &parser) {
PARSE_FLAG(is_emoji);
PARSE_FLAG(sticker->is_premium_);
PARSE_FLAG(has_emoji_receive_date);
PARSE_FLAG(sticker->has_text_color_);
END_PARSE_FLAGS();
if (is_webm) {
sticker->format_ = StickerFormat::Webm;