From a22f6c28d6abd67bea966f7d698c88650103ca7e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 15 Feb 2026 12:34:05 +0300 Subject: [PATCH] Replaced sticker set box with foreground preview on custom emoji click. --- Telegram/Resources/langs/lang.strings | 1 + .../history/view/history_view_reaction_preview.cpp | 13 ++++++++----- .../history/view/history_view_reaction_preview.h | 5 +++-- .../history/view/history_view_text_helper.cpp | 9 ++++++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 3347e99365..62abc5f3b8 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4989,6 +4989,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_animated_emoji_many#one" = "This message contains emoji from **{count} pack**."; "lng_context_animated_emoji_many#other" = "This message contains emoji from **{count} packs**."; "lng_context_animated_reaction" = "This reaction is from the **{name}** pack."; +"lng_context_animated_emoji_preview" = "This emoji is from the **{name}** pack."; "lng_context_animated_tag" = "This tag is from **{name} pack**."; "lng_context_animated_reactions" = "Reactions contain emoji from **{name} pack**."; "lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**."; diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp index 74d7fc4935..e987cc7703 100644 --- a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp @@ -35,7 +35,8 @@ namespace HistoryView { bool ShowReactionPreview( not_null controller, FullMsgId origin, - Data::ReactionId reactionId) { + Data::ReactionId reactionId, + bool emojiPreview) { auto document = (DocumentData*)(nullptr); if (const auto custom = reactionId.custom()) { document = controller->session().data().document(custom); @@ -112,10 +113,12 @@ bool ShowReactionPreview( }); state->label = base::make_unique_q( state->background.get(), - tr::lng_context_animated_reaction( - lt_name, - rpl::single(Ui::Text::Colorized(packName)), - tr::rich)); + (emojiPreview + ? tr::lng_context_animated_emoji_preview + : tr::lng_context_animated_reaction)( + lt_name, + rpl::single(Ui::Text::Colorized(packName)), + tr::rich)); state->label->setAttribute(Qt::WA_TransparentForMouseEvents); const auto backgroundRaw = state->background.get(); const auto labelRaw = state->label.get(); diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.h b/Telegram/SourceFiles/history/view/history_view_reaction_preview.h index daf6664ccb..fc7ad5d8fd 100644 --- a/Telegram/SourceFiles/history/view/history_view_reaction_preview.h +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.h @@ -17,9 +17,10 @@ class SessionController; namespace HistoryView { -[[nodiscard]] bool ShowReactionPreview( +bool ShowReactionPreview( not_null controller, FullMsgId origin, - Data::ReactionId reactionId); + Data::ReactionId reactionId, + bool emojiPreview = false); } // namespace HistoryView diff --git a/Telegram/SourceFiles/history/view/history_view_text_helper.cpp b/Telegram/SourceFiles/history/view/history_view_text_helper.cpp index 4fe5af1c39..5465ddf487 100644 --- a/Telegram/SourceFiles/history/view/history_view_text_helper.cpp +++ b/Telegram/SourceFiles/history/view/history_view_text_helper.cpp @@ -7,12 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "history/view/history_view_text_helper.h" -#include "boxes/sticker_set_box.h" #include "core/click_handler_types.h" #include "data/data_document.h" #include "data/data_session.h" #include "data/stickers/data_custom_emoji.h" #include "history/view/history_view_element.h" +#include "history/view/history_view_reaction_preview.h" #include "history/history.h" #include "main/main_session.h" #include "window/window_session_controller.h" @@ -57,8 +57,11 @@ void InitElementTextPart(not_null view, Ui::Text::String &text) { if (const auto controller = my.sessionWindow.get()) { const auto documentId = Data::ParseCustomEmojiData(entityData); if (documentId) { - const auto document = controller->session().data().document(documentId); - StickerSetBox::Show(controller->uiShow(), document, documentId); + ShowReactionPreview( + controller, + my.itemId, + Data::ReactionId{ documentId }, + true); } } });