From 3f9f2abcd8c4d691a929a6c4de54c3d06dd95686 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 12 Jun 2018 13:23:07 -0400 Subject: [PATCH] Style the search results. --- .../NewContactThreadViewController.m | 29 ++++++++++--------- .../ViewControllers/OWSTableViewController.m | 10 +++---- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Signal/src/ViewControllers/NewContactThreadViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m index ad070e939..ed296350d 100644 --- a/Signal/src/ViewControllers/NewContactThreadViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -432,19 +432,22 @@ NS_ASSUME_NONNULL_BEGIN NSArray *signalAccounts = collatedSignalAccounts[i]; NSMutableArray *contactItems = [NSMutableArray new]; for (SignalAccount *signalAccount in signalAccounts) { - [contactItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ - ContactTableViewCell *cell = [ContactTableViewCell new]; - BOOL isBlocked = [self.contactsViewHelper isRecipientIdBlocked:signalAccount.recipientId]; - if (isBlocked) { - cell.accessoryMessage - = NSLocalizedString(@"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked."); - } - - [cell configureWithSignalAccount:signalAccount contactsManager:self.contactsViewHelper.contactsManager]; - - return cell; - } - customRowHeight:[ContactTableViewCell rowHeight] + [contactItems addObject:[OWSTableItem + itemWithCustomCellBlock:^{ + ContactTableViewCell *cell = [ContactTableViewCell new]; + BOOL isBlocked = [self.contactsViewHelper + isRecipientIdBlocked:signalAccount.recipientId]; + if (isBlocked) { + cell.accessoryMessage = NSLocalizedString(@"CONTACT_CELL_IS_BLOCKED", + @"An indicator that a contact has been blocked."); + } + + [cell configureWithSignalAccount:signalAccount + contactsManager:self.contactsViewHelper.contactsManager]; + + return cell; + } + customRowHeight:UITableViewAutomaticDimension actionBlock:^{ [weakSelf newConversationWithRecipientId:signalAccount.recipientId]; }]]; diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index 187b9ff76..fe93caee5 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -112,7 +112,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; actionBlock:(nullable OWSTableActionBlock)actionBlock { OWSAssert(customCell); - OWSAssert(customRowHeight > 0); + OWSAssert(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSTableItem *item = [OWSTableItem new]; item.actionBlock = actionBlock; @@ -125,7 +125,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; customRowHeight:(CGFloat)customRowHeight actionBlock:(nullable OWSTableActionBlock)actionBlock { - OWSAssert(customRowHeight > 0); + OWSAssert(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSTableItem *item = [self itemWithCustomCellBlock:customCellBlock actionBlock:actionBlock]; item.customRowHeight = @(customRowHeight); @@ -177,7 +177,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; customRowHeight:(CGFloat)customRowHeight actionBlock:(nullable OWSTableActionBlock)actionBlock { - OWSAssert(customRowHeight > 0); + OWSAssert(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSTableItem *item = [self disclosureItemWithText:text actionBlock:actionBlock]; item.customRowHeight = @(customRowHeight); @@ -237,7 +237,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; customRowHeight:(CGFloat)customRowHeight actionBlock:(nullable OWSTableSubPageBlock)actionBlock { - OWSAssert(customRowHeight > 0); + OWSAssert(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSTableItem *item = [self subPageItemWithText:text actionBlock:actionBlock]; item.customRowHeight = @(customRowHeight); @@ -285,7 +285,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; + (OWSTableItem *)softCenterLabelItemWithText:(NSString *)text customRowHeight:(CGFloat)customRowHeight { - OWSAssert(customRowHeight > 0); + OWSAssert(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSTableItem *item = [self softCenterLabelItemWithText:text]; item.customRowHeight = @(customRowHeight);