Rename an OWSContactsManager method

From nameStringForPhoneIdentifier
  To displayNameForPhoneIdentifier

* Add nullability descriptions

* Fix the mock object to adhere to new nullability rules

// FREEBIE
This commit is contained in:
Russ Shanahan 2016-12-01 21:10:15 -05:00 committed by Michael Kirk
parent 34ffce89f5
commit 7125028159
7 changed files with 15 additions and 15 deletions

View file

@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)name
{
return [[TextSecureKitEnv sharedEnv].contactsManager nameStringForPhoneIdentifier:self.contactIdentifier];
return [[TextSecureKitEnv sharedEnv].contactsManager displayNameForPhoneIdentifier:self.contactIdentifier];
}
#if TARGET_OS_IPHONE

View file

@ -192,7 +192,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([message isKindOfClass:[TSIncomingMessage class]]) {
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message;
NSString *contactName = [contactsManager nameStringForPhoneIdentifier:incomingMessage.authorId];
NSString *contactName = [contactsManager displayNameForPhoneIdentifier:incomingMessage.authorId];
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp
thread:message.thread

View file

@ -81,7 +81,7 @@
if ([membersWhoLeft count] > 0) {
NSArray *oldMembersNames = [[membersWhoLeft allObjects] map:^NSString*(NSString* item) {
return [contactsManager nameStringForPhoneIdentifier:item];
return [contactsManager displayNameForPhoneIdentifier:item];
}];
updatedGroupInfoString = [updatedGroupInfoString
stringByAppendingString:[NSString
@ -91,7 +91,7 @@
if ([membersWhoJoined count] > 0) {
NSArray *newMembersNames = [[membersWhoJoined allObjects] map:^NSString*(NSString* item) {
return [contactsManager nameStringForPhoneIdentifier:item];
return [contactsManager displayNameForPhoneIdentifier:item];
}];
updatedGroupInfoString = [updatedGroupInfoString
stringByAppendingString:[NSString stringWithFormat:NSLocalizedString(@"GROUP_MEMBER_JOINED", @""),

View file

@ -453,7 +453,7 @@ NS_ASSUME_NONNULL_BEGIN
durationSeconds:OWSDisappearingMessagesConfigurationDefaultExpirationDuration];
}
[disappearingMessagesConfiguration save];
NSString *name = [self.contactsManager nameStringForPhoneIdentifier:envelope.source];
NSString *name = [self.contactsManager displayNameForPhoneIdentifier:envelope.source];
OWSDisappearingConfigurationUpdateInfoMessage *message =
[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:envelope.timestamp
thread:thread
@ -502,7 +502,7 @@ NS_ASSUME_NONNULL_BEGIN
break;
}
case OWSSignalServiceProtosGroupContextTypeQuit: {
NSString *nameString = [self.contactsManager nameStringForPhoneIdentifier:envelope.source];
NSString *nameString = [self.contactsManager displayNameForPhoneIdentifier:envelope.source];
NSString *updateGroupInfo =
[NSString stringWithFormat:NSLocalizedString(@"GROUP_MEMBER_LEFT", @""), nameString];

View file

@ -7,12 +7,12 @@
@protocol ContactsManagerProtocol <NSObject>
- (NSString *)nameStringForPhoneIdentifier:(NSString *)phoneNumber;
- (NSArray<Contact *> *)signalContacts;
+ (BOOL)name:(NSString *)nameString matchesQuery:(NSString *)queryString;
- (NSString * _Nonnull)displayNameForPhoneIdentifier:(NSString * _Nullable)phoneNumber;
- (NSArray<Contact *> * _Nonnull)signalContacts;
+ (BOOL)name:(NSString * _Nonnull)nameString matchesQuery:(NSString * _Nonnull)queryString;
#if TARGET_OS_IPHONE
- (UIImage *)imageForPhoneIdentifier:(NSString *)phoneNumber;
- (UIImage * _Nullable)imageForPhoneIdentifier:(NSString * _Nullable)phoneNumber;
#endif
@end

View file

@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
- (OWSFingerprint *)fingerprintWithTheirSignalId:(NSString *)theirSignalId theirIdentityKey:(NSData *)theirIdentityKey
{
NSString *theirName = [self.contactsManager nameStringForPhoneIdentifier:theirSignalId];
NSString *theirName = [self.contactsManager displayNameForPhoneIdentifier:theirSignalId];
NSString *mySignalId = [self.storageManager localNumber];
NSData *myIdentityKey = [self.storageManager identityKeyPair].publicKey;

View file

@ -9,22 +9,22 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSFakeContactsManager
- (NSString *)nameStringForPhoneIdentifier:(NSString *)phoneNumber
- (NSString * _Nonnull)displayNameForPhoneIdentifier:(NSString * _Nullable)phoneNumber
{
return @"Fake name";
}
- (NSArray<Contact *> *)signalContacts
- (NSArray<Contact *> * _Nonnull)signalContacts
{
return @[];
}
+ (BOOL)name:(NSString *)nameString matchesQuery:(NSString *)queryString
+ (BOOL)name:(NSString * _Nonnull)nameString matchesQuery:(NSString * _Nonnull)queryString
{
return YES;
}
- (nullable UIImage *)imageForPhoneIdentifier:(NSString *)phoneNumber
- (UIImage * _Nullable)imageForPhoneIdentifier:(NSString * _Nullable)phoneNumber
{
return nil;
}