From 45ae8fb0674fc632dbe076aadcdc28b2d4e76d50 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 4 May 2017 13:51:39 -0400 Subject: [PATCH] Respond to CR. // FREEBIE --- .../MessageComposeTableViewController.m | 11 +--------- .../ViewControllers/OWSTableViewController.h | 2 ++ .../ViewControllers/OWSTableViewController.m | 20 ++++++++++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Signal/src/ViewControllers/MessageComposeTableViewController.m b/Signal/src/ViewControllers/MessageComposeTableViewController.m index c7953c413..26082b6d4 100644 --- a/Signal/src/ViewControllers/MessageComposeTableViewController.m +++ b/Signal/src/ViewControllers/MessageComposeTableViewController.m @@ -84,6 +84,7 @@ NS_ASSUME_NONNULL_BEGIN _tableViewController = [OWSTableViewController new]; _tableViewController.delegate = self; + _tableViewController.tableViewStyle = UITableViewStylePlain; [self.view addSubview:self.tableViewController.view]; [_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeTop]; @@ -258,11 +259,6 @@ NS_ASSUME_NONNULL_BEGIN if ([self.nonContactAccountSet containsObject:phoneNumber]) { [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ - MessageComposeTableViewController *strongSelf = weakSelf; - if (!strongSelf) { - return (ContactTableViewCell *)nil; - } - ContactTableViewCell *cell = [ContactTableViewCell new]; BOOL isBlocked = [helper isRecipientIdBlocked:phoneNumber]; if (isBlocked) { @@ -302,11 +298,6 @@ NS_ASSUME_NONNULL_BEGIN NSArray *filteredSignalAccounts = [self filteredSignalAccounts]; for (SignalAccount *signalAccount in filteredSignalAccounts) { [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ - MessageComposeTableViewController *strongSelf = weakSelf; - if (!strongSelf) { - return (ContactTableViewCell *)nil; - } - ContactTableViewCell *cell = [ContactTableViewCell new]; BOOL isBlocked = [helper isRecipientIdBlocked:signalAccount.recipientId]; if (isBlocked) { diff --git a/Signal/src/ViewControllers/OWSTableViewController.h b/Signal/src/ViewControllers/OWSTableViewController.h index 52d406733..aadb7f747 100644 --- a/Signal/src/ViewControllers/OWSTableViewController.h +++ b/Signal/src/ViewControllers/OWSTableViewController.h @@ -86,6 +86,8 @@ typedef UITableViewCell *_Nonnull (^OWSTableCustomCellBlock)(); @property (nonatomic) OWSTableContents *contents; @property (nonatomic, readonly) UITableView *tableView; +@property (nonatomic) UITableViewStyle tableViewStyle; + #pragma mark - Presentation - (void)presentFromViewController:(UIViewController *)fromViewController; diff --git a/Signal/src/ViewControllers/OWSTableViewController.m b/Signal/src/ViewControllers/OWSTableViewController.m index 45b08ce32..402297a16 100644 --- a/Signal/src/ViewControllers/OWSTableViewController.m +++ b/Signal/src/ViewControllers/OWSTableViewController.m @@ -178,9 +178,13 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; - (instancetype)init { - if (self = [super init]) { - _contents = [OWSTableContents new]; + self = [super init]; + if (!self) { + return self; } + + [self commonInit]; + return self; } @@ -191,7 +195,7 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; return self; } - _contents = [OWSTableContents new]; + [self commonInit]; return self; } @@ -203,11 +207,17 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; return self; } - _contents = [OWSTableContents new]; + [self commonInit]; return self; } +- (void)commonInit +{ + _contents = [OWSTableContents new]; + self.tableViewStyle = UITableViewStyleGrouped; +} + - (void)loadView { [super loadView]; @@ -218,7 +228,7 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; self.title = self.contents.title; } - self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:self.tableViewStyle]; self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];