mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Add non-MTP ParseWebPageType.
This commit is contained in:
parent
01c1096c62
commit
041c922451
1 changed files with 13 additions and 4 deletions
|
@ -134,9 +134,11 @@ WebPageCollage ExtractCollage(
|
|||
|
||||
} // namespace
|
||||
|
||||
WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
||||
const auto type = qs(page.vtype().value_or_empty());
|
||||
if (type == qstr("video") || page.vembed_url()) {
|
||||
WebPageType ParseWebPageType(
|
||||
const QString &type,
|
||||
const QString &embedUrl,
|
||||
bool hasIV) {
|
||||
if (type == qstr("video") || !embedUrl.isEmpty()) {
|
||||
return WebPageType::Video;
|
||||
} else if (type == qstr("photo")) {
|
||||
return WebPageType::Photo;
|
||||
|
@ -160,13 +162,20 @@ WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
|||
return WebPageType::Livestream;
|
||||
} else if (type == qstr("telegram_user")) {
|
||||
return WebPageType::User;
|
||||
} else if (page.vcached_page()) {
|
||||
} else if (hasIV) {
|
||||
return WebPageType::ArticleWithIV;
|
||||
} else {
|
||||
return WebPageType::Article;
|
||||
}
|
||||
}
|
||||
|
||||
WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
||||
return ParseWebPageType(
|
||||
qs(page.vtype().value_or_empty()),
|
||||
page.vembed_url().value_or_empty(),
|
||||
!!page.vcached_page());
|
||||
}
|
||||
|
||||
WebPageCollage::WebPageCollage(
|
||||
not_null<Data::Session*> owner,
|
||||
const MTPDwebPage &data)
|
||||
|
|
Loading…
Add table
Reference in a new issue