Merge pull request #2254 from vector-im/riot_2230

Key backup: new recover method detected
This commit is contained in:
manuroe
2019-02-15 18:29:10 +01:00
committed by GitHub
4 changed files with 86 additions and 2 deletions
+1
View File
@@ -15,6 +15,7 @@ Improvements:
* Key backup: Implement recover reminder (#2206).
* Key backup: Update key backup setup UI and UX (PR #2243).
* Key backup: Logout warning (#2245).
* Key backup: new recover method detected (#2230).
Bug fix:
* Use white scroll bar on dark themes (#2158).
+63 -2
View File
@@ -200,7 +200,12 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
Prompt to ask the user to log in again.
*/
UIAlertController *cryptoDataCorruptedAlert;
/**
Prompt to warn the user about a new backup on the homeserver.
*/
UIAlertController *wrongBackupVersionAlert;
/**
The launch animation container view
*/
@@ -518,6 +523,12 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
[cryptoDataCorruptedAlert dismissViewControllerAnimated:NO completion:nil];
cryptoDataCorruptedAlert = nil;
}
if (wrongBackupVersionAlert)
{
[wrongBackupVersionAlert dismissViewControllerAnimated:NO completion:nil];
wrongBackupVersionAlert = nil;
}
}
- (void)applicationDidEnterBackground:(UIApplication *)application
@@ -650,7 +661,10 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
// Observe crypto data storage corruption
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSessionCryptoDidCorruptData:) name:kMXSessionCryptoDidCorruptDataNotification object:nil];
// Observe wrong backup version
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBackupStateDidChangeNotification:) name:kMXKeyBackupDidStateChangeNotification object:nil];
// Resume all existing matrix sessions
NSArray *mxAccounts = [MXKAccountManager sharedManager].activeAccounts;
for (MXKAccount *account in mxAccounts)
@@ -789,6 +803,12 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
NSLog(@"[AppDelegate] restoreInitialDisplay: keep visible log in again");
[self showNotificationAlert:cryptoDataCorruptedAlert];
}
else if (wrongBackupVersionAlert)
{
NSLog(@"[AppDelegate] restoreInitialDisplay: keep visible wrongBackupVersionAlert");
[self showNotificationAlert:wrongBackupVersionAlert];
}
// Check whether an error notification is pending
else if (_errorNotification)
{
@@ -982,6 +1002,47 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
}
}
- (void)keyBackupStateDidChangeNotification:(NSNotification *)notification
{
MXKeyBackup *keyBackup = notification.object;
if (keyBackup.state == MXKeyBackupStateWrongBackUpVersion)
{
if (wrongBackupVersionAlert)
{
[wrongBackupVersionAlert dismissViewControllerAnimated:NO completion:nil];
}
wrongBackupVersionAlert = [UIAlertController
alertControllerWithTitle:NSLocalizedStringFromTable(@"e2e_key_backup_wrong_version_title", @"Vector", nil)
message:NSLocalizedStringFromTable(@"e2e_key_backup_wrong_version", @"Vector", nil)
preferredStyle:UIAlertControllerStyleAlert];
MXWeakify(self);
[wrongBackupVersionAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_key_backup_wrong_version_button_settings"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
MXStrongifyAndReturnIfNil(self);
self->wrongBackupVersionAlert = nil;
// TODO: Open settings
}]];
[wrongBackupVersionAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"e2e_key_backup_wrong_version_button_wasme"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
MXStrongifyAndReturnIfNil(self);
self->wrongBackupVersionAlert = nil;
}]];
[self showNotificationAlert:wrongBackupVersionAlert];
}
}
#pragma mark
- (void)popToHomeViewControllerAnimated:(BOOL)animated completion:(void (^)(void))completion
+6
View File
@@ -600,6 +600,12 @@
"e2e_enabling_on_app_update" = "Riot now supports end-to-end encryption but you need to log in again to enable it.\n\nYou can do it now or later from the application settings.";
"e2e_need_log_in_again" = "You need to log back in to generate end-to-end encryption keys for this device and submit the public key to your homeserver.\nThis is a once off; sorry for the inconvenience.";
// Key backup wrong version
"e2e_key_backup_wrong_version_title" = "New Key Backup";
"e2e_key_backup_wrong_version" = "A new secure message key backup has been detected.\n\nIf this wasnt you, set a new passphrase in Settings.";
"e2e_key_backup_wrong_version_button_settings" = "Settings";
"e2e_key_backup_wrong_version_button_wasme" = "It was me";
// Bug report
"bug_report_title" = "Bug Report";
"bug_report_description" = "Please describe the bug. What did you do? What did you expect to happen? What actually happened?";
+16
View File
@@ -478,6 +478,22 @@ internal enum VectorL10n {
internal static var e2eEnablingOnAppUpdate: String {
return VectorL10n.tr("Vector", "e2e_enabling_on_app_update")
}
/// A new secure message key backup has been detected.\n\nIf this wasnt you, set a new passphrase in Settings.
internal static var e2eKeyBackupWrongVersion: String {
return VectorL10n.tr("Vector", "e2e_key_backup_wrong_version")
}
/// Settings
internal static var e2eKeyBackupWrongVersionButtonSettings: String {
return VectorL10n.tr("Vector", "e2e_key_backup_wrong_version_button_settings")
}
/// It was me
internal static var e2eKeyBackupWrongVersionButtonWasme: String {
return VectorL10n.tr("Vector", "e2e_key_backup_wrong_version_button_wasme")
}
/// New Key Backup
internal static var e2eKeyBackupWrongVersionTitle: String {
return VectorL10n.tr("Vector", "e2e_key_backup_wrong_version_title")
}
/// You need to log back in to generate end-to-end encryption keys for this device and submit the public key to your homeserver.\nThis is a once off; sorry for the inconvenience.
internal static var e2eNeedLogInAgain: String {
return VectorL10n.tr("Vector", "e2e_need_log_in_again")