Skip to content
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

Room: Fix scrolling to bottom on back pagination #5697

Merged
merged 2 commits into from
Feb 25, 2022
Merged
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
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented here I don't fully understand the relationship between direction and the creation of a thread. Does it mean something like where in the timeline the thread should be placed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to explain it on your comment.

{
// 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.