diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiPreviewDataSource.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiPreviewDataSource.mm index 31936f999c..c788cd2460 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiPreviewDataSource.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiPreviewDataSource.mm @@ -61,7 +61,7 @@ using namespace taxi; @property(weak, nonatomic) MWMTaxiCollectionView * collectionView; @property(nonatomic) BOOL isNeedToConstructURLs; -@property(nonatomic) RoutePreviewTaxiCellType type; +@property(nonatomic) MWMRoutePreviewTaxiCellType type; @end @@ -77,7 +77,7 @@ using namespace taxi; collectionView.delegate = self; collectionView.showsVerticalScrollIndicator = NO; collectionView.showsHorizontalScrollIndicator = NO; - [collectionView registerWithCellClass:[RoutePreviewTaxiCell class]]; + [collectionView registerWithCellClass:[MWMRoutePreviewTaxiCell class]]; } return self; } @@ -119,12 +119,8 @@ using namespace taxi; self->m_products = products; switch (type) { - case taxi::Provider::Type::Uber: - self.type = RoutePreviewTaxiCellTypeUber; - break; - case taxi::Provider::Type::Yandex: - self.type = RoutePreviewTaxiCellTypeYandex; - break; + case taxi::Provider::Type::Uber: self.type = MWMRoutePreviewTaxiCellTypeUber; break; + case taxi::Provider::Type::Yandex: self.type = MWMRoutePreviewTaxiCellTypeYandex; break; } auto cv = self.collectionView; cv.hidden = NO; @@ -172,9 +168,9 @@ using namespace taxi; NSURL * url; switch (self.type) { - case RoutePreviewTaxiCellTypeTaxi: return NO; - case RoutePreviewTaxiCellTypeUber: url = [NSURL URLWithString:@"uber://"]; break; - case RoutePreviewTaxiCellTypeYandex: url = [NSURL URLWithString:@"yandextaxi://"]; break; + case MWMRoutePreviewTaxiCellTypeTaxi: return NO; + case MWMRoutePreviewTaxiCellTypeUber: url = [NSURL URLWithString:@"uber://"]; break; + case MWMRoutePreviewTaxiCellTypeYandex: url = [NSURL URLWithString:@"yandextaxi://"]; break; } return [[UIApplication sharedApplication] canOpenURL:url]; } @@ -195,9 +191,9 @@ using namespace taxi; Provider::Type type; switch (self.type) { - case RoutePreviewTaxiCellTypeTaxi: return; - case RoutePreviewTaxiCellTypeUber: type = Provider::Type::Uber; break; - case RoutePreviewTaxiCellTypeYandex: type = Provider::Type::Yandex; break; + case MWMRoutePreviewTaxiCellTypeTaxi: return; + case MWMRoutePreviewTaxiCellTypeUber: type = Provider::Type::Uber; break; + case MWMRoutePreviewTaxiCellTypeYandex: type = Provider::Type::Yandex; break; } auto links = engine->GetRideRequestLinks(type, productId, m_from, m_to); @@ -216,8 +212,8 @@ using namespace taxi; - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - Class cls = [RoutePreviewTaxiCell class]; - auto cell = static_cast( + Class cls = [MWMRoutePreviewTaxiCell class]; + auto cell = static_cast( [collectionView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); auto const & product = m_products[indexPath.row]; [cell configWithType:self.type diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift index f4ca08b34c..b3462fb03d 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift @@ -1,11 +1,11 @@ -@objc +@objc(MWMRoutePreviewTaxiCellType) enum RoutePreviewTaxiCellType: Int { case taxi case uber case yandex } -@objc +@objc(MWMRoutePreviewTaxiCell) final class RoutePreviewTaxiCell: UICollectionViewCell { @IBOutlet private weak var icon: UIImageView! diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.xib b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.xib index abb97f72cf..9d967c4a9c 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.xib +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.xib @@ -11,7 +11,7 @@ - + diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index 015a62c7c6..32526442cb 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -161,7 +161,7 @@ using BannerIsReady = void (^)(); - (int8_t)intermediateIndex; // Taxi -- (std::vector)taxiProviders; +- (std::vector const &)taxiProviders; // Banner - (id)nativeAd; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 3a4a577431..2af2bc3101 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -594,7 +594,7 @@ using namespace place_page; } #pragma mark - Taxi -- (std::vector)taxiProviders +- (std::vector const &)taxiProviders { return m_info.ReachableByTaxiProviders(); } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/MWMPlacePageTaxiProvider.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/MWMPlacePageTaxiProvider.h index dce4777b41..701d87c484 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/MWMPlacePageTaxiProvider.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/MWMPlacePageTaxiProvider.h @@ -1,5 +1,5 @@ typedef NS_ENUM(NSInteger, MWMPlacePageTaxiProvider) { - MWMPlacePageTaxiProviderTaxi = 0, - MWMPlacePageTaxiProviderUber = 1, - MWMPlacePageTaxiProviderYandex = 2 + MWMPlacePageTaxiProviderTaxi, + MWMPlacePageTaxiProviderUber, + MWMPlacePageTaxiProviderYandex }; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift index 99abb4f521..1f4f7d8a1f 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift @@ -1,4 +1,4 @@ -@objc +@objc(MWMPlacePageTaxiCell) final class PlacePageTaxiCell: MWMTableViewCell { @IBOutlet private weak var icon: UIImageView! diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.xib b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.xib index 8ed20d00bf..a03773da77 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.xib +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.xib @@ -11,7 +11,7 @@ - + diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index 5e6c277d99..777be83d25 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -101,7 +101,7 @@ map const kMetaInfoCells = { [tv registerWithCellClass:[MWMPPReviewHeaderCell class]]; [tv registerWithCellClass:[MWMPPReviewCell class]]; [tv registerWithCellClass:[MWMPPFacilityCell class]]; - [tv registerWithCellClass:[PlacePageTaxiCell class]]; + [tv registerWithCellClass:[MWMPlacePageTaxiCell class]]; // Register all meta info cells. for (auto const & pair : kMetaInfoCells) @@ -390,9 +390,9 @@ map const kMetaInfoCells = { } case Sections::Ad: { - Class cls = [PlacePageTaxiCell class]; - auto c = static_cast([tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); - auto taxiProviders = [data taxiProviders]; + Class cls = [MWMPlacePageTaxiCell class]; + auto c = static_cast([tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); + auto const & taxiProviders = [data taxiProviders]; NSAssert(!taxiProviders.empty(), @"TaxiProviders can not be empty"); auto const & provider = taxiProviders.front(); auto type = MWMPlacePageTaxiProviderTaxi; diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index dd9b29948b..aef42b4385 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -215,11 +215,8 @@ vector Info::GetBanners() const return m_adsEngine->GetBanners(m_types, m_topmostCountryIds, languages::GetCurrentNorm()); } -std::vector Info::ReachableByTaxiProviders() const +std::vector const & Info::ReachableByTaxiProviders() const { - if (!IsReachableByTaxiChecker::Instance()(m_types)) - return {}; - return m_reachableByProviders; } diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 1b2e2a3eac..ba87d3ce2a 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -105,7 +105,7 @@ public: bool HasBanner() const; vector GetBanners() const; - std::vector ReachableByTaxiProviders() const; + std::vector const & ReachableByTaxiProviders() const; void SetMercator(m2::PointD const & mercator);