Commit 175317d5 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

UI: fix search conversation

Change-Id: I712b627ad8c4d8e46e60095850a965f379faa09b
parent 6d5900c7
......@@ -86,6 +86,12 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
self.navigationController?.navigationBar
.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,
NSAttributedStringKey.foregroundColor: UIColor.jamiMain]
if let text = searchBar.text, !text.isEmpty {
self.searchBar.setShowsCancelButton(true, animated: false)
if let cancelButton = searchBar.value(forKey: "cancelButton") as? UIButton {
cancelButton.isEnabled = true
}
}
}
func setupUI() {
......@@ -269,8 +275,8 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
}
func cancelSearch() {
self.searchBar.resignFirstResponder()
self.searchBar.text = ""
self.searchBar.resignFirstResponder()
self.searchResultsTableView.isHidden = true
}
......@@ -332,7 +338,6 @@ extension SmartlistViewController: UITableViewDelegate {
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.cancelSearch()
if self.navigationController?.topViewController == self {
if let convToShow: ConversationViewModel = try? tableView.rx.model(at: indexPath) {
self.viewModel.showConversation(withConversationViewModel: convToShow)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment