Skip to content

Conversation

jmartinesp
Copy link
Member

Content

  • Add AddRecentEmoji and GetRecentEmojis use cases to avoid injecting the whole MatrixClient for just one of these operations.
  • Update the UI and logic of the emoji picker and message context menu to include the recent emojis.
  • Add CoroutineDispatchers.Default with the defaults coroutines to use in the app for ease of use.

Motivation and context

Iterate on #5255, continue integrating the work done for the hackathon around temojis.

Screenshots / GIFs

image image

Then on Element Web for the same account:

image

Tests

  1. Long press on a message to open the message context menu.
  2. If you already used some emoji reactions in Element Web with that account, you should see the same emojis being displayed there. Otherwise, the default ones will be displayed.
  3. If you tap in the button to open the emoji picker and you have recent emoji reactions, you should now see a 'recents' tab with the items added in the same order.
  4. Adding a new emoji reaction should update the list. Removing one won't.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@jmartinesp jmartinesp requested a review from a team as a code owner September 24, 2025 07:33
@jmartinesp jmartinesp added the PR-Feature For a new feature label Sep 24, 2025
@jmartinesp jmartinesp requested review from ganfra and removed request for a team September 24, 2025 07:33
Copy link
Contributor

github-actions bot commented Sep 24, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/pjWZAb

@jmartinesp jmartinesp force-pushed the feat/shared-emoji-reactions branch from 28d8581 to 434b80e Compare September 24, 2025 08:11
@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Not tested, but one first comment

persistentListOf("👍️", "👎️", "🔥", "❤️", "👏")
} else {
recentEmojis.take(50)
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a product decision on this?
I think it can be improved, because before the user sends a very first reaction, they will see the 5 default emojis, and after they send a first one, it will be the only one in the list which is weird since it can be any random one.
Maybe we should always display the 5 default emojis after the list of the recent ones?

recentEmojis.take(50) + listOf("👍️", "👎️", "🔥", "❤️", "👏").filter { it !in recentEmojis }

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have a product decision on this?

Not really, I just kept the previous suggested emoji reactions for the default values.

Maybe we should always display the 5 default emojis after the list of the recent ones?

That's one option, but then it breaks the 1:1 match with EW this PR wanted to provide.

@mxandreas any opinion on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure I fully understand everything here (if it easy, perhaps re-state the question). But generally consistency with EW is key, unless EW's behavior is known to be problematic and should be improved.

Copy link
Member

Choose a reason for hiding this comment

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

You can't compare with Element Web, which has everything:

image

Copy link
Member

Choose a reason for hiding this comment

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

(this message was for Jorge)

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure I fully understand everything here (if it easy, perhaps re-state the question). But generally consistency with EW is key, unless EW's behavior is known to be problematic and should be improved.

When we don't have any recently used emojis, we suggest using any of these:

👍️    👎️   🔥    ❤️    👏

But then, once an emoji has been used (i.e. 🔹), the user will see just this for the suggested emoji reactions:

🔹

Which is a bit odd, but then they'd also see just that single suggested emoji in EW if I'm not mistaken. @bmarty proposes having this after the 1st emoji is used:

🔹    👍️    👎️   🔥    ❤️    👏

But then it wouldn't match EW.

Copy link
Member

Choose a reason for hiding this comment

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

For @mxandreas if I understand correctly the PR, when long clicking on any message, on an account that has not sent any reaction, user will see this:

image

and once a reaction 💩 will be sent, they will see this:

image

I propose that they always see the default reaction:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

It's true we can't really match EW 1:1 since we're using their 'quick actions' as the suggested ones, and then we'd want to replace them / add the recent ones to those, which on EW are 2 different sections. Maybe @bmarty 's suggestion is the best option. WDYT @mxandreas ? - sorry for pinging you so much on this topic, btw 😅.

Copy link

@spaetz spaetz Sep 25, 2025

Choose a reason for hiding this comment

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

Please, no :-). Imagine I used a few popular emojis, then I would see:
👍️ 🔥 👍️ 👎️ 🔥 ❤️ 👏
and other weird duplications, which looks incredibly clumsy.

Proposal: If getRecentEmojis is empty, prime the list once with setRecentEmojis.addEmoji('👍️') (or whatever the exact API is) and do this for 3-4 emojis. One could do this once on startup and be done with it or each time the emoji list is shown.
Will shut up now

Copy link
Member Author

Choose a reason for hiding this comment

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

In the end we're doing a mix: apparently, iOS was already using a concatenation of the suggested emojis + the recent emojis provided by the OS, removing duplicates. We'll do the same here, since there were some users who complained about the quick reactions changing too frequently with the recent emojis and they tapped the wrong emojis by muscle memory.

@jmartinesp jmartinesp marked this pull request as draft September 24, 2025 08:56
@jmartinesp jmartinesp force-pushed the feat/shared-emoji-reactions branch from bd26c6d to 8f1a629 Compare September 24, 2025 09:00
@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 24, 2025
@jmartinesp
Copy link
Member Author

There were some issues with recording screenshots, let's see if the latest changes fix them 🤞 .

- Add `AddRecentEmoji` and `GetRecentEmojis` use cases to avoid injecting the whole `MatrixClient` for just one of these operations.
- Update the UI and logic of the emoji picker and message context menu to include the recent emojis.
- Add `CoroutineDispatchers.Default` with the defaults coroutines to use in the app for ease of use.
@jmartinesp jmartinesp force-pushed the feat/shared-emoji-reactions branch from 7f744f1 to db1e2f3 Compare September 24, 2025 09:18
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 90.21739% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.38%. Comparing base (d391be7) to head (57405fa).
⚠️ Report is 52 commits behind head on develop.

Files with missing lines Patch % Lines
.../android/libraries/matrix/impl/RustMatrixClient.kt 0.00% 7 Missing ⚠️
...braries/matrix/api/recentemojis/GetRecentEmojis.kt 0.00% 6 Missing ⚠️
...c/main/kotlin/io/element/android/x/di/AppModule.kt 0.00% 1 Missing ⚠️
...es/messages/impl/actionlist/ActionListPresenter.kt 66.66% 0 Missing and 1 partial ⚠️
...ents/customreaction/picker/EmojiPickerPresenter.kt 95.65% 0 Missing and 1 partial ⚠️
...ibraries/matrix/api/recentemojis/AddRecentEmoji.kt 83.33% 1 Missing ⚠️
.../android/libraries/matrix/test/FakeMatrixClient.kt 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5402      +/-   ##
===========================================
+ Coverage    80.37%   80.38%   +0.01%     
===========================================
  Files         2282     2284       +2     
  Lines        63071    63150      +79     
  Branches      7887     7889       +2     
===========================================
+ Hits         50694    50764      +70     
- Misses        9464     9475      +11     
+ Partials      2913     2911       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jmartinesp jmartinesp force-pushed the feat/shared-emoji-reactions branch from 89a1bfd to b686f10 Compare September 25, 2025 11:40
@jmartinesp jmartinesp marked this pull request as ready for review September 25, 2025 12:12
@jmartinesp jmartinesp requested a review from bmarty September 25, 2025 14:39
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jmartinesp jmartinesp enabled auto-merge (squash) September 26, 2025 10:35
Copy link

@jmartinesp jmartinesp merged commit a8c4d5d into develop Sep 26, 2025
28 of 29 checks passed
@jmartinesp jmartinesp deleted the feat/shared-emoji-reactions branch September 26, 2025 11:04
andybalaam pushed a commit that referenced this pull request Sep 29, 2025
* Use shared recent emoji reactions from account data

- Add `AddRecentEmoji` and `GetRecentEmojis` use cases to avoid injecting the whole `MatrixClient` for just one of these operations.
- Update the UI and logic of the emoji picker and message context menu to include the recent emojis.
- Add `CoroutineDispatchers.Default` with the defaults coroutines to use in the app for ease of use.

* Instead of replacing suggested emojis, concatenate recent ones removing duplicates

* Update screenshots

---------

Co-authored-by: ElementBot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Feature For a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants