Skip to content

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Sep 15, 2025

Content

  • Allows MessageSummaryFormatter to create the summary based on the event content, not the whole event. This is needed because the thread summary info only contains the content.
  • Modifies several factories to follow these changes.
  • Makes the TimelineItemEventFactory calculate the text summary from the latest event from the thread.
  • Displays the new info in a ThreadSummaryView.
  • Extracts the message bubble helper functions for shape and color to MessageBubbleDefaults so they can be reused in that previous view.
  • Also makes sure the shape is only calculated when a reecomposition that would trigger a change happens, instead of for every recomposition.

Motivation and context

Implements the Android part of the designs for element-hq/element-meta#2771.

Screenshots / GIFs

In the PR.

Tests

Enable the 'Threads' feature flag, the navigate to a room with threads. Check the info from the summary is displayed correctly.

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

Copy link
Contributor

github-actions bot commented Sep 15, 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/oEZ7wK

Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 68.75000% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.37%. Comparing base (5cadd37) to head (bd8dd34).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...meline/factories/event/TimelineItemEventFactory.kt 21.05% 13 Missing and 2 partials ⚠️
...s/impl/timeline/components/TimelineItemEventRow.kt 86.15% 3 Missing and 6 partials ⚠️
...line/factories/event/TimelineItemContentFactory.kt 66.66% 7 Missing ⚠️
...aries/eventformatter/api/TimelineEventFormatter.kt 0.00% 6 Missing ⚠️
...entformatter/impl/DefaultTimelineEventFormatter.kt 0.00% 4 Missing ⚠️
.../timeline/item/event/TimelineEventContentMapper.kt 33.33% 1 Missing and 3 partials ⚠️
...ll/test/pollcontent/FakePollContentStateFactory.kt 0.00% 3 Missing ⚠️
...ndroid/features/messages/impl/MessagesPresenter.kt 33.33% 0 Missing and 2 partials ⚠️
.../factories/event/TimelineItemContentPollFactory.kt 0.00% 2 Missing ⚠️
...s/messagesummary/DefaultMessageSummaryFormatter.kt 60.00% 0 Missing and 2 partials ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5355      +/-   ##
===========================================
- Coverage    80.38%   80.37%   -0.02%     
===========================================
  Files         2279     2282       +3     
  Lines        62961    63068     +107     
  Branches      7876     7887      +11     
===========================================
+ Hits         50614    50691      +77     
- Misses        9442     9464      +22     
- Partials      2905     2913       +8     

☔ 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 added the PR-Misc For other changes label Sep 18, 2025
@jmartinesp jmartinesp marked this pull request as ready for review September 18, 2025 11:46
@jmartinesp jmartinesp requested a review from a team as a code owner September 18, 2025 11:46
@jmartinesp jmartinesp requested review from bmarty and removed request for a team September 18, 2025 11:46
@jmartinesp jmartinesp force-pushed the feat/add-thread-decoration-with-latest-event-details branch from fcf902e to daead53 Compare September 18, 2025 11:46
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.

It works pretty well, thanks!

A few remarks in order to simplify (I think!) the code though.

Spacer(modifier = Modifier.width(8.dp))

Text(
text = latestEvent.senderProfile.getDisplayName() ?: latestEvent.senderId.value,
Copy link
Member

Choose a reason for hiding this comment

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

We should use the disambiguated displayname here:

Suggested change
text = latestEvent.senderProfile.getDisplayName() ?: latestEvent.senderId.value,
text = latestEvent.senderProfile.getDisambiguatedDisplayName(latestEvent.senderId),

@jmartinesp jmartinesp force-pushed the feat/add-thread-decoration-with-latest-event-details branch from daead53 to 236c1b0 Compare September 23, 2025 10:43
@jmartinesp jmartinesp requested a review from bmarty September 23, 2025 12:04
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.

Thanks for the update. There is just this remark missing. Also maybe bubbleShape (here) could be inlined.

val threadId = targetEvent.threadInfo.threadRootId ?: targetEvent.eventId!!.toThreadId()
val threadId = when (targetEvent.threadInfo) {
is TimelineItemThreadInfo.ThreadResponse -> targetEvent.threadInfo.threadRootId
is TimelineItemThreadInfo.ThreadRoot, null -> targetEvent.eventId?.toThreadId()
Copy link
Member

Choose a reason for hiding this comment

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

Not a big deal but since we are not using the smart cast on TimelineItemThreadInfo.ThreadRoot (I was confused about that at the beginning), maybe using else is cleaner.

Suggested change
is TimelineItemThreadInfo.ThreadRoot, null -> targetEvent.eventId?.toThreadId()
else -> targetEvent.eventId?.toThreadId()

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 wanted to explicitly list all the possible cases so if we end up adding one in the future (unlikely, but...) we'll have to come back here to manage it.

@jmartinesp
Copy link
Member Author

Thanks for the update. There is just this remark missing. Also maybe bubbleShape (here) could be inlined.

Ah damn, I changed it by mistake in the AvatarData instead 🤦 .

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.

Thanks!

@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 23, 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 23, 2025
@jmartinesp jmartinesp force-pushed the feat/add-thread-decoration-with-latest-event-details branch from 7eff9c9 to 7f8b5bc Compare September 23, 2025 13:59
- Thread icon should be 20x20.
- Corner radius should be 8.
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Sep 23, 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 23, 2025
Copy link

@jmartinesp jmartinesp enabled auto-merge (squash) September 23, 2025 14:45
@jmartinesp jmartinesp merged commit 0a5c178 into develop Sep 23, 2025
28 of 31 checks passed
@jmartinesp jmartinesp deleted the feat/add-thread-decoration-with-latest-event-details branch September 23, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Misc For other changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants