diff --git a/Signal/src/ViewControllers/ContactsViewHelper.m b/Signal/src/ViewControllers/ContactsViewHelper.m index c30d33992..4d7cbed81 100644 --- a/Signal/src/ViewControllers/ContactsViewHelper.m +++ b/Signal/src/ViewControllers/ContactsViewHelper.m @@ -3,7 +3,7 @@ // #import "ContactsViewHelper.h" -#import "ContactTableViewCell.h" +//#import "ContactTableViewCell.h" #import "Environment.h" #import "NSString+OWS.h" #import "OWSProfileManager.h" diff --git a/Signal/src/ViewControllers/SelectThreadViewController.m b/Signal/src/ViewControllers/SelectThreadViewController.m index a68ce4151..db3e27cbe 100644 --- a/Signal/src/ViewControllers/SelectThreadViewController.m +++ b/Signal/src/ViewControllers/SelectThreadViewController.m @@ -131,11 +131,13 @@ NS_ASSUME_NONNULL_BEGIN __weak SelectThreadViewController *weakSelf = self; ContactsViewHelper *helper = self.contactsViewHelper; OWSTableContents *contents = [OWSTableContents new]; - OWSTableSection *section = [OWSTableSection new]; - // Threads + // Threads are listed, most recent first. + OWSTableSection *recentChatsSection = [OWSTableSection new]; + recentChatsSection.headerTitle = NSLocalizedString( + @"SELECT_THREAD_TABLE_RECENT_CHATS_TITLE", @"Table section header for recently active conversations"); for (TSThread *thread in [self filteredThreadsWithSearchText]) { - [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ + [recentChatsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ SelectThreadViewController *strongSelf = weakSelf; OWSCAssert(strongSelf); @@ -145,16 +147,23 @@ NS_ASSUME_NONNULL_BEGIN [cell configureWithThread:thread contactsManager:helper.contactsManager]; return cell; } - customRowHeight:[ContactTableViewCell rowHeight] - actionBlock:^{ - [weakSelf.delegate threadWasSelected:thread]; - }]]; + customRowHeight:[ContactTableViewCell rowHeight] + actionBlock:^{ + [weakSelf.delegate threadWasSelected:thread]; + }]]; } - // Contacts + if (recentChatsSection.itemCount > 0) { + [contents addSection:recentChatsSection]; + } + + // Contacts who don't yet have a thread are listed last + OWSTableSection *otherContactsSection = [OWSTableSection new]; + otherContactsSection.headerTitle = NSLocalizedString( + @"SELECT_THREAD_TABLE_OTHER_CHATS_TITLE", @"Table section header for conversations you haven't recently used."); NSArray *filteredSignalAccounts = [self filteredSignalAccountsWithSearchText]; for (SignalAccount *signalAccount in filteredSignalAccounts) { - [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ + [otherContactsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ SelectThreadViewController *strongSelf = weakSelf; OWSCAssert(strongSelf); @@ -169,19 +178,24 @@ NS_ASSUME_NONNULL_BEGIN [cell configureWithSignalAccount:signalAccount contactsManager:helper.contactsManager]; return cell; } - customRowHeight:[ContactTableViewCell rowHeight] - actionBlock:^{ - [weakSelf signalAccountWasSelected:signalAccount]; - }]]; + customRowHeight:[ContactTableViewCell rowHeight] + actionBlock:^{ + [weakSelf signalAccountWasSelected:signalAccount]; + }]]; + } + + if (otherContactsSection.itemCount > 0) { + [contents addSection:otherContactsSection]; } - if (section.itemCount < 1) { - [section + if (recentChatsSection.itemCount + otherContactsSection.itemCount < 1) { + OWSTableSection *emptySection = [OWSTableSection new]; + [emptySection addItem:[OWSTableItem softCenterLabelItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_NO_CONTACTS", @"A label that indicates the user has no Signal contacts.")]]; + [contents addSection:emptySection]; } - [contents addSection:section]; self.tableViewController.contents = contents; } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index c1dd815d5..5c8334918 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1342,6 +1342,12 @@ /* Label for 'select gif to attach' action sheet button */ "SELECT_GIF_BUTTON" = "GIF"; +/* Table section header for conversations you haven't recently used. */ +"SELECT_THREAD_TABLE_OTHER_CHATS_TITLE" = "Other Contacts"; + +/* Table section header for recently active conversations */ +"SELECT_THREAD_TABLE_RECENT_CHATS_TITLE" = "Recent Chats"; + /* No comment provided by engineer. */ "SEND_AGAIN_BUTTON" = "Send Again";