Allow sending videos with covers.

This commit is contained in:
John Preston
2025-01-29 09:24:01 +04:00
parent 6a415cf232
commit e05bb75b8a
42 changed files with 571 additions and 104 deletions
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_streaming.h"
#include "data/data_document_media.h"
#include "data/data_reply_preview.h"
#include "data/data_web_page.h"
#include "lang/lang_keys.h"
#include "inline_bots/inline_bot_layout_item.h"
#include "main/main_session.h"
@@ -1881,3 +1882,18 @@ void DocumentData::collectLocalData(not_null<DocumentData*> local) {
session().local().writeFileLocation(mediaKey(), _location);
}
}
PhotoData *LookupVideoCover(
not_null<DocumentData*> document,
HistoryItem *item) {
const auto media = item ? item->media() : nullptr;
if (const auto webpage = media ? media->webpage() : nullptr) {
if (webpage->document == document && webpage->photoIsVideoCover) {
return webpage->photo;
}
return nullptr;
}
return (media && media->document() == document)
? media->videoCover()
: nullptr;
}