App: [$500] Auto complete emojis does not pop up if a letter with tilde in spanish

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.54-0 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 Expensify/Expensify Issue URL: Issue reported by: @iwiznia Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1710785038489889

Action Performed:

  1. Go to staging.expensify.com and sign in
  2. Switch language to Spanish
  3. Open any chat
  4. Type any emoji name which has tilde like (:corazón:) in the composer or search for emoji in the emoji picker

Expected Result:

Should auto complete in composer field or show the results in the emoji picker.

Actual Result:

Does not auto complete in composer and no results found in emoji picker. Not treating o and ó as same

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence Screen Shot 2024-03-18 at 8 02 16 PM

https://github.com/Expensify/App/assets/38435837/bcfdfc7a-7f6f-43b4-9c91-c89d06fd8268

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01191fbf64d1245a9f
  • Upwork Job ID: 1771230550663888896
  • Last Price Increase: 2024-03-22
  • Automatic offers:
    • tienifr | Contributor | 0

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

@iwiznia @thesahindia About the feasibility of using localeCompare:

  1. localeCompare only indicates the equality of 2 strings. And that’s the abstraction, Intl does not expose any method to nomarlize/remove the locale characters
  2. The current implementation of Trie uses exact match by key which does not allow any custom compare/search function. We can implement that but it would increase the algorithm complexity from O(1) to O(n) considering the search operation:

https://github.com/Expensify/App/blob/ed7029b33c5711736569aea8981e21fc68e12d89/src/libs/Trie/index.ts#L49

  1. In some places like getStyledTextArray we must find the exact location of the substring withing the emoji name and as 1️⃣ pointed out, we couldn’t do it with localeCompare:

https://github.com/Expensify/App/blob/ed7029b33c5711736569aea8981e21fc68e12d89/src/libs/GetStyledTextArray.ts#L11

In conclusion, using localeCompare is not feasible considering the large tradeoffs in 2️⃣ and the requirement in 3️⃣. I only found this while implementing with localeCompare. Additionally, the custom normalize logic has already been used in App for a very long time without any problem so I think we can safely reuse it:

https://github.com/Expensify/App/blob/ed7029b33c5711736569aea8981e21fc68e12d89/src/libs/ReportUtils.ts#L1578-L1581

@thesahindia can you review @tienifr’s updated proposal?

Yes it looks good to me!