Skip to content

Commit

Permalink
Merge pull request #1099 from nextcloud/fix-chat-scroll-position
Browse files Browse the repository at this point in the history
Fix chat scroll position when loading multiples blocks
  • Loading branch information
SystemKeeper committed Mar 1, 2023
2 parents 9f19f84 + 41c5f10 commit 58246d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion NextcloudTalk/NCChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2542,8 +2542,11 @@ - (void)didReceiveChatMessages:(NSNotification *)notification
NSMutableArray *messagesForLastDate = [self->_messages objectForKey:[self->_dateSections lastObject]];
NSIndexPath *lastMessageIndexPath = [NSIndexPath indexPathForRow:messagesForLastDate.count - 1 inSection:self->_dateSections.count - 1];

// Load messages in chat view
// Load messages in chat view keeping scroll position
CGPoint contentOffset = self.tableView.contentOffset;
[self.tableView reloadData];
[self.tableView layoutIfNeeded];
[self.tableView setContentOffset:contentOffset animated:NO];

BOOL newMessagesContainUserMessage = [self newMessagesContainUserMessage:messages];
// Remove unread messages separator when user writes a message
Expand Down

0 comments on commit 58246d6

Please sign in to comment.