mirror of
https://github.com/uowuo/abaddon.git
synced 2025-03-04 03:03:16 -05:00
show animated reactions
This commit is contained in:
parent
4774711f52
commit
5703d06c73
@ -620,7 +620,11 @@ Gtk::Widget *ChatMessageItemContainer::CreateReactionsComponent(const Message &d
|
||||
} else { // custom
|
||||
ev->set_tooltip_text(reaction.Emoji.Name);
|
||||
|
||||
auto img = Gtk::manage(new LazyImage(reaction.Emoji.GetURL(), 16, 16));
|
||||
auto *img = Gtk::make_managed<LazyImage>(reaction.Emoji.GetURL(), 16, 16);
|
||||
if (reaction.Emoji.IsEmojiAnimated() && Abaddon::Get().GetSettings().ShowAnimations) {
|
||||
img->SetURL(reaction.Emoji.GetURL("gif"));
|
||||
img->SetAnimated(true);
|
||||
}
|
||||
img->set_can_focus(false);
|
||||
box->add(*img);
|
||||
}
|
||||
|
@ -49,3 +49,7 @@ std::string EmojiData::URLFromID(Snowflake emoji_id, const char *ext, const char
|
||||
std::string EmojiData::URLFromID(const Glib::ustring &emoji_id, const char *ext, const char *size) {
|
||||
return URLFromID(emoji_id.raw(), ext, size);
|
||||
}
|
||||
|
||||
bool EmojiData::IsEmojiAnimated() const noexcept {
|
||||
return IsAnimated.has_value() && *IsAnimated;
|
||||
}
|
||||
|
@ -22,4 +22,6 @@ struct EmojiData {
|
||||
static std::string URLFromID(const std::string &emoji_id, const char *ext = "png", const char *size = nullptr);
|
||||
static std::string URLFromID(Snowflake emoji_id, const char *ext = "png", const char *size = nullptr);
|
||||
static std::string URLFromID(const Glib::ustring &emoji_id, const char *ext = "png", const char *size = nullptr);
|
||||
|
||||
bool IsEmojiAnimated() const noexcept;
|
||||
};
|
||||
|
@ -1056,11 +1056,12 @@ Message Store::GetMessageBound(std::unique_ptr<Statement> &s) const {
|
||||
while (s->FetchOne()) {
|
||||
size_t idx;
|
||||
ReactionData q;
|
||||
s->Get(0, q.Emoji.ID);
|
||||
s->Get(1, q.Emoji.Name);
|
||||
s->Get(2, q.Count);
|
||||
s->Get(3, q.HasReactedWith);
|
||||
s->Get(4, idx);
|
||||
s->Get(0, q.Count);
|
||||
s->Get(1, q.HasReactedWith);
|
||||
s->Get(2, idx);
|
||||
s->Get(3, q.Emoji.ID);
|
||||
s->Get(4, q.Emoji.Name);
|
||||
s->Get(5, q.Emoji.IsAnimated);
|
||||
tmp[idx] = q;
|
||||
}
|
||||
s->Reset();
|
||||
@ -2291,7 +2292,19 @@ bool Store::CreateStatements() {
|
||||
}
|
||||
|
||||
m_stmt_get_reactions = std::make_unique<Statement>(m_db, R"(
|
||||
SELECT emoji_id, name, count, me, idx FROM reactions WHERE message = ?
|
||||
SELECT
|
||||
reactions.count,
|
||||
reactions.me,
|
||||
reactions.idx,
|
||||
emojis.id,
|
||||
emojis.name,
|
||||
emojis.animated
|
||||
FROM
|
||||
reactions
|
||||
INNER JOIN
|
||||
emojis ON reactions.emoji_id = emojis.id
|
||||
WHERE
|
||||
message = ?
|
||||
)");
|
||||
if (!m_stmt_get_reactions->OK()) {
|
||||
fprintf(stderr, "failed to prepare get reactions statement: %s\n", m_db.ErrStr());
|
||||
|
Loading…
Reference in New Issue
Block a user