Warn unknown devices: Add a send anyway button.

As 2 buttons works better than 3 in MXKAlert, "Send Anyway" replaces the previous "Cancel" button. The end user can still "Cancel" the action but on the UsersDevicesViewController screen when he presses "Verify...".
This commit is contained in:
manuroe 2017-03-07 15:40:07 +01:00
parent 757193624e
commit 58f3842446
3 changed files with 23 additions and 10 deletions

View file

@ -209,6 +209,7 @@
// Unknown devices
"unknown_devices_alert_title" = "Room contains unknown devices";
"unknown_devices_alert" = "This room contains unknown devices which have not been verified.\nThis means there is no guarantee that the devices belong to the users they claim to.\nWe recommend you go through the verification process for each device before continuing, but you can resend the message without verifying if you prefer.";
"unknown_devices_send_anyway" = "Send Anyway";
"unknown_devices_verify" = "Verify...";
"unknown_devices_title" = "Unknown devices";

View file

@ -1,6 +1,7 @@
/*
Copyright 2014 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@ -3147,23 +3148,27 @@
message:[NSBundle mxk_localizedStringForKey:@"unknown_devices_alert"]
style:MXKAlertStyleAlert];
currentAlert.cancelButtonIndex = [currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
[currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_verify"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
typeof(self) self = weakSelf;
self->currentAlert = nil;
[self performSegueWithIdentifier:@"showUnknownDevices" sender:self];
}];
[currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_send_anyway"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
typeof(self) self = weakSelf;
self->currentAlert = nil;
// Acknowledge the existence of all devices
[self startActivityIndicator];
[self.mainSession.crypto setDevicesKnown:self->unknownDevices complete:^{
self->unknownDevices = nil;
[self stopActivityIndicator];
}];
}];
[currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_verify"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
typeof(self) self = weakSelf;
self->currentAlert = nil;
[self performSegueWithIdentifier:@"showUnknownDevices" sender:self];
// And resend pending messages
[self resendAllUnsentMessages];
}];
}];
currentAlert.mxkAccessibilityIdentifier = @"RoomVCUnknownDevicesAlert";

View file

@ -55,7 +55,9 @@
self.title = NSLocalizedStringFromTable(@"unknown_devices_title", @"Vector", nil);
self.accessibilityLabel=@"UsersDevicesVCTitleStaticText";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(onDone:)];
self.navigationItem.rightBarButtonItem.accessibilityIdentifier=@"UsersDevicesVCDoneButton";
self.navigationItem.rightBarButtonItem.accessibilityIdentifier=@"UsersDevicesVCDoneButton";
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancel:)];
self.navigationItem.leftBarButtonItem.accessibilityIdentifier=@"UsersDevicesVCCancelButton";
self.tableView.delegate = self;
self.tableView.accessibilityIdentifier=@"UsersDevicesVCDTableView";
self.tableView.dataSource = self;
@ -229,6 +231,11 @@ self.navigationItem.rightBarButtonItem.accessibilityIdentifier=@"UsersDevicesVCD
}];
}
- (IBAction)onCancel:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - Private methods
- (MXDeviceInfo*)deviceAtIndexPath:(NSIndexPath *)indexPath