Add td_api::linkPreviewTypeAnimation.

This commit is contained in:
levlam 2024-07-04 16:11:51 +03:00
parent 74249b7176
commit 5c4ccdb1d6
2 changed files with 15 additions and 0 deletions

View File

@ -2553,6 +2553,9 @@ webPageInstantView page_blocks:vector<PageBlock> view_count:int32 version:int32
//@class LinkPreviewType @description Describes type of a link preview
//@description The link is a link to an animation @animation The animation @author Author of the animation
linkPreviewTypeAnimation animation:animation author:string = LinkPreviewType;
//@description The link is a link to an app at App Store or Google Play @photo Photo for the app @author Author of the app
linkPreviewTypeApp photo:photo author:string = LinkPreviewType;

View File

@ -1469,6 +1469,18 @@ td_api::object_ptr<td_api::LinkPreviewType> WebPagesManager::get_link_preview_ty
return td_api::make_object<td_api::linkPreviewTypeApp>(get_photo_object(td_->file_manager_.get(), web_page->photo_),
web_page->author_);
}
if (web_page->type_ == "gif" ||
(web_page->document_.type == Document::Type::Animation && web_page->type_ == "document")) {
auto animation = web_page->document_.type == Document::Type::Animation
? td_->animations_manager_->get_animation_object(web_page->document_.file_id)
: nullptr;
if (animation != nullptr) {
return td_api::make_object<td_api::linkPreviewTypeAnimation>(std::move(animation), web_page->author_);
} else {
LOG(ERROR) << "Receive animation without animation for " << web_page->url_;
return td_api::make_object<td_api::linkPreviewTypeUnsupported>();
}
}
if (web_page->type_ == "photo") {
auto photo = get_photo_object(td_->file_manager_.get(), web_page->photo_);
if (photo != nullptr) {