From fd86929f5eb6f052d8dce598be9e9dd61b0b0c9c Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 15 Feb 2017 11:12:07 +0100 Subject: [PATCH] Warn unknown devices: update the unknown devices list once a device has been verified --- .../UsersDevicesViewController.h | 3 ++- .../UsersDevicesViewController.m | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Vector/ViewController/UsersDevicesViewController.h b/Vector/ViewController/UsersDevicesViewController.h index 22905fc28..620bee7da 100644 --- a/Vector/ViewController/UsersDevicesViewController.h +++ b/Vector/ViewController/UsersDevicesViewController.h @@ -17,8 +17,9 @@ #import #import "DeviceTableViewCell.h" +#import "EncryptionInfoView.h" -@interface UsersDevicesViewController : MXKViewController +@interface UsersDevicesViewController : MXKViewController /** Display a map of users/devices. diff --git a/Vector/ViewController/UsersDevicesViewController.m b/Vector/ViewController/UsersDevicesViewController.m index b89079a7f..4cf87a4f2 100644 --- a/Vector/ViewController/UsersDevicesViewController.m +++ b/Vector/ViewController/UsersDevicesViewController.m @@ -22,14 +22,10 @@ #import "VectorDesignValues.h" -#import "EncryptionInfoView.h" - @interface UsersDevicesViewController () { MXUsersDevicesMap *usersDevices; MXSession *mxSession; - - EncryptionInfoView *encryptionInfoView; } @end @@ -150,9 +146,11 @@ if (verificationStatus == MXDeviceVerified) { // Prompt the user before marking as verified the device. - encryptionInfoView = [[EncryptionInfoView alloc] initWithDeviceInfo:deviceTableViewCell.deviceInfo andMatrixSession:mxSession]; + EncryptionInfoView *encryptionInfoView = [[EncryptionInfoView alloc] initWithDeviceInfo:deviceTableViewCell.deviceInfo andMatrixSession:mxSession]; [encryptionInfoView onButtonPressed:encryptionInfoView.verifyButton]; + encryptionInfoView.delegate = self; + // Add shadow on added view encryptionInfoView.layer.cornerRadius = 5; encryptionInfoView.layer.shadowOffset = CGSizeMake(0, 1); @@ -208,6 +206,17 @@ } } +#pragma mark - MXKEncryptionInfoViewDelegate + +- (void)encryptionInfoView:(MXKEncryptionInfoView *)encryptionInfoView didDeviceInfoVerifiedChange:(MXDeviceInfo *)deviceInfo +{ + // Update our map + MXDeviceInfo *device = [usersDevices objectForDevice:deviceInfo.deviceId forUser:deviceInfo.userId]; + device.verified = deviceInfo.verified; + + [self.tableView reloadData]; +} + #pragma mark - User actions - (IBAction)onCancel:(id)sender