Just highlight event when possible instead of reloading data source

This commit is contained in:
ismailgulek
2021-11-30 14:13:57 +03:00
parent abd5044023
commit 5237963986
3 changed files with 35 additions and 4 deletions
+26 -3
View File
@@ -6378,11 +6378,30 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self.threadBridgePresenter pushFrom:self.navigationController animated:YES];
}
- (void)highlightEvent:(NSString *)eventId
- (void)highlightEvent:(NSString *)eventId completion:(void (^)(void))completion
{
NSInteger row = [self.roomDataSource indexOfCellDataWithEventId:eventId];
if (row == NSNotFound)
{
// event with eventId is not loaded into data source yet, load another data source and display it
[self startActivityIndicator];
MXWeakify(self);
[RoomDataSource loadRoomDataSourceWithRoomId:self.roomDataSource.roomId
initialEventId:eventId
threadId:nil
andMatrixSession:self.roomDataSource.mxSession
onComplete:^(RoomDataSource *roomDataSource) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
roomDataSource.markTimelineInitialEvent = YES;
[self displayRoom:roomDataSource];
// Give the data source ownership to the room view controller.
self.hasRoomDataSourceOwnership = YES;
if (completion)
{
completion();
}
}];
return;
}
@@ -6400,6 +6419,10 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
atScrollPosition:UITableViewScrollPositionMiddle
animated:YES];
}
if (completion)
{
completion();
}
}
#pragma mark - RoomContextualMenuViewControllerDelegate
@@ -6825,7 +6848,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self.threadBridgePresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
[self highlightEvent:eventId];
[self highlightEvent:eventId completion:nil];
}];
}
}
@@ -6853,7 +6876,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
if (eventId)
{
[self highlightEvent:eventId];
[self highlightEvent:eventId completion:nil];
}
}];
}