Add flag show_caption_above_media to relevant message content types.

This commit is contained in:
levlam 2024-05-15 17:19:41 +03:00
parent aa09223b9c
commit f9d3431401
4 changed files with 12 additions and 9 deletions

View File

@ -117,7 +117,7 @@ BENCH(TlToStringMessage, "TL to_string message") {
td::vector<td::int32>{10000, 20000, 30000, 50000, 70000, 90000, 120000, 150000, 180000, 220000}));
}
x->content_ = td::td_api::make_object<td::td_api::messagePhoto>(
std::move(photo), td::td_api::make_object<td::td_api::formattedText>(), false, false);
std::move(photo), td::td_api::make_object<td::td_api::formattedText>(), false, false, false);
std::size_t res = 0;
for (int i = 0; i < n; i++) {

View File

@ -2999,9 +2999,10 @@ messageText text:formattedText web_page:webPage link_preview_options:linkPreview
//@description An animation message (GIF-style).
//@animation The animation description
//@caption Animation caption
//@show_caption_above_media True, if caption must be shown above the animation; otherwise caption must be shown below the animation
//@has_spoiler True, if the animation preview must be covered by a spoiler animation
//@is_secret True, if the animation thumbnail must be blurred and the animation must be shown only while tapped
messageAnimation animation:animation caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
messageAnimation animation:animation caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent;
//@description An audio message @audio The audio description @caption Audio caption
messageAudio audio:audio caption:formattedText = MessageContent;
@ -3012,9 +3013,10 @@ messageDocument document:document caption:formattedText = MessageContent;
//@description A photo message
//@photo The photo
//@caption Photo caption
//@show_caption_above_media True, if caption must be shown above the photo; otherwise caption must be shown below the photo
//@has_spoiler True, if the photo preview must be covered by a spoiler animation
//@is_secret True, if the photo must be blurred and must be shown only while tapped
messagePhoto photo:photo caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
messagePhoto photo:photo caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent;
//@description A sticker message @sticker The sticker description @is_premium True, if premium animation of the sticker must be played
messageSticker sticker:sticker is_premium:Bool = MessageContent;
@ -3022,9 +3024,10 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent;
//@description A video message
//@video The video description
//@caption Video caption
//@show_caption_above_media True, if caption must be shown above the video; otherwise caption must be shown below the video
//@has_spoiler True, if the video preview must be covered by a spoiler animation
//@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped
messageVideo video:video caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
messageVideo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent;
//@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped
messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent;

View File

@ -6910,7 +6910,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
const auto *m = static_cast<const MessageAnimation *>(content);
return make_tl_object<td_api::messageAnimation>(
td->animations_manager_->get_animation_object(m->file_id),
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), m->has_spoiler,
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), invert_media, m->has_spoiler,
is_content_secret);
}
case MessageContentType::Audio: {
@ -6958,7 +6958,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
return make_tl_object<td_api::messageExpiredPhoto>();
}
auto caption = get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp);
return make_tl_object<td_api::messagePhoto>(std::move(photo), std::move(caption), m->has_spoiler,
return make_tl_object<td_api::messagePhoto>(std::move(photo), std::move(caption), invert_media, m->has_spoiler,
is_content_secret);
}
case MessageContentType::Sticker: {
@ -7010,7 +7010,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
const auto *m = static_cast<const MessageVideo *>(content);
return make_tl_object<td_api::messageVideo>(
td->videos_manager_->get_video_object(m->file_id),
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), m->has_spoiler,
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), invert_media, m->has_spoiler,
is_content_secret);
}
case MessageContentType::VideoNote: {

View File

@ -25350,7 +25350,7 @@ void MessagesManager::edit_message_reply_markup(MessageFullId message_full_id,
auto input_reply_markup = get_input_reply_markup(td_->user_manager_.get(), new_reply_markup);
td_->create_handler<EditMessageQuery>(std::move(promise))
->send(0, dialog_id, m->message_id, string(), vector<tl_object_ptr<telegram_api::MessageEntity>>(), nullptr,
false, std::move(input_reply_markup), get_message_schedule_date(m));
m->invert_media, std::move(input_reply_markup), get_message_schedule_date(m));
}
void MessagesManager::edit_inline_message_text(const string &inline_message_id,
@ -25542,7 +25542,7 @@ void MessagesManager::edit_message_scheduling_state(
if (schedule_date > 0) {
td_->create_handler<EditMessageQuery>(std::move(promise))
->send(0, dialog_id, m->message_id, string(), vector<tl_object_ptr<telegram_api::MessageEntity>>(), nullptr,
false, nullptr, schedule_date);
m->invert_media, nullptr, schedule_date);
} else {
td_->create_handler<SendScheduledMessageQuery>(std::move(promise))->send(dialog_id, m->message_id);
}