Settings: Add a dedicated screen for Security

This commit is contained in:
manuroe
2020-01-28 21:09:51 +01:00
parent 3eb9df2941
commit 1a95494c83
6 changed files with 4956 additions and 3 deletions
+42 -1
View File
@@ -32,6 +32,7 @@
#import "CountryPickerViewController.h"
#import "LanguagePickerViewController.h"
#import "DeactivateAccountViewController.h"
#import "SecurityViewController.h"
#import "NBPhoneNumberUtil.h"
#import "RageShakeManager.h"
@@ -51,6 +52,7 @@ enum
{
SETTINGS_SECTION_SIGN_OUT_INDEX = 0,
SETTINGS_SECTION_USER_SETTINGS_INDEX,
SETTINGS_SECTION_SECURITY_INDEX,
SETTINGS_SECTION_NOTIFICATIONS_SETTINGS_INDEX,
SETTINGS_SECTION_CALLS_INDEX,
SETTINGS_SECTION_DISCOVERY_INDEX,
@@ -152,6 +154,12 @@ enum
DEVICES_DESCRIPTION_INDEX = 0
};
enum
{
SECURITY_BUTTON_INDEX = 0,
SECURITY_COUNT
};
#define SECTION_TITLE_PADDING_WHEN_HIDDEN 0.01f
typedef void (^blockSettingsViewController_onReadyToDestroy)(void);
@@ -1483,6 +1491,11 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
{
count = 1;
}
else if (section == SETTINGS_SECTION_SECURITY_INDEX)
{
count = SECURITY_COUNT;
}
return count;
}
@@ -2555,6 +2568,17 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
{
cell = [keyBackupSection cellForRowAtRow:row];
}
else if (section == SETTINGS_SECTION_SECURITY_INDEX)
{
switch (row)
{
case SECURITY_BUTTON_INDEX:
cell = [self getDefaultTableViewCell:tableView];
cell.textLabel.text = NSLocalizedStringFromTable(@"Security", @"Vector", nil);
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
}
}
else if (section == SETTINGS_SECTION_DEACTIVATE_ACCOUNT_INDEX)
{
MXKTableViewCellWithButton *deactivateAccountBtnCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithButton defaultReuseIdentifier]];
@@ -2675,11 +2699,15 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
return NSLocalizedStringFromTable(@"settings_key_backup", @"Vector", nil);
}
}
else if (section == SETTINGS_SECTION_SECURITY_INDEX)
{
return NSLocalizedStringFromTable(@"SECURITY", @"Vector", nil);
}
else if (section == SETTINGS_SECTION_DEACTIVATE_ACCOUNT_INDEX)
{
return NSLocalizedStringFromTable(@"settings_deactivate_my_account", @"Vector", nil);
}
return nil;
}
@@ -3021,6 +3049,19 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
[self pushViewController:countryPicker];
}
}
else if (section == SETTINGS_SECTION_SECURITY_INDEX)
{
switch (row)
{
case SECURITY_BUTTON_INDEX:
{
SecurityViewController *securityViewController = [SecurityViewController instantiateWithMatrixSession:self.mainSession];
[self pushViewController:securityViewController];
break;
}
}
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}