compose w/o contact access -> "..by phone number"

The search field and invite buttons are not very useful without contacts
access.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 0b6962cdd0
commit 03727a27f6

@ -115,9 +115,18 @@ NS_ASSUME_NONNULL_BEGIN
[self updateTableContents]; [self updateTableContents];
} }
- (void)showContactsPermissionReminder:(BOOL)flag - (void)showContactsPermissionReminder:(BOOL)isVisible
{ {
_hideContactsPermissionReminderViewConstraint.active = !flag; _hideContactsPermissionReminderViewConstraint.active = !isVisible;
}
- (void)showSearchBar:(BOOL)isVisible
{
if (isVisible) {
self.tableViewController.tableView.tableHeaderView = self.searchBar;
} else {
self.tableViewController.tableView.tableHeaderView = nil;
}
} }
- (UIView *)createNoSignalContactsView - (UIView *)createNoSignalContactsView
@ -259,20 +268,22 @@ NS_ASSUME_NONNULL_BEGIN
[weakSelf.navigationController pushViewController:viewController animated:YES]; [weakSelf.navigationController pushViewController:viewController animated:YES];
}]]; }]];
// Invite Contacts if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized) {
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{ // Invite Contacts
UITableViewCell *cell = [UITableViewCell new]; [section addItem:[OWSTableItem itemWithCustomCellBlock:^{
cell.textLabel.text = NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON", UITableViewCell *cell = [UITableViewCell new];
@"Label for the cell that presents the 'invite contacts' workflow."); cell.textLabel.text = NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON",
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; @"Label for the cell that presents the 'invite contacts' workflow.");
cell.textLabel.textColor = [UIColor blackColor]; cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.textLabel.textColor = [UIColor blackColor];
return cell; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
customRowHeight:kActionCellHeight
actionBlock:^{
[weakSelf presentInviteFlow];
}]];
} }
customRowHeight:kActionCellHeight
actionBlock:^{
[weakSelf presentInviteFlow];
}]];
// If the search string looks like a phone number, show either "new conversation..." cells and/or // If the search string looks like a phone number, show either "new conversation..." cells and/or
// "invite via SMS..." cells. // "invite via SMS..." cells.
@ -445,10 +456,13 @@ NS_ASSUME_NONNULL_BEGIN
BOOL hasNoContacts = self.contactsViewHelper.signalAccounts.count < 1; BOOL hasNoContacts = self.contactsViewHelper.signalAccounts.count < 1;
self.isNoContactsModeActive = (hasNoContacts && ![[Environment preferences] hasDeclinedNoContactsView]); self.isNoContactsModeActive = (hasNoContacts && ![[Environment preferences] hasDeclinedNoContactsView]);
[self showContactsPermissionReminder:NO]; [self showContactsPermissionReminder:NO];
[self showSearchBar:YES];
} else { } else {
// don't show "no signal contacts", show "no contact access" // don't show "no signal contacts", show "no contact access"
self.isNoContactsModeActive = NO; self.isNoContactsModeActive = NO;
[self showContactsPermissionReminder:YES]; [self showContactsPermissionReminder:YES];
[self showSearchBar:NO];
} }
} }

Loading…
Cancel
Save