Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 08ba42c563
commit ffb199bcd1

@ -1,5 +1,6 @@
// Created by Frederic Jacobs on 21/11/15.
// Copyright © 2015 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "SignalRecipient.h"
@ -15,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable SignalRecipient *)synchronousLookup:(NSString *)identifier error:(NSError **)error;
// This asynchronously updates the SignalRecipient for a given contactId.
- (void)lookupIdentifier:(NSString *)identifier
success:(void (^)(NSSet<NSString *> *matchedIds))success
failure:(void (^)(NSError *error))failure;

@ -1,5 +1,6 @@
// Created by Frederic Jacobs on 16/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "TSContactThread.h"
#import "ContactsManagerProtocol.h"
@ -32,12 +33,15 @@ NS_ASSUME_NONNULL_BEGIN
[SignalRecipient recipientWithTextSecureIdentifier:contactId withTransaction:transaction];
if (!recipient) {
// If no recipient record exists for that contactId, create an empty record
// for immediate use, then ask ContactsUpdater to try to update it async.
recipient =
[[SignalRecipient alloc] initWithTextSecureIdentifier:contactId
relay:relay
supportsVoice:YES
// Default to NO; ContactsUpdater will try to update this property.
supportsWebRTC:NO];
[recipient saveWithTransaction:transaction];
[[ContactsUpdater sharedUpdater] lookupIdentifier:contactId
success:^(NSSet<NSString *> *matchedIds) {
@ -45,7 +49,6 @@ NS_ASSUME_NONNULL_BEGIN
failure:^(NSError *error) {
DDLogWarn(@"Failed to lookup contact with error:%@", error);
}];
[recipient saveWithTransaction:transaction];
}
return [self getOrCreateThreadWithContactId:contactId transaction:transaction];

Loading…
Cancel
Save