diff --git a/iphone/Maps/Core/Search/MWMSearch.mm b/iphone/Maps/Core/Search/MWMSearch.mm index 79734734d4..2cfc66ebf1 100644 --- a/iphone/Maps/Core/Search/MWMSearch.mm +++ b/iphone/Maps/Core/Search/MWMSearch.mm @@ -61,7 +61,7 @@ using Observers = NSHashTable; - (void)searchEverywhere { self.lastSearchTimestamp += 1; NSUInteger const timestamp = self.lastSearchTimestamp; - + search::EverywhereSearchParams params{ m_query, m_locale, {} /* default timeout */, m_isCategory, // m_onResults @@ -156,6 +156,7 @@ using Observers = NSHashTable; + (void)showResultAtIndex:(NSUInteger)index { auto const & result = [MWMSearch manager]->m_everywhereResults[index]; + GetFramework().StopLocationFollow(); GetFramework().SelectSearchResult(result, true); } @@ -168,8 +169,13 @@ using Observers = NSHashTable; + (void)showEverywhereSearchResultsOnMap { MWMSearch * manager = [MWMSearch manager]; - if (![MWMRouter isRoutingActive]) - GetFramework().ShowSearchResults(manager->m_everywhereResults); + if (![MWMRouter isRoutingActive]) { + auto const & results = manager->m_everywhereResults; + if (results.GetCount() == 1) + [self showResultAtIndex:0]; + else + GetFramework().ShowSearchResults(manager->m_everywhereResults); + } } + (void)showViewportSearchResultsOnMap { diff --git a/iphone/Maps/UI/Search/SearchOnMap/SearchOnMapInteractor.swift b/iphone/Maps/UI/Search/SearchOnMap/SearchOnMapInteractor.swift index d56e7f9995..fc6499f4c3 100644 --- a/iphone/Maps/UI/Search/SearchOnMap/SearchOnMapInteractor.swift +++ b/iphone/Maps/UI/Search/SearchOnMap/SearchOnMapInteractor.swift @@ -70,12 +70,12 @@ final class SearchOnMapInteractor: NSObject { searchManager.saveQuery(searchText.text, forInputLocale: searchText.locale) showResultsOnMap = true + searchManager.showEverywhereSearchResultsOnMap() return .showOnTheMap } private func processTypedText(_ searchText: SearchOnMap.SearchText) -> SearchOnMap.Response { isUpdatesDisabled = false - showResultsOnMap = true searchManager.searchQuery(searchText.text, forInputLocale: searchText.locale, withCategory: false)