Commit 202e33a7 authored by DanmeiChen's avatar DanmeiChen

fix delete chat cells

parent 19ab701f
......@@ -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];
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment