Closed kbecciv closed 1 year ago
Triggered auto assignment to @bfitzexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are β
)Chat - Not update frequently used emoji when pasting emoji into composer
When pasting emoji we don't have any logic to update frequently used emoji
In the updateComment
function, we only replace text to emoji (like :smile:
to π) and update frequently used emoji. If there are emojis in the comment like π we will not add them into frequently used emojis
The emojis in line 731 only contain emojis that is converted from text (like :smile:
)
we should get all emojis from the comment and update frequently used emoji. For example, if the comment is
hello `:smile:` oke π΅
We will update both π΅ and π to frequently used emoji list
Agreed that we should be updating the list of Frequently Used emojis for any emoji used, whether via the picker or paste.
Job added to Upwork: https://www.upwork.com/jobs/~0183125281d2c3d055
Triggered auto assignment to @jliexpensify (External
), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External
)
@dukenv0307 did you mark your comment https://github.com/Expensify/App/issues/21786#issuecomment-1612421841 as off-topic? Trying to determine whether that's a legit proposal or not.
I was about to ask the same question. Also,
we should get all emojis from the comment and update frequently used emoji.
How will we do that?
I was about to ask the same question. Also,
we should get all emojis from the comment and update frequently used emoji.
How will we do that?
I have experience any app yet where emoji from text are considered as frequently used.
Interesting, so this might be tricky from a technical perspective. I just tested in Slack and it doesn't update the most frequently used when pasting the emoji in from elsewhere.
The behaviour does work on iOS - I tested copying different emojis that weren't in the frequently used list from Notes into WhatsApp, FB Messenger, iMessage and Instagram messaging, and each time the frequently used list updated after pasting in the emoji and sending it. But that seems like an OS thing rather than an app thing - the emoji picker there carries across apps, rather than being app-specific.
@parasharrajat do you have an Android you can test the same on? I can test if not but it will take me a little longer to set up and sign into these apps to test.
Since iOS does do this somehow, I think we can leave this open to see if we can get any proposals that will be able to solve for it. If not, it's not a major thing and we can just close it out.
replaceEmojis
directly.const emojiMap = {
"π": {
name: "grinning",
code: "π",
keywords: ["smile", "happy", "grinning", "face", "grin"],
},
// ... rest emojis (this is made using `emojis.js`)
}
getEmojiCodeFromText
which will take unicode as input and return the emoji object from the map, in file EmojiUtils.js
.getEmojiCodeFromText
function in replaceEmojis
function to get the emojis from the text.replaceEmojis
function and update frequetly used emojis in Composer
's paste function.
paste(text) {
try {
document.execCommand('insertText', false, text);
this.updateNumberOfLines();
+ const {emojis = []} = EmojiUtils.replaceEmojis(text, this.props.preferredSkinTone);
+ if (!_.isEmpty(emojis)) {
+ User.updateFrequentlyUsedEmojis(EmojiUtils.getFrequentlyUsedEmojis(emojis));
+ }
// Pointer will go out of sight when a large paragraph is pasted on the web. Refocusing the input keeps the cursor in view.
this.textInput.blur();
this.textInput.focus();
// eslint-disable-next-line no-empty
} catch (e) {}
}
https://github.com/Expensify/App/assets/78416198/864c6179-ccef-4e71-8d5e-25050bc8e3f6
----- CHANGES LOG -------
getEmojiCodeFromText
.@bfitzexpensify I tested WhatsApp on Android and it does not update the emoji recently when we paste an emoji copied from a website.
@bfitzexpensify @parasharrajat - Any updates on my proposal ?
@parasharrajat Yes. I marked it as off because I think this seems to be a not enough good proposal.
@jeet-dhandha Although your proposal seems like it works, my mind is not fully convinced if that is the best solution.
Do you mind explaining all the scenarios where an emoji can be used in a composer and explaining what will be the outcome of all?
How will you handle emoji face tones?
Updated PROPOSAL : https://github.com/Expensify/App/issues/21786#issuecomment-1613176046
@parasharrajat
Do you mind explaining all the scenarios where an emoji can be used in a composer and explaining what will be the outcome of all? Emoji can be added by:
- Pasting Text
- Adding using Composer's emoji button.
- Could have been in draft before this change.
How will you handle emoji face tones?
Upto my knowledge we are just rendering them as different skin tone. But storing them in suggestion is based on the base code
only.
PS: I updated the proposal and also optimised the function to not loop through each text
, instead use regex
to get all the emojis and also use Set
to remove duplicates.
@parasharrajat Any thoughts on the above answer.
@parasharrajat, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Will update you.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@parasharrajat reminder to check https://github.com/Expensify/App/issues/21786#issuecomment-1615382576 when you get a moment - thanks!
Sure. I will. Need to test a few things on the App.
When we paste emojis they are not added to the frequently used emojis
We are not currently handling emojis that are pasted
In replaceEmojis before replacing the text by emojis here: https://github.com/Expensify/App/blob/60f48175c9e3342ef192d878218820e5ed5a76cd/src/libs/EmojiUtils.js#L279
we can add the already existing emojis to the array that we return like this:
_.forEach(allEmojis, (item) => {
if(text.includes(item.code)){
emojis.push({
name: item.name,
code: item.code,
types: item.types,
});
}
});
allEmojis being declared like this:
import {default as allEmojis} from '../../assets/emojis/common';
Then they will be added to the frequent emojis here: https://github.com/Expensify/App/blob/60f48175c9e3342ef192d878218820e5ed5a76cd/src/pages/home/report/ReportActionCompose.js#L756
Result:
https://github.com/Expensify/App/assets/19537677/71877a94-c950-43e1-9bf0-239edf53625a
For more clarity we could put this code in another function and then merge the two arrays before updating the frequent emojis
@parasharrajat, @bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Thanks for the proposal. Will check this tomorrow.
@parasharrajat @bfitzexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@parasharrajat looks like we have the updated proposal from @jeet-dhandha and also a proposal from @ShogunFire ready for review when you get a chance
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Expect an update tomorrow. I am done for today. Thanks.
@parasharrajat reminder to have a look here today when you get a chance, thank you!
I looked at a few things and I think we can go with @jeet-dhandha's proposal with following changes.
emojiCodeTable
.replaceEmoji
function. Instead get the emojis code in the parent function updateComment
and then pass both emojies array(the one we just got and one from replaceemoji) to the next line https://github.com/Expensify/App/blob/afb94208707a78583ddae88dd391f78423e917a3/src/pages/home/report/ReportActionCompose.js#L797.paste
event. Thanks @ShogunFire for the proposal. Although, your proposal is different the base idea is the same as the earlier proposal so I didn't see any reason to reject the existing proposals based on the choice of the construct.
:ribbon: :eyes: :ribbon: C+ reviewed
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Humm the base idea is the same maybe but I think my proposal adds a lot to @jeet-dhandha 's proposal who was doing complex and unecessary code. On the 4 points that you want to add to his proposal, 3 are in my proposal. Usually proposals are not accepted just because they have the base idea. I really think my proposal is better :/
@ShogunFire can you try copying these "πππ" emojis and pasting them in composer and check if that works or not.
Sorry I don't really have time right now and I don't know if that would change reviewers choice. But I don't see why that wouldn't work
@parasharrajat I found two places where we will need to make the change:
Also can we go with creating this common function such that there's not much change in the above given files.
Common Function
function replaceAndExtractEmojis(text, preferredSkinTone = CONST.EMOJI_DEFAULT_SKIN_TONE, lang = CONST.LOCALES.DEFAULT) {
const {text: newDraft = '', emojis = []} = replaceEmojis(text, preferredSkinTone, lang);
return {
text: newDraft,
emojis: emojis.concat(getEmojiCodeFromText(text)),
};
}
ReportActionCompose.js
const {text: newComment = '', emojis = []} =
- EmojiUtils.replaceEmojis(comment, this.props.preferredSkinTone, this.props.preferredLocale);
+ EmojiUtils.replaceAndExtractEmojis(comment, this.props.preferredSkinTone, this.props.preferredLocale);
const {text: newDraft = '', emojis = []} =
- EmojiUtils.replaceEmojis(newDraftInput, props.preferredSkinTone, props.preferredLocale);
+ EmojiUtils.replaceAndExtractEmojis(newDraftInput, props.preferredSkinTone, props.preferredLocale);
Also a question - Do we count frequently used emojis from Title's or Descriptions of Task or any other inputs ?
π£ @parasharrajat Please request via NewDot manual requests for the Reviewer role ($1000)
π£ @jeet-dhandha π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
π£ @dukenv0307 π An offer has been automatically sent to your Upwork account for the Reporter role π Thanks for contributing to the Expensify app!
Do we count frequently used emojis from Title's or Descriptions of Task or any other inputs ?
No I guess.
Then above changes should suffice.
Does this code looks good: https://github.com/Expensify/App/pull/23153
@parasharrajat Waiting for you to confirm.
Please put up a PR for review after testing everything and we can take care of the code during review.
That's Cool ππ
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
App should update frequent used emoji when pasting a emoji into composer
Actual Result:
App doesn't update frequent used emoji when pasting a emoji into composer
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.31-3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/93399543/f9878c06-82a1-41d3-affb-18914aa896a6
https://github.com/Expensify/App/assets/93399543/785c7782-1742-4d47-9ba4-0591ccb9ae6f
Expensify/Expensify Issue URL: Issue reported by: @dukenv0307 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1687744968139979
View all open jobs on GitHub
Upwork Automation - Do Not Edit