Avoid deadlocks in contact manager.

pull/1/head
Matthew Chen 7 years ago
parent f26241ebd0
commit 70f274598c

@ -749,7 +749,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
return [self cachedContactNameForRecipientId:recipientId transaction:transaction]; return [self cachedContactNameForRecipientId:recipientId transaction:transaction];
} }
- (NSString *_Nonnull)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId - (NSString *)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId
{ {
OWSAssertDebug(recipientId.length > 0); OWSAssertDebug(recipientId.length > 0);
@ -767,8 +767,8 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
return displayName; return displayName;
} }
- (NSString *_Nonnull)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId - (NSString *)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId
transaction:(YapDatabaseReadTransaction *)transaction transaction:(YapDatabaseReadTransaction *)transaction
{ {
OWSAssertDebug(recipientId.length > 0); OWSAssertDebug(recipientId.length > 0);
OWSAssertDebug(transaction); OWSAssertDebug(transaction);
@ -973,7 +973,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
if (profileName.length > 0) { if (profileName.length > 0) {
NSString *numberAndProfileNameFormat = NSLocalizedString(@"PROFILE_NAME_AND_PHONE_NUMBER_LABEL_FORMAT", NSString *numberAndProfileNameFormat = NSLocalizedString(@"PROFILE_NAME_AND_PHONE_NUMBER_LABEL_FORMAT",
@"Label text combining the phone number and profile name separated by a simple demarcation character. " @"Label text combining the phone number and profile name separated by a simple demarcation character. "
@"Phone number should be masost prominent. '%1$@' is replaced with {{phone number}} and '%2$@' is replaced " @"Phone number should be most prominent. '%1$@' is replaced with {{phone number}} and '%2$@' is replaced "
@"with {{profile name}}"); @"with {{profile name}}");
NSString *numberAndProfileName = NSString *numberAndProfileName =

@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol ContactsManagerProtocol <NSObject> @protocol ContactsManagerProtocol <NSObject>
- (NSString *)displayNameForPhoneIdentifier:(nullable NSString *)recipientId; - (NSString *)displayNameForPhoneIdentifier:(nullable NSString *)recipientId;
- (NSString *_Nonnull)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId - (NSString *)displayNameForPhoneIdentifier:(NSString *_Nullable)recipientId
transaction:(YapDatabaseReadTransaction *)transaction; transaction:(YapDatabaseReadTransaction *)transaction;
- (NSArray<SignalAccount *> *)signalAccounts; - (NSArray<SignalAccount *> *)signalAccounts;
- (BOOL)isSystemContact:(NSString *)recipientId; - (BOOL)isSystemContact:(NSString *)recipientId;

@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSFakeContactsManager @implementation OWSFakeContactsManager
- (NSString *_Nonnull)displayNameForPhoneIdentifier:(NSString *_Nullable)phoneNumber - (NSString *)displayNameForPhoneIdentifier:(NSString *_Nullable)phoneNumber
{ {
return @"Fake name"; return @"Fake name";
} }

Loading…
Cancel
Save