Skip to content

Use the right live timeline instance in RustRoomFactory #4745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented May 19, 2025

Content

  • RustRoomFactory now uses the right live timeline when returning a joined room.
  • Removed RustRoomReferences helper class.

Motivation and context

Otherwise, some parameters like the initial events and event filters are ignored.

Screenshots / GIFs

Tests

  • Open a room.
  • Start a call, then end it once the EC UI appears.
  • You should see the 'call started' event in the timeline but should not see the call member events (hidden by the timeline event filter).
  • The room should also load a bit faster.

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

Otherwise, stuff like the initial events and event filters are ignored
@jmartinesp jmartinesp requested a review from a team as a code owner May 19, 2025 16:05
@jmartinesp jmartinesp requested review from ganfra and removed request for a team May 19, 2025 16:05
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label May 19, 2025
Copy link
Contributor

github-actions bot commented May 19, 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/LRbt6X

Copy link

codecov bot commented May 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 80.15%. Comparing base (34e88f3) to head (770abd7).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...roid/libraries/matrix/impl/room/RustRoomFactory.kt 0.00% 20 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4745      +/-   ##
===========================================
+ Coverage    80.13%   80.15%   +0.01%     
===========================================
  Files         2129     2129              
  Lines        56449    56438      -11     
  Branches      7055     7053       -2     
===========================================
  Hits         45236    45236              
+ Misses        8795     8784      -11     
  Partials      2418     2418              

☔ 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.

val initialRoomInfo = roomReferences.room.roomInfo()
private suspend fun getBaseRoom(roomListItem: RoomListItem): RustBaseRoom? {
val room = if (roomListItem.isTimelineInitialized()) {
roomListItem.fullRoom()
Copy link
Member

Choose a reason for hiding this comment

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

This feels a bit weird, why a BaseRoom would have a timeline?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I think you're right and this is not really needed. We already do this same step using the RoomListItem in getJoinedRoomOrPreview. I'll double check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wait, we're not instantiating a timeline here, we're just checking if the timeline was already created before, since this is maybe a joined room that was previously used, and in that case we call roomListItem.fullRoom() which is guaranteed to work if there is an initialized timeline, and otherwise we try to get a room from the client, which could fail if the wrong id is used or there is some DB issue I guess.

I believe we could just use the client option if you think it's better though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think it's better :)

@jmartinesp jmartinesp requested a review from ganfra May 20, 2025 09:39
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

One final remark, otherwise LGTM

// Init the live timeline in the SDK from the RoomListItem
if (!roomReferences.roomListItem.isTimelineInitialized()) {
roomReferences.roomListItem.initTimeline(eventFilters, "LIVE")
val sdkRoom = if (!roomListItem.isTimelineInitialized()) {
Copy link
Member

Choose a reason for hiding this comment

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

fullRoomWithTimeline is already checking if it's initialized, so I think we can safely remove the check here

Copy link

@jmartinesp jmartinesp merged commit 8e87bf2 into develop May 20, 2025
29 of 31 checks passed
@jmartinesp jmartinesp deleted the fix/use-the-right-timeline-instance-in-rust-room-factory branch May 20, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants