Skip to content

Commit

Permalink
Merge pull request #5697 from vector-im/ismail/5694_scroll_bottom_fix
Browse files Browse the repository at this point in the history
Room: Fix scrolling to bottom on back pagination
  • Loading branch information
ismailgulek authored Feb 25, 2022
2 parents c4ddd37 + fff7fc6 commit a87badf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Riot/Modules/Room/DataSources/RoomDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

const CGFloat kTypingCellHeight = 24;

@interface RoomDataSource() <BubbleReactionsViewModelDelegate, URLPreviewViewDelegate, ThreadSummaryViewDelegate>
@interface RoomDataSource() <BubbleReactionsViewModelDelegate, URLPreviewViewDelegate, ThreadSummaryViewDelegate, MXThreadingServiceDelegate>
{
// Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change.
id kThemeServiceDidChangeThemeNotificationObserver;
Expand Down Expand Up @@ -92,12 +92,9 @@ - (instancetype)initWithRoomId:(NSString *)roomId andMatrixSession:(MXSession *)
[self reload];

}];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(newThreadCreated:)
name:MXThreadingService.newThreadCreated
object:nil];


[matrixSession.threadingService addDelegate:self];

[self registerKeyVerificationRequestNotification];
[self registerKeyVerificationTransactionNotification];
[self registerTrustLevelDidChangeNotifications];
Expand Down Expand Up @@ -177,6 +174,8 @@ - (void)destroy
{
[[NSNotificationCenter defaultCenter] removeObserver:self.keyVerificationTransactionDidChangeNotificationObserver];
}

[self.mxSession.threadingService removeDelegate:self];

[super destroy];
}
Expand Down Expand Up @@ -973,15 +972,20 @@ - (void)resetAccessibilityForCell:(MXKRoomBubbleTableViewCell *)cell
cell.attachmentView.accessibilityLabel = nil;
}

#pragma mark - Threads
#pragma mark - MXThreadingServiceDelegate

- (void)newThreadCreated:(NSNotification *)notification
- (void)threadingService:(MXThreadingService *)service didCreateNewThread:(MXThread *)thread direction:(MXTimelineDirection)direction
{
if (self.threadId)
{
// no need to reload the thread screen
return;
}
if (direction == MXTimelineDirectionBackwards)
{
// no need to reload when paginating back
return;
}
NSUInteger count = 0;
@synchronized (bubbles)
{
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5694.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RoomDataSource: Do not reload room data source on back pagination for new threads.

0 comments on commit a87badf

Please sign in to comment.