|
|
@ -314,7 +314,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
OWSAssert(recipientId.length > 0);
|
|
|
|
OWSAssert(recipientId.length > 0);
|
|
|
|
OWSAssert(transaction);
|
|
|
|
OWSAssert(transaction);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Remove all @synchronized
|
|
|
|
|
|
|
|
// Ensure a remote identity exists for this key. We may be learning about
|
|
|
|
// Ensure a remote identity exists for this key. We may be learning about
|
|
|
|
// it for the first time.
|
|
|
|
// it for the first time.
|
|
|
|
[self saveRemoteIdentity:identityKey recipientId:recipientId protocolContext:transaction];
|
|
|
|
[self saveRemoteIdentity:identityKey recipientId:recipientId protocolContext:transaction];
|
|
|
@ -449,8 +448,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
OWSAssert(direction != TSMessageDirectionUnknown);
|
|
|
|
OWSAssert(direction != TSMessageDirectionUnknown);
|
|
|
|
OWSAssert(transaction);
|
|
|
|
OWSAssert(transaction);
|
|
|
|
|
|
|
|
|
|
|
|
@synchronized(self)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ([[TSAccountManager localNumber] isEqualToString:recipientId]) {
|
|
|
|
if ([[TSAccountManager localNumber] isEqualToString:recipientId]) {
|
|
|
|
ECKeyPair *_Nullable localIdentityKeyPair = [self identityKeyPair:transaction];
|
|
|
|
ECKeyPair *_Nullable localIdentityKeyPair = [self identityKeyPair:transaction];
|
|
|
|
|
|
|
|
|
|
|
@ -481,7 +478,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)isTrustedKey:(NSData *)identityKey forSendingToIdentity:(nullable OWSRecipientIdentity *)recipientIdentity
|
|
|
|
- (BOOL)isTrustedKey:(NSData *)identityKey forSendingToIdentity:(nullable OWSRecipientIdentity *)recipientIdentity
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -577,14 +573,12 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
- (void)syncQueuedVerificationStates
|
|
|
|
- (void)syncQueuedVerificationStates
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
@synchronized(self)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NSMutableArray<NSString *> *recipientIds = [NSMutableArray new];
|
|
|
|
NSMutableArray<NSString *> *recipientIds = [NSMutableArray new];
|
|
|
|
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
[transaction enumerateKeysAndObjectsInCollection:OWSIdentityManager_QueuedVerificationStateSyncMessages
|
|
|
|
[transaction
|
|
|
|
usingBlock:^(NSString *_Nonnull recipientId,
|
|
|
|
enumerateKeysAndObjectsInCollection:OWSIdentityManager_QueuedVerificationStateSyncMessages
|
|
|
|
id _Nonnull object,
|
|
|
|
usingBlock:^(
|
|
|
|
BOOL *_Nonnull stop) {
|
|
|
|
NSString *_Nonnull recipientId, id _Nonnull object, BOOL *_Nonnull stop) {
|
|
|
|
[recipientIds addObject:recipientId];
|
|
|
|
[recipientIds addObject:recipientId];
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}];
|
|
|
@ -617,8 +611,8 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
recipientId);
|
|
|
|
recipientId);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OWSVerificationStateSyncMessage *message = [[OWSVerificationStateSyncMessage alloc]
|
|
|
|
OWSVerificationStateSyncMessage *message =
|
|
|
|
initWithVerificationState:recipientIdentity.verificationState
|
|
|
|
[[OWSVerificationStateSyncMessage alloc] initWithVerificationState:recipientIdentity.verificationState
|
|
|
|
identityKey:identityKey
|
|
|
|
identityKey:identityKey
|
|
|
|
verificationForRecipientId:recipientIdentity.recipientId];
|
|
|
|
verificationForRecipientId:recipientIdentity.recipientId];
|
|
|
|
[messages addObject:message];
|
|
|
|
[messages addObject:message];
|
|
|
@ -628,7 +622,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
|
|
|
|
[self sendSyncVerificationStateMessage:message];
|
|
|
|
[self sendSyncVerificationStateMessage:message];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|