diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.h b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.h index 8255c7293f..6eaff57e94 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.h @@ -4,6 +4,6 @@ @interface MWMSearchCell : MWMTableViewCell -- (void)config:(search::Result &)result; +- (void)config:(search::Result const &)result; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm index b811183d25..502eaea767 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCell.mm @@ -25,11 +25,8 @@ sl.rasterizationScale = UIScreen.mainScreen.scale; } -- (void)config:(search::Result &)result +- (void)config:(search::Result const &)result { - if (result.GetResultType() == search::Result::RESULT_FEATURE) - GetFramework().LoadSearchResultMetadata(result); - NSString * title = @(result.GetString().c_str()); if (!title) { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.h b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.h index db9851397d..36a3fb69c6 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.h @@ -7,6 +7,6 @@ + (CGFloat)defaultCellHeight; - (CGFloat)cellHeight; -- (void)config:(search::Result &)result forHeight:(BOOL)forHeight; +- (void)config:(search::Result const &)result forHeight:(BOOL)forHeight; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm index 7b483470b2..04cb6baf23 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.mm @@ -28,10 +28,15 @@ @implementation MWMSearchCommonCell -- (void)config:(search::Result &)result forHeight:(BOOL)forHeight +- (void)config:(search::Result const &)result forHeight:(BOOL)forHeight { [super config:result]; self.typeLabel.text = @(result.GetFeatureType().c_str()).capitalizedString; + auto const & ratingStr = result.GetHotelRating(); + self.ratingLabel.text = + ratingStr.empty() ? @"" : [NSString stringWithFormat:L(@"place_page_booking_rating"), + ratingStr.c_str()]; + self.priceLabel.text = @(result.GetHotelApproximatePricing().c_str()); self.locationLabel.text = @(result.GetAddress().c_str()); [self.locationLabel sizeToFit]; @@ -54,11 +59,6 @@ case osm::No: self.closedView.hidden = NO; break; } - auto const & ratingStr = result.GetHotelRating(); - self.ratingLabel.text = - ratingStr.empty() ? @"" : [NSString stringWithFormat:L(@"place_page_booking_rating"), - result.GetHotelRating().c_str()]; - self.priceLabel.text = @(result.GetHotelApproximatePricing().c_str()); if (result.HasPoint()) { string distanceStr; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.xib b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.xib index 0ad17e5766..18de3e98ed 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.xib +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchCommonCell.xib @@ -199,16 +199,6 @@ - + @@ -247,18 +247,18 @@ + + - - diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchTableViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchTableViewController.mm index 8e19935986..88fd097906 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchTableViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TableView/MWMSearchTableViewController.mm @@ -98,7 +98,7 @@ NSString * identifierForType(MWMSearchTableCellType type) } } -- (search::Result &)searchResultForIndexPath:(NSIndexPath *)indexPath +- (search::Result const &)searchResultForIndexPath:(NSIndexPath *)indexPath { MWMSearchTableCellType firstCellType = [self cellTypeForIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; @@ -147,7 +147,7 @@ NSString * identifierForType(MWMSearchTableCellType type) #pragma mark - Config cells - (void)configSuggestionCell:(MWMSearchSuggestionCell *)cell - result:(search::Result &)result + result:(search::Result const &)result isLastCell:(BOOL)isLastCell { [cell config:result]; diff --git a/map/framework.cpp b/map/framework.cpp index a18a91252d..812761b6c2 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1341,23 +1341,6 @@ bool Framework::QueryMayBeSkipped(search::SearchParams const & params, return true; } -void Framework::LoadSearchResultMetadata(search::Result & res) const -{ - if (res.m_metadata.m_isInitialized || res.GetResultType() != search::Result::RESULT_FEATURE) - return; - - FeatureID const & id = res.GetFeatureID(); - ASSERT(id.IsValid(), ("Search result doesn't contain valid FeatureID.")); - // TODO @yunikkk refactor to format search result metadata accordingly with place_page::Info - - FeatureType ft; - if (!GetFeatureByID(id, ft)) - return; - - search::ProcessMetadata(ft, res.m_metadata); - // res.m_metadata.m_isInitialized is set to true in ProcessMetadata. -} - void Framework::ShowSearchResult(search::Result const & res) { CancelInteractiveSearch(); diff --git a/map/framework.hpp b/map/framework.hpp index 4bdf0902e8..33888c5837 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -431,8 +431,6 @@ public: bool SearchInDownloader(storage::DownloaderSearchParams const & params); bool GetCurrentPosition(double & lat, double & lon) const; - void LoadSearchResultMetadata(search::Result & res) const; - void ShowSearchResult(search::Result const & res); size_t ShowSearchResults(search::Results const & results);