diff --git a/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp b/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp index b722d289b5..353638acab 100644 --- a/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp +++ b/iphone/Maps/UI/Discovery/DiscoveryControllerViewModel.hpp @@ -26,16 +26,13 @@ public: switch (type) { case ItemType::Attractions: - m_attractions.m_viewportCenter = viewportCenter; - m_attractions.m_results = res; + m_attractions.SetResults(res, productInfo, viewportCenter); break; case ItemType::Cafes: - m_cafes.m_viewportCenter = viewportCenter; - m_cafes.m_results = res; + m_cafes.SetResults(res, productInfo, viewportCenter); break; case ItemType::Hotels: - m_hotels.m_viewportCenter = viewportCenter; - m_hotels.m_results = res; + m_hotels.SetResults(res, productInfo, viewportCenter); break; default: break; } @@ -64,20 +61,28 @@ public: search::Result const & GetAttractionAt(size_t const index) const { - CHECK_LESS(index, m_attractions.m_results.GetCount(), ("Incorrect attractions index:", index)); - return m_attractions.m_results[index]; + return m_attractions.GetSearchResultAt(index); } m2::PointD const & GetAttractionReferencePoint() const { return m_attractions.m_viewportCenter; } + search::ProductInfo const & GetAttractionProductInfoAt(size_t const index) const + { + return m_attractions.GetProductInfoAt(index); + } + search::Result const & GetCafeAt(size_t const index) const { - CHECK_LESS(index, m_cafes.m_results.GetCount(), ("Incorrect cafes index:", index)); - return m_cafes.m_results[index]; + return m_cafes.GetSearchResultAt(index); } m2::PointD const & GetCafeReferencePoint() const { return m_cafes.m_viewportCenter; } + search::ProductInfo const & GetCafeProductInfoAt(size_t const index) const + { + return m_cafes.GetProductInfoAt(index); + } + locals::LocalExpert const & GetExpertAt(size_t const index) const { CHECK_LESS(index, m_experts.size(), ("Incorrect experts index:", index)); @@ -86,8 +91,7 @@ public: search::Result const & GetHotelAt(size_t const index) const { - CHECK_LESS(index, m_hotels.m_results.GetCount(), ("Incorrect hotels index:", index)); - return m_hotels.m_results[index]; + return m_hotels.GetSearchResultAt(index); } m2::PointD const & GetHotelReferencePoint() const { return m_hotels.m_viewportCenter; } @@ -97,6 +101,28 @@ private: { m2::PointD m_viewportCenter; search::Results m_results; + std::vector m_productInfos; + + void SetResults(search::Results const & res, + std::vector const & productInfo, + m2::PointD const & viewportCenter) + { + m_viewportCenter = viewportCenter; + m_results = res; + m_productInfos = productInfo; + } + + search::Result const & GetSearchResultAt(size_t const index) const + { + CHECK_LESS(index, m_results.GetCount(), ("Incorrect index:", index)); + return m_results[index]; + } + + search::ProductInfo const & GetProductInfoAt(size_t const index) const + { + CHECK_LESS(index, m_productInfos.size(), ("Incorrect index:", index)); + return m_productInfos[index]; + } }; UISearchResults m_attractions; diff --git a/iphone/Maps/UI/Discovery/DiscoverySearchCell.swift b/iphone/Maps/UI/Discovery/DiscoverySearchCell.swift index d018dc110c..44f90deed2 100644 --- a/iphone/Maps/UI/Discovery/DiscoverySearchCell.swift +++ b/iphone/Maps/UI/Discovery/DiscoverySearchCell.swift @@ -1,16 +1,38 @@ @objc(MWMDiscoverySearchCell) final class DiscoverySearchCell: UICollectionViewCell { - @IBOutlet private weak var title: UILabel! - @IBOutlet private weak var subtitle: UILabel! - @IBOutlet private weak var distance: UILabel! + @IBOutlet private weak var titleLabel: UILabel! + @IBOutlet private weak var subtitleLabel: UILabel! + @IBOutlet private weak var distanceLabel: UILabel! + @IBOutlet private weak var popularView: UIView! { + didSet { + popularView.tintColor = UIColor.linkBlue() + } + } + @IBOutlet private weak var ratingView: RatingSummaryView! { + didSet { + ratingView.defaultConfig() + ratingView.textFont = UIFont.bold12() + ratingView.textSize = 12 + } + } + typealias Tap = () -> () private var tap: Tap? - @objc func config(title: String, subtitle: String, distance: String, tap: @escaping Tap) { - self.title.text = title - self.subtitle.text = subtitle - self.distance.text = distance + @objc func config(title: String, + subtitle: String, + distance: String, + popular: Bool, + ratingValue: String, + ratingType: MWMRatingSummaryViewValueType, + tap: @escaping Tap) { + titleLabel.text = title + subtitleLabel.text = subtitle + distanceLabel.text = distance + popularView.isHidden = !popular + ratingView.value = ratingValue + ratingView.type = ratingType self.tap = tap } diff --git a/iphone/Maps/UI/Discovery/DiscoverySearchCell.xib b/iphone/Maps/UI/Discovery/DiscoverySearchCell.xib index 67b98dbe7f..c6c9e87a61 100644 --- a/iphone/Maps/UI/Discovery/DiscoverySearchCell.xib +++ b/iphone/Maps/UI/Discovery/DiscoverySearchCell.xib @@ -1,25 +1,25 @@ - + - + - - + + - + - - + + + + + - + + - + + @@ -92,11 +165,20 @@ - - - + + + + + - + + + + + + + + diff --git a/iphone/Maps/UI/Discovery/DiscoverySearchCollectionHolderCell.xib b/iphone/Maps/UI/Discovery/DiscoverySearchCollectionHolderCell.xib index 2e0aa74689..125797a567 100644 --- a/iphone/Maps/UI/Discovery/DiscoverySearchCollectionHolderCell.xib +++ b/iphone/Maps/UI/Discovery/DiscoverySearchCollectionHolderCell.xib @@ -1,26 +1,26 @@ - + - + - - + + - + - + - + - + @@ -65,7 +65,7 @@ - + diff --git a/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm b/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm index a0ebca257f..5a260795fb 100644 --- a/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm +++ b/iphone/Maps/UI/Discovery/MWMDiscoveryTableManager.mm @@ -376,9 +376,15 @@ string GetDistance(m2::PointD const & from, m2::PointD const & to) : model.GetCafeAt(indexPath.row); auto const & pt = type == ItemType::Attractions ? model.GetAttractionReferencePoint() : model.GetCafeReferencePoint(); + auto const & pi = type == ItemType::Attractions ? model.GetAttractionProductInfoAt(indexPath.row) + : model.GetCafeProductInfoAt(indexPath.row); + tie(ratingValue, ratingType) = FormattedRating(pi.m_ugcRating); [cell configWithTitle:@(sr.GetString().c_str()) subtitle:@(sr.GetFeatureTypeName().c_str()) distance:@(GetDistance(pt, sr.GetFeatureCenter()).c_str()) + popular:sr.GetRankingInfo().m_popularity > 0 + ratingValue:ratingValue + ratingType:ratingType tap:^{ [self.delegate routeToItem:type atIndex:indexPath.row]; }]; diff --git a/xcode/common.xcconfig b/xcode/common.xcconfig index 6d4bc253b2..0e56a621ee 100644 --- a/xcode/common.xcconfig +++ b/xcode/common.xcconfig @@ -1,4 +1,4 @@ -CURRENT_PROJECT_VERSION = 8.2.9 +CURRENT_PROJECT_VERSION = 8.3.0 // Paths OMIM_ROOT = $(PROJECT_DIR)/../..