mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 06:33:42 +00:00
[ios] refactor search - use SearchQuery class instead of text+locale+isCategory
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
09171651ff
commit
96c24cf973
@@ -18,7 +18,6 @@ protocol ModallyPresentedViewController: AnyObject {
|
||||
final class SearchOnMapViewController: UIViewController {
|
||||
typealias ViewModel = SearchOnMap.ViewModel
|
||||
typealias Content = SearchOnMap.ViewModel.Content
|
||||
typealias SearchText = SearchOnMap.SearchText
|
||||
|
||||
fileprivate enum Constants {
|
||||
static let estimatedRowHeight: CGFloat = 80
|
||||
@@ -417,7 +416,7 @@ extension SearchOnMapViewController: UITableViewDataSource {
|
||||
extension SearchOnMapViewController: UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
let result = searchResults[indexPath.row]
|
||||
interactor?.handle(.didSelectResult(result, withSearchText: headerView.searchText))
|
||||
interactor?.handle(.didSelectResult(result, withQuery: headerView.searchQuery))
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
}
|
||||
|
||||
@@ -437,12 +436,12 @@ extension SearchOnMapViewController: SearchOnMapHeaderViewDelegate {
|
||||
interactor?.handle(.clearButtonDidTap)
|
||||
return
|
||||
}
|
||||
interactor?.handle(.didType(SearchText(searchText, locale: searchBar.textInputMode?.primaryLanguage)))
|
||||
interactor?.handle(.didType(SearchQuery(searchText, locale: searchBar.textInputMode?.primaryLanguage, source: .typedText)))
|
||||
}
|
||||
|
||||
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
|
||||
guard let searchText = searchBar.text, !searchText.isEmpty else { return }
|
||||
interactor?.handle(.searchButtonDidTap(SearchText(searchText, locale: searchBar.textInputMode?.primaryLanguage)))
|
||||
interactor?.handle(.searchButtonDidTap(SearchQuery(searchText, locale: searchBar.textInputMode?.primaryLanguage, source: .typedText)))
|
||||
}
|
||||
|
||||
func cancelButtonDidTap() {
|
||||
@@ -456,8 +455,8 @@ extension SearchOnMapViewController: SearchOnMapHeaderViewDelegate {
|
||||
|
||||
// MARK: - SearchTabViewControllerDelegate
|
||||
extension SearchOnMapViewController: SearchTabViewControllerDelegate {
|
||||
func searchTabController(_ viewController: SearchTabViewController, didSearch text: String, withCategory: Bool) {
|
||||
interactor?.handle(.didSelectText(SearchText(text, locale: nil), isCategory: withCategory))
|
||||
func searchTabController(_ viewController: SearchTabViewController, didSearch query: SearchQuery) {
|
||||
interactor?.handle(.didSelect(query))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user