2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add IV icon to the button.

This commit is contained in:
John Preston
2024-03-12 17:56:42 +04:00
parent 7b4adc2e60
commit d43f0be0da
9 changed files with 95 additions and 29 deletions

View File

@@ -3544,9 +3544,13 @@ void Session::webpageApplyFields(
process(block, process);
}
}
const auto type = story ? WebPageType::Story : ParseWebPageType(data);
auto iv = (data.vcached_page() && !IgnoreIv(type))
? std::make_unique<Iv::Data>(data, *data.vcached_page())
: nullptr;
webpageApplyFields(
page,
(story ? WebPageType::Story : ParseWebPageType(data)),
type,
qs(data.vurl()),
qs(data.vdisplay_url()),
siteName,
@@ -3564,9 +3568,7 @@ void Session::webpageApplyFields(
? processDocument(*document).get()
: lookupThemeDocument()),
WebPageCollage(this, data),
(data.vcached_page()
? std::make_unique<Iv::Data>(data, *data.vcached_page())
: nullptr),
std::move(iv),
data.vduration().value_or_empty(),
qs(data.vauthor().value_or_empty()),
data.is_has_large_media(),

View File

@@ -171,6 +171,10 @@ WebPageType ParseWebPageType(
}
}
bool IgnoreIv(WebPageType type) {
return (type == WebPageType::Message);
}
WebPageType ParseWebPageType(const MTPDwebPage &page) {
return ParseWebPageType(
qs(page.vtype().value_or_empty()),

View File

@@ -53,6 +53,7 @@ enum class WebPageType : uint8 {
Livestream,
};
[[nodiscard]] WebPageType ParseWebPageType(const MTPDwebPage &type);
[[nodiscard]] bool IgnoreIv(WebPageType type);
struct WebPageCollage {
using Item = std::variant<PhotoData*, DocumentData*>;