Skip to content

Commit

Permalink
when tapping 'Chats' multiple times, end search
Browse files Browse the repository at this point in the history
when tapping 'Chats' when chats is already selected,
the gist is to bring the view into kind of default -
so that you see eg. the messages annonced by a badge counter.

PR #2127 did a scroll-to-top for this purpose,
this PR additionally ends search.
  • Loading branch information
r10s committed Jul 16, 2024
1 parent a47a003 commit 98b8739
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion deltachat-ios/Controller/ChatListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ class ChatListViewController: UITableViewController {
tableView.rowHeight = ContactCell.cellHeight
}
}
private func quitSearch(animated: Bool) {

func quitSearch(animated: Bool) {
searchController.searchBar.text = nil
self.viewModel?.endSearch()
searchController.dismiss(animated: animated) {
Expand Down
9 changes: 7 additions & 2 deletions deltachat-ios/Coordinator/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,13 @@ extension AppCoordinator: UITabBarControllerDelegate {
if let navigationController = viewController as? UINavigationController,
let chatListViewController = navigationController.viewControllers.first as? ChatListViewController,
let chatsTab = tabBarController.selectedViewController as? UINavigationController,
chatsTab.topViewController == chatListViewController {
chatListViewController.tableView.scrollToTop(animated: true)
chatsTab.topViewController == chatListViewController,
let viewModel = chatListViewController.viewModel {
if viewModel.searchActive {
chatListViewController.quitSearch(animated: true) // this includes scrollToTop()
} else {
chatListViewController.tableView.scrollToTop(animated: true)
}
}

return true
Expand Down

0 comments on commit 98b8739

Please sign in to comment.