Add view button to channel boost link previews.

This commit is contained in:
John Preston 2023-09-15 21:22:39 +04:00
parent 7828a92f08
commit c5634580f6
4 changed files with 7 additions and 0 deletions

View File

@ -3875,6 +3875,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_view_button_voice_chat_channel" = "Live stream";
"lng_view_button_request_join" = "Request to Join";
"lng_view_button_external_link" = "Open link";
"lng_view_button_boost" = "Boost";
"lng_sponsored_hide_ads" = "Hide";
"lng_sponsored_title" = "What are sponsored messages?";

View File

@ -176,6 +176,8 @@ WebPageType ParseWebPageType(
return WebPageType::User;
} else if (type == u"telegram_botapp"_q) {
return WebPageType::BotApp;
} else if (type == u"telegram_channel_boost"_q) {
return WebPageType::ChannelBoost;
} else if (hasIV) {
return WebPageType::ArticleWithIV;
} else {

View File

@ -23,6 +23,7 @@ enum class WebPageType {
GroupWithRequest,
Channel,
ChannelWithRequest,
ChannelBoost,
Photo,
Video,

View File

@ -68,6 +68,8 @@ inline auto WebPageToPhrase(not_null<WebPageData*> webpage) {
: (type == WebPageType::GroupWithRequest
|| type == WebPageType::ChannelWithRequest)
? tr::lng_view_button_request_join(tr::now)
: (type == WebPageType::ChannelBoost)
? tr::lng_view_button_boost(tr::now)
: (type == WebPageType::VoiceChat)
? tr::lng_view_button_voice_chat(tr::now)
: (type == WebPageType::Livestream)
@ -177,6 +179,7 @@ bool ViewButton::MediaHasViewButton(
return (type == WebPageType::Message)
|| (type == WebPageType::Group)
|| (type == WebPageType::Channel)
|| (type == WebPageType::ChannelBoost)
// || (type == WebPageType::Bot)
|| (type == WebPageType::User)
|| (type == WebPageType::VoiceChat)