Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent f9c20a36a4
commit 4f9ce0c0e2

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

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

Loading…
Cancel
Save