Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions MatrixSDK/Data/EventTimeline/Room/MXRoomEventTimeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,24 @@ - (instancetype)initWithRoom:(MXRoom*)theRoom initialEventId:(NSString*)initialE

_state = [[MXRoomState alloc] initWithRoomId:room.roomId andMatrixSession:room.mxSession andDirection:YES];

// If the event stream runs with lazy loading, the timeline must do the same
if (room.mxSession.syncWithLazyLoadOfRoomMembers)
// During startup, if a cached filterId exists, this code will execute to fetch and create a filter.
// However, if a filter is explicitly provided to start(), that filter will overwrite the one allocated here.
// Additionally, this code runs when loadRoom() is called after start() to ensure the filter is always initialized.
if (!_roomEventFilter && room.mxSession.syncFilterId)
{
_roomEventFilter = [MXRoomEventFilter new];
_roomEventFilter.lazyLoadMembers = YES;
[room.mxSession filterWithFilterId:room.mxSession.syncFilterId success:^(MXFilterJSONModel *filter) {
_roomEventFilter = filter.room.timeline;

// If the event stream runs with lazy loading, the timeline must do the same
if (filter.room.state.lazyLoadMembers)
{
if (!_roomEventFilter)
{
_roomEventFilter = [MXRoomEventFilter new];
}
_roomEventFilter.lazyLoadMembers = YES;
}
} failure:nil];
}
}
return self;
Expand Down
12 changes: 12 additions & 0 deletions MatrixSDK/MXSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,18 @@ - (void)startWithSyncFilterId:(NSString *)syncFilterId onServerSyncDone:(void (^
MXLogDebug(@"[MXSession] Set syncWithLazyLoadOfRoomMembers to YES");
self->_syncWithLazyLoadOfRoomMembers = YES;
}

for (MXRoom *room in self.rooms) {
[room liveTimeline:^(id<MXEventTimeline> liveTimeline) {
liveTimeline.roomEventFilter = filter.room.timeline;

// If the event stream runs with lazy loading, the timeline must do the same
if (self->_syncWithLazyLoadOfRoomMembers)
{
liveTimeline.roomEventFilter.lazyLoadMembers = YES;
}
}];
}
} failure:nil];
}

Expand Down
2 changes: 2 additions & 0 deletions changelog.d/pr-1912.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Lazy member loading flag was not applied in timeline filter due to init order (setStore before start).
- Support for additional timeline filters.