adapt to rebase conflicts

pull/1/head
Michael Kirk 7 years ago
parent f415827da6
commit fff8474150

@ -41,30 +41,42 @@ class ConversationSearchViewController: UITableViewController {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: false) tableView.deselectRow(at: indexPath, animated: false)
guard let searchSection = SearchSection(rawValue: indexPath.section) else { guard let searchSection = SearchSection(rawValue: indexPath.section) else {
owsFail("\(logTag) unknown section selected.") owsFail("\(logTag) unknown section selected.")
return return
} }
var sectionResults: [SearchResult]
switch searchSection { switch searchSection {
case .conversations: case .conversations:
sectionResults = searchResultSet.conversations let sectionResults = searchResultSet.conversations
guard let searchResult = sectionResults[safe: indexPath.row] else {
owsFail("\(logTag) unknown row selected.")
return
}
let thread = searchResult.thread
SignalApp.shared().presentConversation(for: thread.threadRecord, action: .compose)
case .contacts: case .contacts:
sectionResults = searchResultSet.contacts let sectionResults = searchResultSet.contacts
guard let searchResult = sectionResults[safe: indexPath.row] else {
owsFail("\(logTag) unknown row selected.")
return
}
SignalApp.shared().presentConversation(forRecipientId: searchResult.recipientId, action: .compose)
case .messages: case .messages:
sectionResults = searchResultSet.messages let sectionResults = searchResultSet.messages
} guard let searchResult = sectionResults[safe: indexPath.row] else {
owsFail("\(logTag) unknown row selected.")
guard indexPath.row < sectionResults.count else { return
owsFail("\(logTag) unknown row selected.") }
return
let thread = searchResult.thread
SignalApp.shared().presentConversation(for: thread.threadRecord, action: .compose)
} }
let searchResult = sectionResults[indexPath.row]
let thread = searchResult.thread
SignalApp.shared().presentConversation(for: thread.threadRecord, action: .compose)
} }
// MARK: UITableViewDataSource // MARK: UITableViewDataSource

@ -87,7 +87,7 @@ public class ConversationSearcher: NSObject {
} }
} }
// Only show contacts which were not included in an existing conversation. // Only show contacts which were not included in an existing 1:1 conversation.
let otherContacts: [ContactSearchResult] = contacts.filter { !existingConversationRecipientIds.contains($0.recipientId) } let otherContacts: [ContactSearchResult] = contacts.filter { !existingConversationRecipientIds.contains($0.recipientId) }
return SearchResultSet(conversations: conversations, contacts: otherContacts, messages: messages) return SearchResultSet(conversations: conversations, contacts: otherContacts, messages: messages)

@ -106,6 +106,12 @@ public class FullTextSearchFinder: NSObject {
if let groupThread = object as? TSGroupThread { if let groupThread = object as? TSGroupThread {
return self.groupThreadIndexer.index(groupThread) return self.groupThreadIndexer.index(groupThread)
} else if let contactThread = object as? TSContactThread { } else if let contactThread = object as? TSContactThread {
guard contactThread.hasEverHadMessage else {
// If we've never sent/received a message in a TSContactThread,
// then we want it to appear in the "Other Contacts" section rather
// than in the "Conversations" section.
return nil
}
return self.contactThreadIndexer.index(contactThread) return self.contactThreadIndexer.index(contactThread)
} else if let message = object as? TSMessage { } else if let message = object as? TSMessage {
return self.messageIndexer.index(message) return self.messageIndexer.index(message)

Loading…
Cancel
Save