Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-02-02 22:46:10 -05:00
parent f9c20a36a4
commit 4f9ce0c0e2
2 changed files with 20 additions and 18 deletions

View File

@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) NSString *searchPhoneNumber;
// This dictionary is used to cache the set of phone numbers
// which are known to correspond to Signal accounts.
@property (nonatomic) NSMutableSet *phoneNumberAccountSet;
@property (nonatomic, nonnull, readonly) NSMutableSet *phoneNumberAccountSet;
@property (nonatomic) BOOL isBackgroundViewHidden;
@ -54,10 +54,13 @@ NS_ASSUME_NONNULL_BEGIN
// which is not known to correspond to a signal account, or:
// * "Invite contacts" if the invite flow is available, or:
// * Nothing, otherwise.
NSInteger const MessageComposeTableViewControllerSectionInviteNonContactConversation = 0;
NSInteger const MessageComposeTableViewControllerSectionInviteViaSMS = 1;
NSInteger const MessageComposeTableViewControllerSectionInviteFlow = 2;
NSInteger const MessageComposeTableViewControllerSectionContacts = 3;
typedef NS_ENUM(NSInteger, AdvancedSettingsTableViewControllerSection) {
MessageComposeTableViewControllerSectionInviteNonContactConversation = 0,
MessageComposeTableViewControllerSectionInviteViaSMS,
MessageComposeTableViewControllerSectionInviteFlow,
MessageComposeTableViewControllerSectionContacts,
MessageComposeTableViewControllerSection_Count // meta section
};
NSString *const MessageComposeTableViewControllerCellInvite = @"ContactTableInviteCell";
NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableViewCell";
@ -72,7 +75,8 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
}
_contactsManager = [Environment getCurrent].contactsManager;
_phoneNumberAccountSet = [NSMutableSet set];
return self;
}
@ -349,9 +353,6 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
if (!strongSelf) {
return;
}
if (!strongSelf.phoneNumberAccountSet) {
strongSelf.phoneNumberAccountSet = [NSMutableSet set];
}
if (![strongSelf.phoneNumberAccountSet containsObject:phoneNumber]) {
[strongSelf.phoneNumberAccountSet addObject:phoneNumber];
[strongSelf.tableView reloadData];
@ -476,7 +477,7 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
#pragma mark - Table View Data Source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return MessageComposeTableViewControllerSectionContacts + 1;
return MessageComposeTableViewControllerSection_Count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@ -488,7 +489,7 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
BOOL hasPhoneNumber = self.searchPhoneNumber.length > 0;
BOOL isKnownSignalUser = hasPhoneNumber && [self.phoneNumberAccountSet containsObject:self.searchPhoneNumber];
BOOL isInviteFlowSupported = floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_9_0;
BOOL isInviteFlowSupported = SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0);
if (hasPhoneNumber && isKnownSignalUser) {
showNonContactConversation = YES;
} else if (hasPhoneNumber) {
@ -522,11 +523,9 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
self.searchPhoneNumber];
return self.conversationForNonContactCell;
} else if (indexPath.section == MessageComposeTableViewControllerSectionInviteViaSMS) {
// TODO: We should rework this string to be a format, to account for languages where the
// phone number should not appear at the end of the copy.
self.inviteViaSMSCell.textLabel.text = [NSLocalizedString(@"SEND_SMS_BUTTON",
@"Text for button to send a Signal invite via SMS")
stringByAppendingString:self.searchPhoneNumber];
self.inviteViaSMSCell.textLabel.text = [NSString stringWithFormat:NSLocalizedString(@"SEND_INVITE_VIA_SMS_BUTTON_FORMAT",
@"Text for button to send a Signal invite via SMS. %@ is placeholder for the receipient's phone number."),
self.searchPhoneNumber];
return self.inviteViaSMSCell;
} else if (indexPath.section == MessageComposeTableViewControllerSectionInviteFlow) {
return self.inviteCell;

View File

@ -244,6 +244,9 @@
/* Generic server error */
"ERROR_DESCRIPTION_SERVER_FAILURE" = "Server Error. Please try again later.";
/* Worst case generic error message */
"ERROR_DESCRIPTION_UNKNOWN_ERROR" = "ERROR_DESCRIPTION_UNKNOWN_ERROR";
/* Error message when attempting to send message */
"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT" = "Contact is not a Signal user.";
@ -708,8 +711,8 @@
/* Alert body after invite succeeded */
"SEND_INVITE_SUCCESS" = "You've invited your friend to use Signal!";
/* No comment provided by engineer. */
"SEND_SMS_BUTTON" = "Send SMS to: ";
/* Text for button to send a Signal invite via SMS */
"SEND_INVITE_VIA_SMS_BUTTON_FORMAT" = "Send Invite via SMS to: %@";
/* No comment provided by engineer. */
"SEND_SMS_CONFIRM_TITLE" = "Invite a friend via insecure SMS?";