mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Just highlight event when possible instead of reloading data source
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user