Add animatedEmoji.sticker_width/sticker_height.

This commit is contained in:
levlam 2022-09-25 23:40:42 +03:00
parent 302e2fd4b9
commit 35058bb6a7
2 changed files with 13 additions and 3 deletions

View File

@ -334,9 +334,11 @@ voiceNote duration:int32 waveform:bytes mime_type:string speech_recognition_resu
//@description Describes an animated or custom representation of an emoji
//@sticker Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs
//@sticker_width Expected width of the sticker, which can be used if the sticker is null
//@sticker_height Expected height of the sticker, which can be used if the sticker is null
//@fitzpatrick_type Emoji modifier fitzpatrick type; 0-6; 0 if none
//@sound File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container
animatedEmoji sticker:sticker fitzpatrick_type:int32 sound:file = AnimatedEmoji;
animatedEmoji sticker:sticker sticker_width:int32 sticker_height:int32 fitzpatrick_type:int32 sound:file = AnimatedEmoji;
//@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @vcard Additional data about the user in a form of vCard; 0-2048 bytes in length @user_id Identifier of the user, if known; otherwise 0
contact phone_number:string first_name:string last_name:string vcard:string user_id:int53 = Contact;

View File

@ -2600,7 +2600,11 @@ td_api::object_ptr<td_api::animatedEmoji> StickersManager::get_animated_emoji_ob
auto it = custom_emoji_messages_.find(custom_emoji_id);
auto sticker_id = it == custom_emoji_messages_.end() ? get_custom_animated_emoji_sticker_id(custom_emoji_id)
: it->second->sticker_id_;
return td_api::make_object<td_api::animatedEmoji>(get_sticker_object(sticker_id, true), 0, nullptr);
auto sticker = get_sticker_object(sticker_id, true);
auto default_custom_emoji_dimension = static_cast<int32>(512 * animated_emoji_zoom_ + 0.5);
auto sticker_width = sticker == nullptr ? default_custom_emoji_dimension : sticker->width_;
auto sticker_height = sticker == nullptr ? default_custom_emoji_dimension : sticker->height_;
return td_api::make_object<td_api::animatedEmoji>(std::move(sticker), sticker_width, sticker_height, 0, nullptr);
}
auto it = emoji_messages_.find(emoji);
@ -2616,8 +2620,12 @@ td_api::object_ptr<td_api::animatedEmoji> StickersManager::get_animated_emoji_ob
if (!animated_sticker.first.is_valid()) {
return nullptr;
}
auto sticker = get_sticker_object(animated_sticker.first, true);
CHECK(sticker != nullptr);
auto sticker_width = sticker->width_;
auto sticker_height = sticker->height_;
return td_api::make_object<td_api::animatedEmoji>(
get_sticker_object(animated_sticker.first, true), animated_sticker.second,
std::move(sticker), sticker_width, sticker_height, animated_sticker.second,
sound_file_id.is_valid() ? td_->file_manager_->get_file_object(sound_file_id) : nullptr);
}