Merge pull request #3402 from vector-im/fix_3401

Fix Crash on SettingsViewController when Scrolling to Discovery
This commit is contained in:
ismailgulek 2020-07-16 12:56:19 +03:00 committed by GitHub
commit fb28bb81e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -32,6 +32,7 @@ Bug fix:
* Xcode11: Disable voip background mode to avoid VoIP pushes (#3369).
* Xcode11: Disable key backup on push extension (#3371).
* RoomMembershipBubbleCell: Fix message textview leading constraint (#3226).
* SettingsViewController: Fix crash when scrolling to Discovery (#3401).
Changes in 0.11.6 (2020-06-30)
===============================================

View file

@ -2470,8 +2470,18 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
}
else if (section == SETTINGS_SECTION_USER_SETTINGS_INDEX && row == userSettingsThreePidsInformation)
{
NSIndexPath *discoveryIndexPath = [NSIndexPath indexPathForRow:0 inSection:SETTINGS_SECTION_DISCOVERY_INDEX];
[tableView scrollToRowAtIndexPath:discoveryIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
// settingsDiscoveryTableViewSection is a dynamic section, so check number of rows before scroll to avoid crashes
if (self.settingsDiscoveryTableViewSection.numberOfRows > 0)
{
NSIndexPath *discoveryIndexPath = [NSIndexPath indexPathForRow:0 inSection:SETTINGS_SECTION_DISCOVERY_INDEX];
[tableView scrollToRowAtIndexPath:discoveryIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
else
{
// this won't be precise in scroll location, but seems the best option for now
NSIndexPath *discoveryIndexPath = [NSIndexPath indexPathForRow:0 inSection:SETTINGS_SECTION_DISCOVERY_INDEX + 1];
[tableView scrollToRowAtIndexPath:discoveryIndexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}
}
else if (section == SETTINGS_SECTION_DISCOVERY_INDEX)
{