mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Animate emoji only twice in chats list.
This commit is contained in:
parent
6e606f3bb6
commit
991fe491c5
3 changed files with 12 additions and 1 deletions
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/click_handler_types.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "data/data_session.h"
|
||||
#include "ui/text/text_custom_emoji.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/emoji_config.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
@ -249,9 +250,15 @@ std::unique_ptr<Ui::Text::CustomEmoji> UiIntegration::createCustomEmoji(
|
|||
if (!my || !my->session) {
|
||||
return nullptr;
|
||||
}
|
||||
return my->session->data().customEmojiManager().create(
|
||||
auto result = my->session->data().customEmojiManager().create(
|
||||
data,
|
||||
my->customEmojiRepaint);
|
||||
if (my->customEmojiLoopLimit > 0) {
|
||||
return std::make_unique<Ui::Text::LimitedLoopsEmoji>(
|
||||
std::move(result),
|
||||
my->customEmojiLoopLimit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Fn<void()> UiIntegration::createSpoilerRepaint(const std::any &context) {
|
||||
|
|
|
@ -29,6 +29,7 @@ struct MarkedTextContext {
|
|||
Main::Session *session = nullptr;
|
||||
HashtagMentionType type = HashtagMentionType::Telegram;
|
||||
Fn<void()> customEmojiRepaint;
|
||||
int customEmojiLoopLimit = 0;
|
||||
};
|
||||
|
||||
class UiIntegration final : public Ui::Integration {
|
||||
|
|
|
@ -23,6 +23,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kEmojiLoopCount = 2;
|
||||
|
||||
template <ushort kTag>
|
||||
struct TextWithTagOffset {
|
||||
TextWithTagOffset(TextWithEntities text) : text(std::move(text)) {
|
||||
|
@ -142,6 +144,7 @@ void MessageView::prepare(
|
|||
const auto context = Core::MarkedTextContext{
|
||||
.session = &history->session(),
|
||||
.customEmojiRepaint = customEmojiRepaint,
|
||||
.customEmojiLoopLimit = kEmojiLoopCount,
|
||||
};
|
||||
const auto senderTill = (preview.arrowInTextPosition > 0)
|
||||
? preview.arrowInTextPosition
|
||||
|
|
Loading…
Add table
Reference in a new issue