Security screens: Update automatically shields when the trust changes.

This commit is contained in:
manuroe
2020-10-08 17:34:42 +02:00
parent c1d3613a66
commit 6131de3077
3 changed files with 80 additions and 1 deletions

View File

@@ -204,9 +204,11 @@ TableViewSectionsDelegate>
}];
[self userInterfaceThemeDidChange];
[self registerUserDevicesChangesNotification];
self.tableViewSections = [TableViewSections new];
self.tableViewSections.delegate = self;
[self updateSections];
}
@@ -559,6 +561,57 @@ TableViewSectionsDelegate>
}
#pragma mark - Data update
- (void)registerUserDevicesChangesNotification
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onDeviceInfoTrustLevelDidChangeNotification:)
name:MXDeviceInfoTrustLevelDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(crossSigningInfoTrustLevelDidChangeNotification:)
name:MXCrossSigningInfoTrustLevelDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onDidUpdateUsersDevicesNotification:)
name:MXDeviceListDidUpdateUsersDevicesNotification
object:nil];
}
- (void)onDidUpdateUsersDevicesNotification:(NSNotification*)notification
{
NSDictionary *usersDevices = notification.userInfo;
if ([usersDevices.allKeys containsObject:self.mainSession.myUserId])
{
[self loadDevices];
}
}
- (void)onDeviceInfoTrustLevelDidChangeNotification:(NSNotification*)notification
{
MXDeviceInfo *deviceInfo = notification.object;
NSString *userId = deviceInfo.userId;
if ([userId isEqualToString:self.mainSession.myUserId])
{
[self loadDevices];
}
}
- (void)crossSigningInfoTrustLevelDidChangeNotification:(NSNotification*)notification
{
MXCrossSigningInfo *crossSigningInfo = notification.object;
NSString *userId = crossSigningInfo.userId;
if ([userId isEqualToString:self.mainSession.myUserId])
{
[self loadDevices];
}
}
#pragma mark - Cross-signing
- (void)loadCrossSigning