diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index d8c945818..e4e00233a 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -602,6 +602,7 @@ "security_settings_complete_security_alert_message" = "You should complete security on your current session first."; "security_settings_coming_soon" = "Sorry. This action is not available on Riot-iOS yet. Please use another Matrix client to set it up. Riot-iOS will use it."; +"security_settings_user_password_description" = "Confirm your identity by entering your account password"; // Manage session "manage_session_title" = "Manage session"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index e08490ade..9c5c162cf 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -3206,6 +3206,10 @@ internal enum VectorL10n { internal static var securitySettingsTitle: String { return VectorL10n.tr("Vector", "security_settings_title") } + /// Confirm your identity by entering your account password + internal static var securitySettingsUserPasswordDescription: String { + return VectorL10n.tr("Vector", "security_settings_user_password_description") + } /// Send to %@ internal static func sendTo(_ p1: String) -> String { return VectorL10n.tr("Vector", "send_to", p1) diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index 9dd299bfa..add35a0d8 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -575,6 +575,18 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> } - (void)setupCrossSigning:(id)sender +{ + [self setupCrossSigningWithTitle:@"Set up cross-signing" // TODO + message:NSLocalizedStringFromTable(@"security_settings_user_password_description", @"Vector", nil) + success:^{ + } failure:^(NSError *error) { + }]; +} + +- (void)setupCrossSigningWithTitle:(NSString*)title + message:(NSString*)message + success:(void (^)(void))success + failure:(void (^)(NSError *error))failure { __block UIViewController *viewController; [self startActivityIndicator]; @@ -584,8 +596,8 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> _authenticatedSessionViewControllerFactory = [[AuthenticatedSessionViewControllerFactory alloc] initWithSession:self.mainSession]; [_authenticatedSessionViewControllerFactory viewControllerForPath:path httpMethod:@"POST" - title:@"Set up cross-signing" // TODO - message:@"Confirm your identity by entering your account password" // TODO + title:title + message:message onViewController:^(UIViewController * _Nonnull theViewController) { viewController = theViewController; @@ -602,11 +614,13 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> [crossSigning setupWithAuthParams:authParams success:^{ [self stopActivityIndicator]; [self reloadData]; + success(); } failure:^(NSError * _Nonnull error) { [self stopActivityIndicator]; [self reloadData]; [[AppDelegate theDelegate] showErrorAsAlert:error]; + failure(error); }]; } @@ -615,6 +629,7 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> [viewController dismissViewControllerAnimated:NO completion:nil]; viewController = nil; + failure(nil); } onFailure:^(NSError * _Nonnull error) { [self stopActivityIndicator]; @@ -622,6 +637,7 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> [viewController dismissViewControllerAnimated:NO completion:nil]; viewController = nil; + failure(error); }]; } @@ -692,21 +708,11 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> } else { - if (self.canSetupSecureBackup) - { - secureBackupSectionState = @[ - @(SECURE_BACKUP_SETUP), // TODO: Check we have all keys locally (at least MSK, SSK & SSK) - @(SECURE_BACKUP_DESCRIPTION), - //@(SECURE_BACKUP_MANAGE_MANUALLY), - ]; - } - else - { - secureBackupSectionState = @[ - @(SECURE_BACKUP_DESCRIPTION), - //@(SECURE_BACKUP_MANAGE_MANUALLY), - ]; - } + secureBackupSectionState = @[ + @(SECURE_BACKUP_SETUP), + @(SECURE_BACKUP_DESCRIPTION), + //@(SECURE_BACKUP_MANAGE_MANUALLY), + ]; } #ifdef CROSS_SIGNING_AND_BACKUP_DEV @@ -849,6 +855,24 @@ SecureBackupSetupCoordinatorBridgePresenterDelegate> } - (void)setupSecureBackup +{ + if (self.canSetupSecureBackup) + { + [self setupSecureBackup2]; + } + else + { + // Set up cross-signing first + [self setupCrossSigningWithTitle:NSLocalizedStringFromTable(@"secure_key_backup_setup_intro_title", @"Vector", nil) + message:NSLocalizedStringFromTable(@"security_settings_user_password_description", @"Vector", nil) + success:^{ + [self setupSecureBackup2]; + } failure:^(NSError *error) { + }]; + } +} + +- (void)setupSecureBackup2 { SecureBackupSetupCoordinatorBridgePresenter *secureBackupSetupCoordinatorBridgePresenter = [[SecureBackupSetupCoordinatorBridgePresenter alloc] initWithSession:self.mainSession]; secureBackupSetupCoordinatorBridgePresenter.delegate = self;