Fix: Crash when scrolling in the public rooms from Unified Search (#1355)

Make pagination UI update of DirectoryViewController simpler.

The issue is that the same PublicRoomsDirectoryDataSource instance is shared between DirectoryViewController and RoomsViewController. We can have parallel paginations which makes hard to count the exact number of added cells.
This commit is contained in:
manuroe
2017-06-26 15:33:45 +02:00
parent a4ed741c37
commit d91c305d1d
+1 -13
View File
@@ -230,19 +230,7 @@
if (roomsAdded)
{
// Notify the table view there are new items at its tail
NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray arrayWithCapacity:roomsAdded];
NSUInteger numberOfRowsBefore = [self->dataSource tableView:self.tableView numberOfRowsInSection:0];
numberOfRowsBefore -= roomsAdded;
for (NSUInteger i = 0; i < roomsAdded; i++)
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(numberOfRowsBefore + i) inSection:0];
[indexPaths addObject:indexPath];
}
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView reloadData];
}
[self removeSpinnerFooterView];