diff --git a/Riot/Modules/Room/DataSources/RoomDataSource.m b/Riot/Modules/Room/DataSources/RoomDataSource.m index 2341e692a..f6b80f4e3 100644 --- a/Riot/Modules/Room/DataSources/RoomDataSource.m +++ b/Riot/Modules/Room/DataSources/RoomDataSource.m @@ -29,7 +29,7 @@ const CGFloat kTypingCellHeight = 24; -@interface RoomDataSource() +@interface RoomDataSource() { // Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change. id kThemeServiceDidChangeThemeNotificationObserver; @@ -92,12 +92,9 @@ const CGFloat kTypingCellHeight = 24; [self reload]; }]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(newThreadCreated:) - name:MXThreadingService.newThreadCreated - object:nil]; - + + [matrixSession.threadingService addDelegate:self]; + [self registerKeyVerificationRequestNotification]; [self registerKeyVerificationTransactionNotification]; [self registerTrustLevelDidChangeNotifications]; @@ -177,6 +174,8 @@ const CGFloat kTypingCellHeight = 24; { [[NSNotificationCenter defaultCenter] removeObserver:self.keyVerificationTransactionDidChangeNotificationObserver]; } + + [self.mxSession.threadingService removeDelegate:self]; [super destroy]; } @@ -973,15 +972,20 @@ const CGFloat kTypingCellHeight = 24; 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) { diff --git a/changelog.d/5694.bugfix b/changelog.d/5694.bugfix new file mode 100644 index 000000000..fdc8c7493 --- /dev/null +++ b/changelog.d/5694.bugfix @@ -0,0 +1 @@ +RoomDataSource: Do not reload room data source on back pagination for new threads.