Settings: Add cross-signing and key verification by direct message switches in labs section.

This commit is contained in:
SBiOSoftWhare
2019-12-06 12:14:13 +01:00
parent 3192e77ba9
commit 5fc72ea682
4 changed files with 67 additions and 0 deletions

View File

@@ -137,6 +137,8 @@ enum
LABS_USE_ROOM_MEMBERS_LAZY_LOADING_INDEX = 0,
LABS_USE_JITSI_WIDGET_INDEX,
LABS_CRYPTO_INDEX,
LABS_DM_KEY_VERIFICATION_INDEX,
LABS_CROSS_SIGNING_INDEX,
LABS_COUNT
};
@@ -2445,6 +2447,30 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
labelAndSwitchCell.mxkSwitch.enabled = NO;
}
cell = labelAndSwitchCell;
}
else if (row == LABS_DM_KEY_VERIFICATION_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_dm_key_verification", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableDMKeyVerification;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsDMKeyVerification:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
else if (row == LABS_CROSS_SIGNING_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_cross_signing", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableCrossSigning;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsCrossSigning:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
}
@@ -3497,6 +3523,20 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
}
}
}
- (void)toggleLabsDMKeyVerification:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
RiotSettings.shared.enableDMKeyVerification = switchButton.isOn;
}
- (void)toggleLabsCrossSigning:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
RiotSettings.shared.enableCrossSigning = switchButton.isOn;
}
- (void)toggleBlacklistUnverifiedDevices:(id)sender
{