|
@@ -38,7 +38,6 @@ class ChatViewController: UITableViewController {
|
|
|
|
|
|
// search related
|
|
// search related
|
|
private var activateSearch: Bool = false
|
|
private var activateSearch: Bool = false
|
|
- private var isSearchActive: Bool = false
|
|
|
|
private var searchMessageIds: [Int] = []
|
|
private var searchMessageIds: [Int] = []
|
|
private var searchResultIndex: Int = 0
|
|
private var searchResultIndex: Int = 0
|
|
private var debounceTimer: Timer?
|
|
private var debounceTimer: Timer?
|
|
@@ -703,7 +702,7 @@ class ChatViewController: UITableViewController {
|
|
}
|
|
}
|
|
|
|
|
|
private func configureDraftArea(draft: DraftModel, animated: Bool = true) {
|
|
private func configureDraftArea(draft: DraftModel, animated: Bool = true) {
|
|
- if isSearchActive {
|
|
|
|
|
|
+ if searchController.isActive {
|
|
messageInputBar.setMiddleContentView(searchAccessoryBar, animated: false)
|
|
messageInputBar.setMiddleContentView(searchAccessoryBar, animated: false)
|
|
messageInputBar.setLeftStackViewWidthConstant(to: 0, animated: false)
|
|
messageInputBar.setLeftStackViewWidthConstant(to: 0, animated: false)
|
|
messageInputBar.setRightStackViewWidthConstant(to: 0, animated: false)
|
|
messageInputBar.setRightStackViewWidthConstant(to: 0, animated: false)
|
|
@@ -1879,19 +1878,17 @@ extension ChatViewController: UISearchResultsUpdating {
|
|
extension ChatViewController: UISearchBarDelegate {
|
|
extension ChatViewController: UISearchBarDelegate {
|
|
|
|
|
|
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
|
|
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
|
|
- isSearchActive = true
|
|
|
|
configureDraftArea(draft: draft)
|
|
configureDraftArea(draft: draft)
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
|
|
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
|
|
- isSearchActive = false
|
|
|
|
configureDraftArea(draft: draft)
|
|
configureDraftArea(draft: draft)
|
|
tableView.becomeFirstResponder()
|
|
tableView.becomeFirstResponder()
|
|
}
|
|
}
|
|
|
|
|
|
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
|
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
|
- isSearchActive = false
|
|
|
|
|
|
+ searchController.isActive = false
|
|
configureDraftArea(draft: draft)
|
|
configureDraftArea(draft: draft)
|
|
tableView.becomeFirstResponder()
|
|
tableView.becomeFirstResponder()
|
|
navigationItem.searchController = nil
|
|
navigationItem.searchController = nil
|