fix delete chat cells

This commit is contained in:
Danmei Chen 2019-03-06 16:54:45 +01:00
parent 19ab701f63
commit 202e33a736

View file

@ -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];
}];
}