Add td_api::linkPreviewTypeVideoChat.

This commit is contained in:
levlam 2024-07-03 17:44:20 +03:00
parent 2ae48540b1
commit 8d6cb39a8e
2 changed files with 13 additions and 0 deletions

View File

@ -2571,6 +2571,11 @@ linkPreviewTypeStory story_sender_chat_id:int53 story_id:int32 = LinkPreviewType
//@description The link is a link to a cloud theme. TDLib has no theme support yet @documents The list of files with theme description
linkPreviewTypeTheme documents:vector<document> = LinkPreviewType;
//@description The link is a link to a video chat
//@photo Photo of the chat with the video chat; may be null if none
//@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group
linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType;
//@description The link preview type is unsupported yet @type String type of the link preview. Can be: article, photo, audio, video, document, profile, app, or something else
linkPreviewTypeOther type:string = LinkPreviewType;

View File

@ -1349,6 +1349,10 @@ td_api::object_ptr<td_api::LinkPreviewType> WebPagesManager::get_link_preview_ty
if (type == "giftcode") {
return td_api::make_object<td_api::linkPreviewTypePremiumGiftCode>();
}
if (type == "livestream") {
return td_api::make_object<td_api::linkPreviewTypeVideoChat>(
get_chat_photo_object(td_->file_manager_.get(), web_page->photo_), true);
}
if (type == "stickerset") {
auto stickers = transform(web_page->sticker_ids_, [&](FileId sticker_id) {
return td_->stickers_manager_->get_sticker_object(sticker_id);
@ -1378,6 +1382,10 @@ td_api::object_ptr<td_api::LinkPreviewType> WebPagesManager::get_link_preview_ty
// TODO add theme settings
return td_api::make_object<td_api::linkPreviewTypeTheme>(std::move(documents));
}
if (type == "videochat") {
return td_api::make_object<td_api::linkPreviewTypeVideoChat>(
get_chat_photo_object(td_->file_manager_.get(), web_page->photo_), false);
}
}
// TODO LOG(ERROR) << "Receive link preview of unsupported type " << web_page->type_;
return td_api::make_object<td_api::linkPreviewTypeOther>(web_page->type_);