Page MenuHomePhabricator

[native] introudce selectMultipleEmojis and alreadySelectedEmojis to EmojiKeyboard component
ClosedPublic

Authored by ginsu on Jun 21 2023, 3:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 3, 1:49 AM
Unknown Object (File)
Thu, Oct 3, 1:49 AM
Unknown Object (File)
Thu, Oct 3, 1:49 AM
Unknown Object (File)
Thu, Oct 3, 1:49 AM
Unknown Object (File)
Thu, Oct 3, 1:48 AM
Unknown Object (File)
Thu, Oct 3, 1:44 AM
Unknown Object (File)
Thu, Sep 26, 6:48 PM
Unknown Object (File)
Thu, Sep 26, 6:48 PM
Subscribers

Details

Summary

This diff is the first part to highlight the already selected emojis to indicate on the emoji keyboard what emojis the user has already selected. This diff handles the case when selectMultipleEmojis is equal to false and the next diff will handle the case when selectMultipleEmojis is equal to true

The big obstacle I had to overcome to build this was that the selectedEmojis prop needs to be an array of emoji names and we only store the actual emoji in our database. To overcome this obstacle I index the emojiData by the emoji so that we can easily grab the correct emoji name and pass it into the selectedEmojis prop.

Here is a link to an example to the docs that helped me with this implementation:
https://thewidlarzgroup.github.io/rn-emoji-keyboard/docs/documentation/Examples/selected_emojis

Linear Task: https://linear.app/comm/issue/ENG-3794/mobile-emoji-keyboard-highlight-emojis-that-a-user-has-already

Depends on D8282

Test Plan

Please watch the demo video below:

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Jun 21 2023, 3:36 PM
ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, kamil.
ginsu added inline comments.
native/chat/multimedia-message-tooltip-button.react.js
155

This is just a placeholder, the very next diff will address this

native/chat/robotext-message-tooltip-button.react.js
138

This is just a placeholder, the very next diff will address this

native/chat/text-message-tooltip-button.react.js
152

This is just a placeholder, the very next diff will address this

native/components/emoji-keyboard.react.js
9

Unfortunately, we can't import emojisData from rn-emoji-keyboard so we need to import it directly from the file. I have been in contact with the team at rn-emoji-keyboard and they are taking a look at improving this in the near future

27

Here is what the emojiData looks like:

Screenshot 2023-06-21 at 3.31.25 PM.png (1×1 px, 172 KB)

We want to first flatten the array so that we only have a one level array that is just the data field all combined together. After we do that we can key the data by the emoji field so that we can easily index and get the name field from the emoji

63

The next diff will add more cases for when selectMultipleEmojis is equal to true

This revision is now accepted and ready to land.Jun 22 2023, 4:19 AM
ginsu edited the summary of this revision. (Show Details)

rebase/address merge conflict

This revision was landed with ongoing or failed builds.Jun 23 2023, 1:10 PM
This revision was automatically updated to reflect the committed changes.