From 3ccc567e04cc3aa2b9aac06eeafc406e95b9f989 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 15 Jul 2022 12:45:44 +0300 Subject: [PATCH] Add animated emoji premium preview. --- Telegram/Resources/langs/lang.strings | 7 +++++++ Telegram/SourceFiles/boxes/premium_preview_box.cpp | 8 +++++++- Telegram/SourceFiles/boxes/premium_preview_box.h | 1 + Telegram/SourceFiles/chat_helpers/chat_helpers.style | 2 +- Telegram/SourceFiles/settings/settings_premium.cpp | 9 +++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 1ce06b762..84039f797 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -232,6 +232,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_sticker_premium_text" = "This pack contains premium stickers like this one."; "lng_sticker_premium_view" = "View"; +"lng_animated_emoji_text" = "Subscribe to **Telegram Premium** to unlock this emoji."; "lng_reaction_premium_info" = "Click on the reaction to preview the animation."; "lng_reaction_premium_no_group" = "Some reactions are restricted in this group."; "lng_reaction_premium_no_channel" = "Some reactions are restricted in this channel."; @@ -1692,6 +1693,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_premium_more_about" = "More About Telegram Premium"; "lng_premium_unlock_reactions" = "Unlock Premium Reactions"; "lng_premium_unlock_stickers" = "Unlock Premium Stickers"; +"lng_premium_unlock_emoji" = "Unlock Animated Emoji"; "lng_premium_summary_title" = "Telegram Premium"; "lng_premium_summary_top_about" = "Go **beyond the limits**, get **exclusive features** and support us by subscribing to **Telegram Premium**."; @@ -1710,6 +1712,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_premium_summary_about_unique_reactions" = "Additional animated reactions on messages available only to the Premium subscribers."; "lng_premium_summary_subtitle_premium_stickers" = "Premium Stickers"; "lng_premium_summary_about_premium_stickers" = "Exclusive enlarged stickers featuring additional effects, updated monthly."; +"lng_premium_summary_subtitle_animated_emoji" = "Animated Emoji"; +"lng_premium_summary_about_animated_emoji" = "Include animated emoji from different emoji sets in any message you send."; "lng_premium_summary_subtitle_advanced_chat_management" = "Advanced Chat Management"; "lng_premium_summary_about_advanced_chat_management" = "Tools to set default folder, auto-archive and hide new chats from non-contacts."; "lng_premium_summary_subtitle_profile_badge" = "Profile Badge"; @@ -2143,6 +2147,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_delete_all_files" = "Delete all files"; "lng_context_save_custom_sound" = "Save for notifications"; +"lng_context_animated_emoji" = "This message contains emoji from {name} pack."; +"lng_context_animated_emoji_many" = "This message contains emoji from {name} packs."; + "lng_downloads_section" = "Downloads"; "lng_downloads_view_in_chat" = "View in chat"; "lng_downloads_view_in_section" = "View in downloads"; diff --git a/Telegram/SourceFiles/boxes/premium_preview_box.cpp b/Telegram/SourceFiles/boxes/premium_preview_box.cpp index b2f02b720..d74fb3fbd 100644 --- a/Telegram/SourceFiles/boxes/premium_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_preview_box.cpp @@ -122,6 +122,8 @@ void PreloadSticker(const std::shared_ptr &media) { return tr::lng_premium_summary_subtitle_unique_reactions(); case PremiumPreview::Stickers: return tr::lng_premium_summary_subtitle_premium_stickers(); + case PremiumPreview::AnimatedEmoji: + return tr::lng_premium_summary_subtitle_animated_emoji(); case PremiumPreview::AdvancedChatManagement: return tr::lng_premium_summary_subtitle_advanced_chat_management(); case PremiumPreview::ProfileBadge: @@ -146,6 +148,8 @@ void PreloadSticker(const std::shared_ptr &media) { return tr::lng_premium_summary_about_unique_reactions(); case PremiumPreview::Stickers: return tr::lng_premium_summary_about_premium_stickers(); + case PremiumPreview::AnimatedEmoji: + return tr::lng_premium_summary_about_animated_emoji(); case PremiumPreview::AdvancedChatManagement: return tr::lng_premium_summary_about_advanced_chat_management(); case PremiumPreview::ProfileBadge: @@ -443,7 +447,8 @@ struct VideoPreviewDocument { [[nodiscard]] bool VideoAlignToTop(PremiumPreview section) { return (section == PremiumPreview::MoreUpload) - || (section == PremiumPreview::NoAds); + || (section == PremiumPreview::NoAds) + || (section == PremiumPreview::AnimatedEmoji); } [[nodiscard]] DocumentData *LookupVideo( @@ -455,6 +460,7 @@ struct VideoPreviewDocument { case PremiumPreview::FasterDownload: return "faster_download"; case PremiumPreview::VoiceToText: return "voice_to_text"; case PremiumPreview::NoAds: return "no_ads"; + case PremiumPreview::AnimatedEmoji: return "animated_emoji"; case PremiumPreview::AdvancedChatManagement: return "advanced_chat_management"; case PremiumPreview::ProfileBadge: return "profile_badge"; diff --git a/Telegram/SourceFiles/boxes/premium_preview_box.h b/Telegram/SourceFiles/boxes/premium_preview_box.h index 0cd6fa341..1c242ebc8 100644 --- a/Telegram/SourceFiles/boxes/premium_preview_box.h +++ b/Telegram/SourceFiles/boxes/premium_preview_box.h @@ -36,6 +36,7 @@ enum class PremiumPreview { NoAds, Reactions, Stickers, + AnimatedEmoji, AdvancedChatManagement, ProfileBadge, AnimatedUserpics, diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 36d059b0e..1d1b04e0e 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -179,7 +179,7 @@ emojiSwitchColor: windowActiveTextFg; emojiSwitchStickers: icon {{ "emoji/emoji_switch", emojiSwitchColor }}; emojiSwitchEmoji: icon {{ "emoji/emoji_switch-flip_horizontal", emojiSwitchColor }}; -emojiIconPadding: 8px; +emojiIconPadding: 7px; emojiIconSelectSkip: 3px; hashtagClose: IconButton { diff --git a/Telegram/SourceFiles/settings/settings_premium.cpp b/Telegram/SourceFiles/settings/settings_premium.cpp index 3afde7749..a172958e2 100644 --- a/Telegram/SourceFiles/settings/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/settings_premium.cpp @@ -143,6 +143,15 @@ using Order = std::vector; PremiumPreview::Stickers, }, }, + { + u"animated_emoji"_q, + Entry{ + &st::settingsIconEmoji, + tr::lng_premium_summary_subtitle_animated_emoji(), + tr::lng_premium_summary_about_animated_emoji(), + PremiumPreview::AnimatedEmoji, + }, + }, { u"advanced_chat_management"_q, Entry{