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

Upgrade Emojibase and Add emoticon variations #21

Merged
merged 9 commits into from
Oct 4, 2024

Conversation

langleyd
Copy link
Collaborator

@langleyd langleyd commented Oct 2, 2024

What's in this PR

  • Updates emojibase to 15.3.1 so that we can use their utility generateEmoticonPermutations to generate variations of plain text emoticons(e.g. with or without nose :) :-)).
  • Adds an explicit MAX_EMOJI_VERSION_WEB to filter out newer emojis from inclusion as web is not ready to upgrade yet (it needs to be upgraded in unison with twemoji (which is awkward and beyond the scope of this PR)
  • It also adds MAX_EMOJI_VERSION_ANDROID and MAX_EMOJI_VERSION_IOS to the script that generates the emojibase.json for those platforms so that they can move forward.

@langleyd langleyd requested review from a team and florianduros and removed request for a team October 2, 2024 14:50
@pixlwave
Copy link
Member

pixlwave commented Oct 2, 2024

Dropping in uninvited to ask an important question!

Adds an explicit MAX_EMOJI_VERSION to filter out newer emojis from inclusion as web is not ready to upgrade yet

Does this work per platform? Apple supports 15.1 and I'd love to get the 🙂‍↕️ and 🙂‍↔️ reactions on iOS if we could 😇

@langleyd
Copy link
Collaborator Author

langleyd commented Oct 2, 2024

@pixlwave yea we could probably load it via an env variable. Will take a look.

@pixlwave
Copy link
Member

pixlwave commented Oct 2, 2024

Amazing, thank you! 🙌

@langleyd langleyd requested a review from pixlwave October 2, 2024 20:23
@langleyd langleyd changed the title Add emoticon variations Upgrade Emojibase and Add emoticon variations Oct 2, 2024
@langleyd langleyd requested a review from bmarty October 2, 2024 20:24
@langleyd
Copy link
Collaborator Author

langleyd commented Oct 2, 2024

@bmarty We've split out the max emoji version per platform as per the PR description.

Would you(Android) like add emoji 15.1 support similar to iOS? (Web needs to stay on 15.0 for now).

src/emoji.ts Outdated
Comment on lines 29 to 32
for (const [versionString, emojis] of Object.entries(VERSIONS)) {
const version = parseFloat(versionString);
emojis.forEach((emoji) => EMOJI_TO_VERSION.set(emoji, version));
}

Choose a reason for hiding this comment

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

A comment is welcomed to explain why we need it

//flatten, in case `emoji.emoticon` is an array
.flat()
.flatMap((x) => generateEmoticonPermutations(x));
emoticons.forEach((x) => EMOTICON_TO_EMOJI.set(x, emoji));

Choose a reason for hiding this comment

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

It's feel wrong to me to mutate a map/array when doing a map another array.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, true I found that strange also, I wasn't too comfortable making those logic changes before as there wasn't much tests but we have that now :). Will move the logic that isn't related to the map out to a foreach so it's a bit clearer.

Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

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

Looks great from the iOS perspective, thanks for the update 👏

@langleyd
Copy link
Collaborator Author

langleyd commented Oct 4, 2024

Confirmed with Android team they want to move to 15.1.

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