Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of animated stickers and emojis #429

Merged
merged 3 commits into from
Mar 26, 2023

Conversation

yuraiz
Copy link
Contributor

@yuraiz yuraiz commented Jan 17, 2023

animatons.webm

Features:

  • sticker loading preview (moved to Add vector path for stickers #470)
  • animated stickers
  • animated emojis
  • premium emojis are looped, but default arent
  • play animated emoji on click

@melix99
Copy link
Collaborator

melix99 commented Jan 17, 2023

Looks like the first two commits need to be squashed?

@yuraiz
Copy link
Contributor Author

yuraiz commented Jan 17, 2023

Oops, looks like it's better to squash all commits

@melix99
Copy link
Collaborator

melix99 commented Jan 17, 2023

Oops, looks like it's better to squash all commits

I mean, having 1 commit per feature/change is usually what I prefer and it makes reviewing PRs much easier.

@yuraiz
Copy link
Contributor Author

yuraiz commented Jan 17, 2023

Last commit also change sticker. And I don't sure how to separate them

@melix99
Copy link
Collaborator

melix99 commented Jan 17, 2023

Last commit also change sticker. And I don't sure how to separate them

You need to use git rebase for that. I highly suggest learning that to make reviewers life much easier :)

@yuraiz yuraiz force-pushed the animated-emojis branch 4 times, most recently from c9de911 to 668435d Compare January 17, 2023 16:05
@yuraiz
Copy link
Contributor Author

yuraiz commented Jan 17, 2023

I think features are separated ok now

@yuraiz yuraiz force-pushed the animated-emojis branch 2 times, most recently from 595aa2f to 0b910fc Compare January 21, 2023 18:09
src/session_manager.rs Outdated Show resolved Hide resolved
@yuraiz yuraiz force-pushed the animated-emojis branch 2 times, most recently from 2d3d01d to 4c4445c Compare February 6, 2023 09:38
@yuraiz yuraiz requested a review from melix99 February 6, 2023 09:58
@yuraiz yuraiz force-pushed the animated-emojis branch 6 times, most recently from 938b3a6 to edf97cd Compare February 13, 2023 08:31
@melix99
Copy link
Collaborator

melix99 commented Feb 13, 2023

This PR does a lot of stuff and the way you organized the commits makes it hard to review (you do one thing in one and then change everything in the other). For what I can see this PR does the following:

  • Adds Tgs support to MessageSticker
  • Adds VectorPath to show a preview while loading stickers
  • Adds support to MessageAnimatedEmoji message type
  • Adds the "click reaction" to animated emojis
  • Some unrelated stuff (cargo update, .editorconfig)

This is great, but I think that this is too much for a single PR. I would be glad if you split it at least in 2 parts (with good organized commits too).

Since the title of the PR is "Add support of animated stickers and emojis", do you mind only leaving the TGS support for stickers and MessageAnimatedEmoji support here, please? I think the rest can go in a separate PR for now.

src/session/content/chat_action_bar.rs Outdated Show resolved Hide resolved
src/session_manager.rs Show resolved Hide resolved
@melix99 melix99 added this to the Telegrand 0.1 milestone Mar 22, 2023
data/resources/ui/content-message-sticker.blp Outdated Show resolved Hide resolved
src/session/content/message_row/sticker.rs Outdated Show resolved Hide resolved
src/strings.rs Outdated Show resolved Hide resolved
src/session/content/message_row/sticker.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved
src/components/sticker.rs Outdated Show resolved Hide resolved

#[derive(Default)]
pub struct Sticker {
pub(super) message_id: Cell<i64>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I wrong or this property seems completely useless? Also, it doesn't make sense to have it anyway because if I understand correctly we're gonna use this widget outside of the messages as well (like for a sticker picker).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to check if widget isn't recycled after sticker is downloaded IIRC you have a similar check in MessageDocument

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah k, yeah that check is important. The problem is that I don't like the fact that it's placed in the generic component. Maybe it's better having a sync variant to load the sticker and still do the check in MessageSticker?

Comment on lines +146 to 171
match &sticker.full_type {
StickerFullType::CustomEmoji(data) if data.needs_repainting => {
self.add_css_class("needs-repainting")
}
_ => self.remove_css_class("needs-repainting"),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, I don't really get what this css class is for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check one of those packs: Emoticon Emoji, Outline Emoji, Animal Emoji

Those emojis can be either black or white dependent on theme, currently I'm using css to recolor them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screencast.from.2023-03-24.09-14-40.webm

src/components/sticker.rs Outdated Show resolved Hide resolved
@yuraiz yuraiz force-pushed the animated-emojis branch 2 times, most recently from 690463d to 1594cd5 Compare March 24, 2023 06:10
@yuraiz yuraiz requested a review from melix99 March 24, 2023 06:10
@yuraiz yuraiz force-pushed the animated-emojis branch 2 times, most recently from 0ba99ce to cf568ed Compare March 26, 2023 19:44
@melix99 melix99 enabled auto-merge March 26, 2023 20:30
@melix99 melix99 merged commit fcf312f into paper-plane-developers:main Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants