Add webPage.force_*_media flags.
This commit is contained in:
parent
8185dbfecc
commit
104727cb75
@ -2092,6 +2092,8 @@ webPageInstantView page_blocks:vector<PageBlock> view_count:int32 version:int32
|
|||||||
//@duration Duration of the content, in seconds
|
//@duration Duration of the content, in seconds
|
||||||
//@author Author of the content
|
//@author Author of the content
|
||||||
//@has_large_media True, if the preview has large media and its appearance can be changed
|
//@has_large_media True, if the preview has large media and its appearance can be changed
|
||||||
|
//@force_small_media True, if shown media preview should be small
|
||||||
|
//@force_large_media True, if shown media preview should be large
|
||||||
//@animation Preview of the content as an animation, if available; may be null
|
//@animation Preview of the content as an animation, if available; may be null
|
||||||
//@audio Preview of the content as an audio file, if available; may be null
|
//@audio Preview of the content as an audio file, if available; may be null
|
||||||
//@document Preview of the content as a document, if available; may be null
|
//@document Preview of the content as a document, if available; may be null
|
||||||
@ -2102,7 +2104,7 @@ webPageInstantView page_blocks:vector<PageBlock> view_count:int32 version:int32
|
|||||||
//@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none
|
//@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none
|
||||||
//@story_id The identifier of the previewed story; 0 if none
|
//@story_id The identifier of the previewed story; 0 if none
|
||||||
//@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none
|
//@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none
|
||||||
webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage;
|
webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool force_small_media:Bool force_large_media:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about a country
|
//@description Contains information about a country
|
||||||
|
@ -3872,12 +3872,15 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if (old_->web_page_id != new_->web_page_id || old_->force_small_media != new_->force_small_media ||
|
if (old_->web_page_id != new_->web_page_id || old_->force_small_media != new_->force_small_media ||
|
||||||
old_->force_large_media != new_->force_large_media || old_->is_manual != new_->is_manual) {
|
old_->force_large_media != new_->force_large_media) {
|
||||||
LOG(INFO) << "Old: " << old_->web_page_id << ", new: " << new_->web_page_id;
|
LOG(INFO) << "Old: " << old_->web_page_id << ", new: " << new_->web_page_id;
|
||||||
is_content_changed = true;
|
is_content_changed = true;
|
||||||
need_update |= td->web_pages_manager_->have_web_page(old_->web_page_id) ||
|
need_update |= td->web_pages_manager_->have_web_page(old_->web_page_id) ||
|
||||||
td->web_pages_manager_->have_web_page(new_->web_page_id);
|
td->web_pages_manager_->have_web_page(new_->web_page_id);
|
||||||
}
|
}
|
||||||
|
if (old_->is_manual != new_->is_manual) {
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageContentType::Animation: {
|
case MessageContentType::Animation: {
|
||||||
@ -6087,7 +6090,8 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
return make_tl_object<td_api::messageText>(
|
return make_tl_object<td_api::messageText>(
|
||||||
get_formatted_text_object(m->text, skip_bot_commands, max_media_timestamp),
|
get_formatted_text_object(m->text, skip_bot_commands, max_media_timestamp),
|
||||||
td->web_pages_manager_->get_web_page_object(m->web_page_id), disable_web_page_preview || m->is_manual);
|
td->web_pages_manager_->get_web_page_object(m->web_page_id, m->force_small_media, m->force_large_media),
|
||||||
|
disable_web_page_preview || m->is_manual);
|
||||||
}
|
}
|
||||||
case MessageContentType::Unsupported:
|
case MessageContentType::Unsupported:
|
||||||
return make_tl_object<td_api::messageUnsupported>();
|
return make_tl_object<td_api::messageUnsupported>();
|
||||||
|
@ -846,7 +846,7 @@ void WebPagesManager::on_get_web_page_preview_success(const string &url, WebPage
|
|||||||
on_get_web_page_by_url(url, web_page_id, true);
|
on_get_web_page_by_url(url, web_page_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
promise.set_value(get_web_page_object(web_page_id));
|
promise.set_value(get_web_page_object(web_page_id, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPagesManager::get_web_page_preview(td_api::object_ptr<td_api::formattedText> &&text,
|
void WebPagesManager::get_web_page_preview(td_api::object_ptr<td_api::formattedText> &&text,
|
||||||
@ -863,7 +863,7 @@ void WebPagesManager::get_web_page_preview(td_api::object_ptr<td_api::formattedT
|
|||||||
|
|
||||||
auto web_page_id = get_web_page_by_url(url);
|
auto web_page_id = get_web_page_by_url(url);
|
||||||
if (web_page_id.is_valid()) {
|
if (web_page_id.is_valid()) {
|
||||||
return promise.set_value(get_web_page_object(web_page_id));
|
return promise.set_value(get_web_page_object(web_page_id, false, false));
|
||||||
}
|
}
|
||||||
td_->create_handler<GetWebPagePreviewQuery>(std::move(promise))
|
td_->create_handler<GetWebPagePreviewQuery>(std::move(promise))
|
||||||
->send(formatted_text.text,
|
->send(formatted_text.text,
|
||||||
@ -1207,7 +1207,8 @@ bool WebPagesManager::have_web_page(WebPageId web_page_id) const {
|
|||||||
return get_web_page(web_page_id) != nullptr;
|
return get_web_page(web_page_id) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_object(WebPageId web_page_id) const {
|
tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_object(WebPageId web_page_id, bool force_small_media,
|
||||||
|
bool force_large_media) const {
|
||||||
if (!web_page_id.is_valid()) {
|
if (!web_page_id.is_valid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1311,7 +1312,7 @@ tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_object(WebPageId we
|
|||||||
get_formatted_text_object(description, true, duration == 0 ? std::numeric_limits<int32>::max() : duration),
|
get_formatted_text_object(description, true, duration == 0 ? std::numeric_limits<int32>::max() : duration),
|
||||||
get_photo_object(td_->file_manager_.get(), web_page->photo_), web_page->embed_url_, web_page->embed_type_,
|
get_photo_object(td_->file_manager_.get(), web_page->photo_), web_page->embed_url_, web_page->embed_type_,
|
||||||
web_page->embed_dimensions_.width, web_page->embed_dimensions_.height, web_page->duration_, web_page->author_,
|
web_page->embed_dimensions_.width, web_page->embed_dimensions_.height, web_page->duration_, web_page->author_,
|
||||||
web_page->has_large_media_,
|
web_page->has_large_media_, force_small_media, web_page->has_large_media_ && force_large_media,
|
||||||
web_page->document_.type == Document::Type::Animation
|
web_page->document_.type == Document::Type::Animation
|
||||||
? td_->animations_manager_->get_animation_object(web_page->document_.file_id)
|
? td_->animations_manager_->get_animation_object(web_page->document_.file_id)
|
||||||
: nullptr,
|
: nullptr,
|
||||||
|
@ -60,7 +60,8 @@ class WebPagesManager final : public Actor {
|
|||||||
|
|
||||||
bool have_web_page_force(WebPageId web_page_id);
|
bool have_web_page_force(WebPageId web_page_id);
|
||||||
|
|
||||||
tl_object_ptr<td_api::webPage> get_web_page_object(WebPageId web_page_id) const;
|
tl_object_ptr<td_api::webPage> get_web_page_object(WebPageId web_page_id, bool force_small_media,
|
||||||
|
bool force_large_media) const;
|
||||||
|
|
||||||
tl_object_ptr<td_api::webPageInstantView> get_web_page_instant_view_object(WebPageId web_page_id) const;
|
tl_object_ptr<td_api::webPageInstantView> get_web_page_instant_view_object(WebPageId web_page_id) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user