Hide new group button if user has no contacts.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 47ae6ccf76
commit 0dfe020997

@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nonnull, readonly) NSMutableSet *phoneNumberAccountSet; @property (nonatomic, nonnull, readonly) NSMutableSet *phoneNumberAccountSet;
@property (nonatomic) BOOL isNoContactsViewVisible; @property (nonatomic) BOOL isNoContactsViewVisible;
@property (nonatomic) UIBarButtonItem *createGroupBarButtonItem;
@end @end
@ -114,7 +115,8 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self.navigationController.navigationBar setTranslucent:NO]; [self.navigationController.navigationBar setTranslucent:NO];
self.createGroupBarButtonItem = self.navigationItem.rightBarButtonItem;
self.navigationItem.rightBarButtonItem.accessibilityLabel = NSLocalizedString( self.navigationItem.rightBarButtonItem.accessibilityLabel = NSLocalizedString(
@"CREATE_NEW_GROUP", @"Accessibility label for the create group new group button"); @"CREATE_NEW_GROUP", @"Accessibility label for the create group new group button");
@ -225,7 +227,6 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
- (void)hideBackgroundView { - (void)hideBackgroundView {
[[Environment preferences] setHasDeclinedNoContactsView:YES]; [[Environment preferences] setHasDeclinedNoContactsView:YES];
// [self showEmptyBackgroundView:NO];
[self showEmptyBackgroundViewIfNecessary]; [self showEmptyBackgroundViewIfNecessary];
} }
@ -266,13 +267,15 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
self.searchController.searchBar.hidden = YES; self.searchController.searchBar.hidden = YES;
self.tableView.backgroundView = self.noSignalContactsView; self.tableView.backgroundView = self.noSignalContactsView;
self.tableView.backgroundView.opaque = YES; self.tableView.backgroundView.opaque = YES;
self.navigationItem.rightBarButtonItem = nil;
} else { } else {
[self initializeRefreshControl]; [self initializeRefreshControl];
self.refreshControl.enabled = YES; self.refreshControl.enabled = YES;
self.searchController.searchBar.hidden = NO; self.searchController.searchBar.hidden = NO;
self.tableView.backgroundView = nil; self.tableView.backgroundView = nil;
self.navigationItem.rightBarButtonItem = self.createGroupBarButtonItem;
} }
[self.tableView reloadData]; [self.tableView reloadData];
} }

Loading…
Cancel
Save