diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index a981f3b13..71efb2925 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -40,6 +40,7 @@ [super viewWillAppear:animated]; self.tableView.accessibilityIdentifier = @"ChatRoom list"; _imagesInChatroom = [NSMutableDictionary dictionary]; + _currentIndex = 0; } #pragma mark - @@ -317,10 +318,10 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f; [tableView beginUpdates]; LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue]; linphone_event_log_delete_from_database(event); + NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); + if (index < totalEventList.count) + [totalEventList removeObjectAtIndex:index]; [eventList removeObjectAtIndex:indexPath.row]; - NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); - if (index < totalEventList.count) - [totalEventList removeObjectAtIndex:index]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationBottom]; @@ -365,10 +366,10 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f; [super removeSelectionUsing:^(NSIndexPath *indexPath) { LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue]; linphone_event_log_delete_from_database(event); - [eventList removeObjectAtIndex:indexPath.row]; NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); if (index < totalEventList.count) [totalEventList removeObjectAtIndex:index]; + [eventList removeObjectAtIndex:indexPath.row]; }]; }