SecurityViewController: Show current device cannot cross sign show all devices with black shield and present complete security on tap.

This commit is contained in:
SBiOSoftWhare
2020-04-23 15:50:01 +02:00
parent 81167b6069
commit b99cdf49d5
3 changed files with 61 additions and 2 deletions
@@ -707,6 +707,11 @@ UIDocumentInteractionControllerDelegate>
- (UIImage*)shieldImageForDevice:(NSString*)deviceId
{
if (!self.mainSession.crypto.crossSigning.canCrossSign)
{
return [UIImage imageNamed:@"encryption_normal"];
}
UIImage* shieldImageForDevice = [UIImage imageNamed:@"encryption_warning"];
MXDeviceInfo *device = [self.mainSession.crypto deviceWithDeviceId:deviceId ofUser:self.mainSession.myUser.userId];
if (device.trustLevel.isVerified)
@@ -961,9 +966,25 @@ UIDocumentInteractionControllerDelegate>
NSUInteger deviceIndex = row;
if (deviceIndex < devicesArray.count)
{
ManageSessionViewController *viewController = [ManageSessionViewController instantiateWithMatrixSession:self.mainSession andDevice:devicesArray[deviceIndex]];
MXDevice *device = devicesArray[deviceIndex];
[self pushViewController:viewController];
if (self.mainSession.crypto.crossSigning.canCrossSign)
{
ManageSessionViewController *viewController = [ManageSessionViewController instantiateWithMatrixSession:self.mainSession andDevice:device];
[self pushViewController:viewController];
}
else
{
if ([device.deviceId isEqualToString:self.mainSession.matrixRestClient.credentials.deviceId])
{
[self presentCompleteSecurity];
}
else
{
[self presentShouldCompleteSecurityAlert];
}
}
}
}
@@ -971,6 +992,34 @@ UIDocumentInteractionControllerDelegate>
}
}
- (void)presentCompleteSecurity
{
[[AppDelegate theDelegate] presentCompleteSecurityForSession:self.mainSession];
}
- (void)presentShouldCompleteSecurityAlert
{
[currentAlert dismissViewControllerAnimated:NO completion:nil];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"security_settings_complete_security_alert_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"security_settings_complete_security_alert_message", @"Vector", nil)
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self presentCompleteSecurity];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"later", @"Vector", nil)
style:UIAlertActionStyleCancel
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
currentAlert = alertController;
[currentAlert mxk_setAccessibilityIdentifier: @"SettingsVCCompleteSecurity"];
}
#pragma mark - UIDocumentInteractionControllerDelegate
- (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(NSString *)application