-
Notifications
You must be signed in to change notification settings - Fork 226
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
Use the right live timeline instance in RustRoomFactory
#4745
Conversation
Otherwise, stuff like the initial events and event filters are ignored
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
val initialRoomInfo = roomReferences.room.roomInfo() | ||
private suspend fun getBaseRoom(roomListItem: RoomListItem): RustBaseRoom? { | ||
val room = if (roomListItem.isTimelineInitialized()) { | ||
roomListItem.fullRoom() |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
There was a problem hiding this 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()) { |
There was a problem hiding this comment.
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
|
Content
RustRoomFactory
now uses the right live timeline when returning a joined room.RustRoomReferences
helper class.Motivation and context
Otherwise, some parameters like the initial events and event filters are ignored.
Screenshots / GIFs
Tests
Tested devices
Checklist