Skip to content

Commit

Permalink
when entering multi-select-mode via 'more', cancel search-mode
Browse files Browse the repository at this point in the history
this did not work before as the controls from multi-select-mode
were not accessible.

it should be either-or, at least for now.
  • Loading branch information
r10s committed Nov 2, 2024
1 parent 009f80e commit d7205fd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,16 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
replyPrivatelyToMessage(at: indexPath)
}

private func cancelSearch() {
if searchController.isActive {
searchController.isActive = false
configureDraftArea(draft: draft)
becomeFirstResponder()
navigationItem.searchController = nil
reloadData()
}
}

@objc private func selectMore(_ sender: Any) {
guard let menuItem = UIMenuController.shared.menuItems?.first as? LegacyMenuItem,
let indexPath = menuItem.indexPath else { return }
Expand All @@ -1776,6 +1786,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
}

private func selectMore(at indexPath: IndexPath) {
cancelSearch()
setEditing(isEditing: true, selectedAtIndexPath: indexPath)
if UIAccessibility.isVoiceOverRunning {
forceVoiceOverFocussingCell(at: indexPath, postingFinished: nil)
Expand Down Expand Up @@ -2614,11 +2625,7 @@ extension ChatViewController: UISearchBarDelegate {
}

func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
searchController.isActive = false
configureDraftArea(draft: draft)
becomeFirstResponder()
navigationItem.searchController = nil
reloadData()
cancelSearch()
}
}

Expand Down

0 comments on commit d7205fd

Please sign in to comment.