Clean up ahead of PR.

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent da7dd1b128
commit cb9d96be00

@ -16,13 +16,6 @@ NS_ASSUME_NONNULL_BEGIN
// An E164 value identifying the signal account. // An E164 value identifying the signal account.
@property (nonatomic) NSString *recipientId; @property (nonatomic) NSString *recipientId;
//// TODO:
//@property (nonatomic) NSString *displayName;
//
//// TODO:
//@property (nonatomic) NSAttributedString *attributedDisplayName;
// TODO: This might be redundant.
@property (nonatomic) BOOL isMultipleAccountContact; @property (nonatomic) BOOL isMultipleAccountContact;
// For contacts with more than one signal account, // For contacts with more than one signal account,

@ -107,9 +107,6 @@ NS_ASSUME_NONNULL_BEGIN
if (contact.textSecureIdentifiers.count == 1) { if (contact.textSecureIdentifiers.count == 1) {
ContactAccount *contactAccount = [ContactAccount new]; ContactAccount *contactAccount = [ContactAccount new];
contactAccount.contact = contact; contactAccount.contact = contact;
// contactAccount.displayName = contact.fullName;
// contactAccount.attributedDisplayName = [self.contactsManager
// formattedFullNameForContact:contact];
NSString *recipientId = contact.textSecureIdentifiers[0]; NSString *recipientId = contact.textSecureIdentifiers[0];
contactAccount.recipientId = recipientId; contactAccount.recipientId = recipientId;
[allRecipientContactAccounts addObject:contactAccount]; [allRecipientContactAccounts addObject:contactAccount];
@ -121,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
contactAccount.contact = contact; contactAccount.contact = contact;
contactAccount.recipientId = recipientId; contactAccount.recipientId = recipientId;
contactAccount.isMultipleAccountContact = YES; contactAccount.isMultipleAccountContact = YES;
// TODO: // TODO: Store the phone number's "label" if possible.
contactAccount.multipleAccountLabel = recipientId; contactAccount.multipleAccountLabel = recipientId;
[allRecipientContactAccounts addObject:contactAccount]; [allRecipientContactAccounts addObject:contactAccount];
contactAccountMap[recipientId] = contactAccount; contactAccountMap[recipientId] = contactAccount;
@ -240,7 +237,6 @@ NS_ASSUME_NONNULL_BEGIN
- (NSArray<ContactAccount *> *)contactAccountsMatchingSearchString:(NSString *)searchText - (NSArray<ContactAccount *> *)contactAccountsMatchingSearchString:(NSString *)searchText
{ {
NSArray<NSString *> *searchTerms = NSArray<NSString *> *searchTerms =
[[searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] [[searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

@ -191,7 +191,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *rawAvatar = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *rawAvatar = [info objectForKey:UIImagePickerControllerOriginalImage];
if (rawAvatar) { if (rawAvatar) {
// TODO: This is busted. // TODO: There may be a bug here.
UIImage *resizedAvatar = [rawAvatar resizedImageToFitInSize:CGSizeMake(100.00, 100.00) scaleIfSmaller:NO]; UIImage *resizedAvatar = [rawAvatar resizedImageToFitInSize:CGSizeMake(100.00, 100.00) scaleIfSmaller:NO];
[self.delegate groupAvatarDidChange:resizedAvatar]; [self.delegate groupAvatarDidChange:resizedAvatar];
} }

@ -248,9 +248,11 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
return; return;
} }
NSString *rawPhoneNumber = [self.callingCode stringByAppendingString:self.phoneNumberTextField.text.digitsOnly];
NSMutableArray<NSString *> *possiblePhoneNumbers = [NSMutableArray new]; NSMutableArray<NSString *> *possiblePhoneNumbers = [NSMutableArray new];
for (PhoneNumber *phoneNumber in for (PhoneNumber *phoneNumber in
[PhoneNumber tryParsePhoneNumbersFromsUserSpecifiedText:self.phoneNumberTextField.text.digitsOnly [PhoneNumber tryParsePhoneNumbersFromsUserSpecifiedText:rawPhoneNumber
clientPhoneNumber:[TSStorageManager localNumber]]) { clientPhoneNumber:[TSStorageManager localNumber]]) {
[possiblePhoneNumbers addObject:phoneNumber.toE164]; [possiblePhoneNumbers addObject:phoneNumber.toE164];
} }
@ -258,6 +260,9 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
OWSAssert(0); OWSAssert(0);
return; return;
} }
// There should only be one phone number, since we're explicitly specifying
// a country code and therefore parsing a number in e164 format.
OWSAssert([possiblePhoneNumbers count] == 1);
if ([self.delegate shouldValidatePhoneNumbers]) { if ([self.delegate shouldValidatePhoneNumbers]) {
// Show an alert while validating the recipient. // Show an alert while validating the recipient.
@ -305,7 +310,6 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
}]; }];
}]; }];
} else { } else {
// Use just the first phone number.
NSString *recipientId = possiblePhoneNumbers[0]; NSString *recipientId = possiblePhoneNumbers[0];
[self.delegate phoneNumberWasSelected:recipientId]; [self.delegate phoneNumberWasSelected:recipientId];
} }

Loading…
Cancel
Save