RoomViewController: Display an alert warning about the beta state of e2e encryption when entering the first time in an encrypted room

This commit is contained in:
manuroe 2017-03-08 09:13:48 +01:00
parent 1613b1b921
commit 8e38e01c25
3 changed files with 30 additions and 2 deletions

View file

@ -220,6 +220,7 @@
"room_event_action_cancel_upload" = "Cancel Upload";
"room_event_action_cancel_download" = "Cancel Download";
"room_event_action_view_encryption" = "Encryption Information";
"room_warning_about_encryption" = "End-to-end encryption is in beta and may not be reliable.\n\nYou should not yet trust it to secure data.\n\nDevices will not yet be able to decrypt history from before they joined the room.\n\nEncrypted messages will not be visible on clients that do not yet implement encryption.";
// Unknown devices
"unknown_devices_alert_title" = "Room contains unknown devices";
@ -366,7 +367,6 @@
"room_details_advanced_e2e_encryption_enabled"="Encryption is enabled in this room";
"room_details_advanced_e2e_encryption_disabled"="Encryption is not enabled in this room.";
"room_details_advanced_e2e_encryption_blacklist_unverified_devices"="Encrypt to verified devices only";
"room_details_advanced_e2e_encryption_prompt_title"="Warning!";
"room_details_advanced_e2e_encryption_prompt_message"="End-to-end encryption is experimental and may not be reliable.\n\nYou should not yet trust it to secure data.\n\nDevices will not yet be able to decrypt history from before they joined the room.\n\nOnce encryption is enabled for a room it cannot be turned off again (for now).\n\nEncrypted messages will not be visible on clients that do not yet implement encryption.";
"room_details_fail_to_update_avatar" = "Fail to update the room photo";
"room_details_fail_to_update_room_name" = "Fail to update the room name";

View file

@ -3051,7 +3051,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[currentAlert dismiss:NO];
currentAlert = [[MXKAlert alloc] initWithTitle:NSLocalizedStringFromTable(@"room_details_advanced_e2e_encryption_prompt_title", @"Vector", nil)
currentAlert = [[MXKAlert alloc] initWithTitle:NSLocalizedStringFromTable(@"warning", @"Vector", nil)
message:NSLocalizedStringFromTable(@"room_details_advanced_e2e_encryption_prompt_message", @"Vector", nil)
style:MXKAlertStyleAlert];

View file

@ -478,6 +478,33 @@
}];
[self refreshMissedDiscussionsCount:YES];
// Warn about the beta state of e2e encryption when entering the first time in an encrypted room
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:self.roomDataSource.mxSession.myUser.userId];
if (account && !account.isWarnedAboutEncryption && self.roomDataSource.room.state.isEncrypted)
{
[currentAlert dismiss:NO];
__weak __typeof(self) weakSelf = self;
currentAlert = [[MXKAlert alloc] initWithTitle:NSLocalizedStringFromTable(@"warning", @"Vector", nil)
message:NSLocalizedStringFromTable(@"room_warning_about_encryption", @"Vector", nil)
style:MXKAlertStyleAlert];
currentAlert.cancelButtonIndex = [currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
if (weakSelf)
{
__strong __typeof(weakSelf)self = weakSelf;
self->currentAlert = nil;
account.warnedAboutEncryption = YES;
}
}];
currentAlert.mxkAccessibilityIdentifier = @"RoomVCEncryptionAlert";
[currentAlert showInViewController:self];
}
}
- (void)viewDidDisappear:(BOOL)animated
@ -3173,6 +3200,7 @@
}
}
- (void)resendAllUnsentMessages
{
// List unsent event ids