[MAPSME-4614] Review fixes.

This commit is contained in:
Ilya Grechuhin 2017-06-30 16:22:34 +03:00 committed by Sergey Yershov
parent 3a5efc96f1
commit f79fd4455a
11 changed files with 28 additions and 35 deletions

View file

@ -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<RoutePreviewTaxiCell *>(
Class cls = [MWMRoutePreviewTaxiCell class];
auto cell = static_cast<MWMRoutePreviewTaxiCell *>(
[collectionView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
auto const & product = m_products[indexPath.row];
[cell configWithType:self.type

View file

@ -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!

View file

@ -11,7 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="RoutePreviewTaxiCell" id="gTV-IL-0wX" customClass="RoutePreviewTaxiCell" customModule="cm_beta" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="" id="gTV-IL-0wX" customClass="MWMRoutePreviewTaxiCell">
<rect key="frame" x="0.0" y="0.0" width="270" height="64"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">

View file

@ -161,7 +161,7 @@ using BannerIsReady = void (^)();
- (int8_t)intermediateIndex;
// Taxi
- (std::vector<taxi::Provider::Type>)taxiProviders;
- (std::vector<taxi::Provider::Type> const &)taxiProviders;
// Banner
- (id<MWMBanner>)nativeAd;

View file

@ -594,7 +594,7 @@ using namespace place_page;
}
#pragma mark - Taxi
- (std::vector<taxi::Provider::Type>)taxiProviders
- (std::vector<taxi::Provider::Type> const &)taxiProviders
{
return m_info.ReachableByTaxiProviders();
}

View file

@ -1,5 +1,5 @@
typedef NS_ENUM(NSInteger, MWMPlacePageTaxiProvider) {
MWMPlacePageTaxiProviderTaxi = 0,
MWMPlacePageTaxiProviderUber = 1,
MWMPlacePageTaxiProviderYandex = 2
MWMPlacePageTaxiProviderTaxi,
MWMPlacePageTaxiProviderUber,
MWMPlacePageTaxiProviderYandex
};

View file

@ -1,4 +1,4 @@
@objc
@objc(MWMPlacePageTaxiCell)
final class PlacePageTaxiCell: MWMTableViewCell {
@IBOutlet private weak var icon: UIImageView!

View file

@ -11,7 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="PlacePageTaxiCell" rowHeight="66" id="16z-3Y-tuS" customClass="PlacePageTaxiCell" customModule="cm_beta" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="66" id="16z-3Y-tuS" customClass="MWMPlacePageTaxiCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="16z-3Y-tuS" id="5rg-b2-ZRm">

View file

@ -101,7 +101,7 @@ map<MetainfoRows, Class> 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<MetainfoRows, Class> const kMetaInfoCells = {
}
case Sections::Ad:
{
Class cls = [PlacePageTaxiCell class];
auto c = static_cast<PlacePageTaxiCell *>([tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
auto taxiProviders = [data taxiProviders];
Class cls = [MWMPlacePageTaxiCell class];
auto c = static_cast<MWMPlacePageTaxiCell *>([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;

View file

@ -215,11 +215,8 @@ vector<ads::Banner> Info::GetBanners() const
return m_adsEngine->GetBanners(m_types, m_topmostCountryIds, languages::GetCurrentNorm());
}
std::vector<taxi::Provider::Type> Info::ReachableByTaxiProviders() const
std::vector<taxi::Provider::Type> const & Info::ReachableByTaxiProviders() const
{
if (!IsReachableByTaxiChecker::Instance()(m_types))
return {};
return m_reachableByProviders;
}

View file

@ -105,7 +105,7 @@ public:
bool HasBanner() const;
vector<ads::Banner> GetBanners() const;
std::vector<taxi::Provider::Type> ReachableByTaxiProviders() const;
std::vector<taxi::Provider::Type> const & ReachableByTaxiProviders() const;
void SetMercator(m2::PointD const & mercator);