Skip to content

Conversation

@jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Oct 23, 2025

Content

  • Splits room notifications and thread notifications so they're grouped separately in the notification drawer if the associated feature flag is enabled.
  • Add deep linking navigation to threads from their notifications.
  • Following a notification (threaded or not) will focus in the event inside the room.
  • Make sure redactions work for threads too.
  • When opening a thread, this will also clear the notifications for that thread.

Known issues:

  • Opening a thread from a notification will also clear the notifications for the parent room, since we very briefly visit that room's screen.
  • Sometimes the notifications don't display the associated avatar. It's not always the same rooms/threads, it seems quite random. I'm not sure if it started with this PR.

Motivation and context

Implements #5581.

Screenshots / GIFs

image

Tests

  • Enable the threads flag in labs.
  • Receive a notification for a room/DM.
  • Receive a notification for one or several threads in a room/DM.
  • Tap on the room notification, check it takes you to the latest event in the notification.
  • Then tap on the thread notification, which should now open the thread.
  • Exit both the thread and the room.
  • Receive a couple of new notifications for room and thread.
  • Open the room from the room list. The notifications associated to it should be gone.
  • Do the same for the thread, opening it from the timeline.
  • Exit the thread.
  • Receive a new notification for a thread.
  • Redact that event after it's received.
  • Check the notification is also redacted.

Tested devices

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

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 added the PR-Feature For a new feature label Oct 23, 2025
@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch from c07eab0 to 68fb2fb Compare October 23, 2025 12:02
@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 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/RzG8DU

@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch from 68fb2fb to a2fd3e5 Compare October 23, 2025 13:37
@jmartinesp jmartinesp marked this pull request as ready for review October 23, 2025 14:10
@jmartinesp jmartinesp requested a review from a team as a code owner October 23, 2025 14:10
@jmartinesp jmartinesp requested review from bmarty and removed request for a team October 23, 2025 14:10
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 83.24022% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.78%. Comparing base (6c3b280) to head (05aeef8).

Files with missing lines Patch % Lines
...ifications/NotificationBroadcastReceiverHandler.kt 31.25% 4 Missing and 7 partials ⚠️
...push/impl/notifications/NotificationDataFactory.kt 81.81% 0 Missing and 4 partials ⚠️
...atures/messages/impl/timeline/TimelinePresenter.kt 91.17% 2 Missing and 1 partial ⚠️
.../impl/notifications/ActiveNotificationsProvider.kt 50.00% 2 Missing ⚠️
...mpl/notifications/factories/NotificationCreator.kt 92.59% 1 Missing and 1 partial ⚠️
...ibraries/push/impl/push/OnRedactedEventReceived.kt 93.54% 1 Missing and 1 partial ⚠️
...lement/android/appnav/room/RoomNavigationTarget.kt 66.66% 1 Missing ⚠️
...ndroid/features/messages/api/MessagesEntryPoint.kt 50.00% 1 Missing ⚠️
...d/libraries/deeplink/impl/DefaultDeeplinkParser.kt 66.66% 0 Missing and 1 partial ⚠️
...ies/matrix/impl/notification/NotificationMapper.kt 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5595      +/-   ##
===========================================
+ Coverage    79.72%   79.78%   +0.05%     
===========================================
  Files         2395     2395              
  Lines        65012    65078      +66     
  Branches      8262     8294      +32     
===========================================
+ Hits         51831    51920      +89     
+ Misses       10224    10189      -35     
- Partials      2957     2969      +12     

☔ 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 mentioned this pull request Oct 24, 2025
9 tasks
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.

Amazing work, thanks!
A few remarks after a first review.

@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch from a2bb283 to 692635e Compare October 27, 2025 11:09
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.

Adding the patch to the comment does not work, here it is: attachThread.patch

it.conversationTitle = roomName.takeIf { roomIsGroup }
it.isGroupConversation = roomIsGroup
it.conversationTitle = if (isThread) {
stringProvider.getString(CommonStrings.notification_thread_in_room, roomName)
Copy link
Member

Choose a reason for hiding this comment

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

For DM the title is a bit strange since the room name is the other user name:

Image

@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch 2 times, most recently from c2f84ab to cfcb821 Compare October 28, 2025 12:32
@jmartinesp jmartinesp requested a review from bmarty October 28, 2025 16:47
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.

One question.


private suspend fun RoomFlowNode.maybeAttachThread(threadId: ThreadId?, focusedEventId: EventId?) {
if (threadId != null) {
waitForNavTargetAttached { it is RoomFlowNode.NavTarget.JoinedRoom }
Copy link
Member

Choose a reason for hiding this comment

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

I do not understand why this line is necessary (it was not in my patch).
RoomFlowNode.attachThread already contains waitForChildAttached<JoinedRoomFlowNode>(). This is the same thing, no? Or am I missing something? I am getting confused with all those Nodes :)

Copy link
Member Author

Choose a reason for hiding this comment

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

From our EXA devs chat:

there was another interesting bug
LoggedInFlowNode.attachRoom creates a new RoomFlowNode and waits until a RoomFlowNode is present
however, what happens if you do this while a RoomFlowNode was already present? the operation returns the existing one :D
and since that one is about to be disposed, anything pushed into it is ignored

You can test this by removing this code and:

  1. Opening a room.
  2. Receiving a notification for a thread while the room is visible (of that room or some other).
  3. Opening the notification.

Instead of the thread UI being pushed, you'll see the messages screen for that room being pushed, and the thread screen is nowhere to be found. If you attach a debugger, you'll see the attach thread operation does happen... in the previous RoomFlowNode, not the one we just replaced it with.

Copy link
Member

Choose a reason for hiding this comment

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

I will try to repro. But for me the problem you described was fixed by this code:

return waitForChildAttached<RoomFlowNode, NavTarget> {

Copy link
Member

Choose a reason for hiding this comment

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

I have commented out the code and I do not have the issue you describe

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah sorry, I thought we were talking about that other one. This one may not be necessary. If it's not in your tests, we can just remove it, since I probably added it to check what was causing the weird navigation and forgot to remove it later.

@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch 2 times, most recently from c5a1b31 to 6a7db17 Compare October 29, 2025 17:54
@bmarty
Copy link
Member

bmarty commented Oct 29, 2025

Failing test is not failing locally...

…eature flag is enabled.

Otherwise, set the `threadId` to null so it'll behave as usual. It's done this way to avoid having to inject `FeatureFlagService` in several places.
…he latest event in the list of messages of the notification tapped
…dId` value, then because of the `focusedEventId` one
@jmartinesp jmartinesp force-pushed the feat/add-thread-notifications-and-deeplink-navigation branch from a109496 to 6a9ca09 Compare October 30, 2025 07:51
@sonarqubecloud
Copy link

@jmartinesp jmartinesp requested a review from bmarty October 30, 2025 11:21
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.

3 participants