mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Replaced sticker set box with foreground preview on custom emoji click.
This commit is contained in:
@@ -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**.";
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace HistoryView {
|
||||
bool ShowReactionPreview(
|
||||
not_null<Window::SessionController*> 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<Ui::FlatLabel>(
|
||||
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();
|
||||
|
||||
@@ -17,9 +17,10 @@ class SessionController;
|
||||
|
||||
namespace HistoryView {
|
||||
|
||||
[[nodiscard]] bool ShowReactionPreview(
|
||||
bool ShowReactionPreview(
|
||||
not_null<Window::SessionController*> controller,
|
||||
FullMsgId origin,
|
||||
Data::ReactionId reactionId);
|
||||
Data::ReactionId reactionId,
|
||||
bool emojiPreview = false);
|
||||
|
||||
} // namespace HistoryView
|
||||
|
||||
@@ -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<Element*> 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user