Merge pull request #2364 from vector-im/avoid_tableview_crashes_settings

Avoid crashes with tableview reload animation in settings and room settings
This commit is contained in:
SBiOSoftWhare 2019-04-10 18:10:52 +02:00 committed by GitHub
commit d6e3c631d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Bug fix:
* Share extension: Fix a crash when receive a memory warning (PR #2352).
* Upgraded rooms show up in the share extension twice (#2293).
* +N read receipt text is invisible on dark theme (#2294).
* Avoid crashes with tableview reload animation in settings and room settings (PR #2364).
Changes in 0.8.4 (2019-03-21)
===============================================

View file

@ -3561,6 +3561,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[removedAlias addObject:roomAlias];
}
[self.tableView beginUpdates];
NSMutableIndexSet *mutableIndexSet = [NSMutableIndexSet indexSet];
if (roomAddresses.count <= 1)
@ -3572,6 +3574,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[mutableIndexSet addIndex:ROOM_SETTINGS_ROOM_ADDRESSES_SECTION_INDEX];
[self.tableView reloadSections:mutableIndexSet withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
}
}
@ -3601,9 +3605,13 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[removedGroup addObject:groupId];
}
[self.tableView beginUpdates];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:ROOM_SETTINGS_RELATED_GROUPS_SECTION_INDEX];
[self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
}
@ -3636,6 +3644,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[addedAlias addObject:roomAlias];
}
[self.tableView beginUpdates];
NSMutableIndexSet *mutableIndexSet = [NSMutableIndexSet indexSet];
if (!roomAddresses.count)
@ -3663,6 +3673,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[mutableIndexSet addIndex:ROOM_SETTINGS_ROOM_ADDRESSES_SECTION_INDEX];
[self.tableView reloadSections:mutableIndexSet withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
return YES;
@ -3726,9 +3738,13 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[addedGroup addObject:groupId];
}
[self.tableView beginUpdates];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:ROOM_SETTINGS_RELATED_GROUPS_SECTION_INDEX];
[self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
return YES;

View file

@ -622,12 +622,15 @@ SignOutAlertPresenterDelegate>
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView beginUpdates];
// Refresh the corresponding table view cell with animation
[self.tableView reloadRowsAtIndexPaths:@[
[NSIndexPath indexPathForRow:userSettingsNewEmailIndex inSection:SETTINGS_SECTION_USER_SETTINGS_INDEX]
]
withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
});
}
}
@ -648,12 +651,15 @@ SignOutAlertPresenterDelegate>
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView beginUpdates];
// Refresh the corresponding table view cell with animation
[self.tableView reloadRowsAtIndexPaths:@[
[NSIndexPath indexPathForRow:userSettingsNewPhoneIndex inSection:SETTINGS_SECTION_USER_SETTINGS_INDEX]
]
withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
});
}
}