[ios] Immediately remove offline pack from table
Remove all references to an offline pack before the call to -removePackWithCompletionHander:.
Cherry-picked from d64b8ad25c.
This commit is contained in:
committed by
Minh Nguyễn
parent
ac54129060
commit
922269cd7c
@@ -164,12 +164,9 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
MGLOfflinePack *pack = self.offlinePacks[indexPath.row];
|
||||
__weak MBXOfflinePacksTableViewController *weakSelf = self;
|
||||
[[MGLOfflineStorage sharedOfflineStorage] removePack:pack withCompletionHandler:^(NSError *error) {
|
||||
MBXOfflinePacksTableViewController *strongSelf = weakSelf;
|
||||
[strongSelf.offlinePacks removeObjectAtIndex:indexPath.row];
|
||||
[strongSelf.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
}];
|
||||
[self.offlinePacks removeObjectAtIndex:indexPath.row];
|
||||
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
[[MGLOfflineStorage sharedOfflineStorage] removePack:pack withCompletionHandler:nil];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user