Add WebPage.has_large_media.

This commit is contained in:
levlam 2023-10-16 16:02:18 +03:00
parent 84d628f05d
commit d261743f91
2 changed files with 9 additions and 2 deletions

View File

@ -2091,6 +2091,7 @@ webPageInstantView page_blocks:vector<PageBlock> view_count:int32 version:int32
//@embed_height Height of the embedded preview
//@duration Duration of the content, in seconds
//@author Author of the content
//@has_large_media True, if the preview has large media and its appearance can be changed
//@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
//@document Preview of the content as a document, if available; may be null
@ -2101,7 +2102,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_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
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 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 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

View File

@ -237,6 +237,7 @@ class WebPagesManager::WebPage {
Dimensions embed_dimensions_;
int32 duration_ = 0;
string author_;
bool has_large_media_ = false;
Document document_;
vector<Document> documents_;
vector<StoryFullId> story_full_ids_;
@ -280,6 +281,7 @@ class WebPagesManager::WebPage {
STORE_FLAG(is_instant_view_v2);
STORE_FLAG(has_documents);
STORE_FLAG(has_story_full_ids);
STORE_FLAG(has_large_media_);
END_STORE_FLAGS();
store(url_, storer);
@ -357,6 +359,7 @@ class WebPagesManager::WebPage {
PARSE_FLAG(is_instant_view_v2);
PARSE_FLAG(has_documents);
PARSE_FLAG(has_story_full_ids);
PARSE_FLAG(has_large_media_);
END_PARSE_FLAGS();
parse(url_, parser);
@ -417,7 +420,8 @@ class WebPagesManager::WebPage {
lhs.site_name_ == rhs.site_name_ && lhs.title_ == rhs.title_ && lhs.description_ == rhs.description_ &&
lhs.photo_ == rhs.photo_ && lhs.type_ == rhs.type_ && lhs.embed_url_ == rhs.embed_url_ &&
lhs.embed_type_ == rhs.embed_type_ && lhs.embed_dimensions_ == rhs.embed_dimensions_ &&
lhs.duration_ == rhs.duration_ && lhs.author_ == rhs.author_ && lhs.document_ == rhs.document_ &&
lhs.duration_ == rhs.duration_ && lhs.author_ == rhs.author_ &&
lhs.has_large_media_ == rhs.has_large_media_ && lhs.document_ == rhs.document_ &&
lhs.documents_ == rhs.documents_ && lhs.story_full_ids_ == rhs.story_full_ids_ &&
lhs.instant_view_.is_empty_ == rhs.instant_view_.is_empty_ &&
lhs.instant_view_.is_v2_ == rhs.instant_view_.is_v2_;
@ -522,6 +526,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
page->duration_ = 0;
}
page->author_ = std::move(web_page->author_);
page->has_large_media_ = web_page->has_large_media_;
if (web_page->document_ != nullptr) {
int32 document_id = web_page->document_->get_id();
if (document_id == telegram_api::document::ID) {
@ -1306,6 +1311,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_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->has_large_media_,
web_page->document_.type == Document::Type::Animation
? td_->animations_manager_->get_animation_object(web_page->document_.file_id)
: nullptr,