Debug multi device revocation

This commit is contained in:
Niels Andriesse 2019-11-21 10:10:34 +11:00
parent e954933b66
commit 5fde64ef1e
2 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,8 @@
public extension OWSPrimaryStorage {
private func getDeviceLinkCollection(for primaryDevice: String) -> String {
return "LokiDeviceLinkCollection-\(primaryDevice)"
private func getDeviceLinkCollection(for masterHexEncodedPublicKey: String) -> String {
return "LokiDeviceLinkCollection-\(masterHexEncodedPublicKey)"
}
public func setDeviceLinks(_ deviceLinks: Set<DeviceLink>, in transaction: YapDatabaseReadWriteTransaction) {

View File

@ -1196,11 +1196,11 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
[LKStorageAPI getDeviceLinksAssociatedWith:userHexEncodedPublicKey].thenOn(dispatch_get_main_queue(), ^(NSSet<LKDeviceLink *> *deviceLinks) {
if (![deviceLinks contains:^BOOL(LKDeviceLink *deviceLink) {
if ([deviceLinks contains:^BOOL(LKDeviceLink *deviceLink) {
return [deviceLink.master.hexEncodedPublicKey isEqual:senderHexEncodedPublicKey] && [deviceLink.slave.hexEncodedPublicKey isEqual:userHexEncodedPublicKey];
}]) {
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"wasUnlinked"];
[NSNotificationCenter.defaultCenter postNotification:NSNotification.dataNukeRequested];
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.dataNukeRequested object:nil];
}
});
}