diff --git a/iphone/Maps/Classes/MWMPlacePageData.h b/iphone/Maps/Classes/MWMPlacePageData.h index 4c1b6ef4af..2995ec0d82 100644 --- a/iphone/Maps/Classes/MWMPlacePageData.h +++ b/iphone/Maps/Classes/MWMPlacePageData.h @@ -35,7 +35,8 @@ enum class MetainfoRows Cuisine, Operator, Internet, - Coordinate + Coordinate, + Taxi }; enum class ButtonsRows @@ -118,6 +119,8 @@ enum class OpeningHours - (m2::PointD const &)mercator; - (ms::LatLon)latLon; +- (NSArray *)statisticsTags; + // TODO(Vlad): Use MWMSettings to store coordinate format. + (void)toggleCoordinateSystem; diff --git a/iphone/Maps/Classes/MWMPlacePageData.mm b/iphone/Maps/Classes/MWMPlacePageData.mm index 37299b848c..bd3338101b 100644 --- a/iphone/Maps/Classes/MWMPlacePageData.mm +++ b/iphone/Maps/Classes/MWMPlacePageData.mm @@ -110,6 +110,8 @@ using namespace place_page; m_metainfoRows.push_back(MetainfoRows::Address); m_metainfoRows.push_back(MetainfoRows::Coordinate); + if (m_info.IsReachableByTaxi()) + m_metainfoRows.push_back(MetainfoRows::Taxi); } - (void)fillButtonsSection @@ -331,6 +333,7 @@ using namespace place_page; { switch (row) { + case MetainfoRows::Taxi: case MetainfoRows::ExtendedOpeningHours: return nil; case MetainfoRows::OpeningHours: return @(m_info.GetOpeningHours().c_str()); case MetainfoRows::Phone: return @(m_info.GetPhone().c_str()); @@ -371,4 +374,14 @@ using namespace place_page; [ud synchronize]; } +#pragma mark - Stats + +- (NSArray *)statisticsTags +{ + NSMutableArray * result = [@[] mutableCopy]; + for (auto const & s : m_info.GetRawTypes()) + [result addObject:@(s.c_str())]; + return result.copy; +} + @end diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm index 3f153e4c9e..504cd8b362 100644 --- a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm @@ -79,7 +79,8 @@ name = @"coordinate"; break; case MetainfoRows::ExtendedOpeningHours: - case MetainfoRows::OpeningHours: NSAssert(false, @"Incorrect cell type!"); break; + case MetainfoRows::OpeningHours: + case MetainfoRows::Taxi: NSAssert(false, @"Incorrect cell type!"); break; } [self configWithIconName:name data:[data stringForRow:row]]; } @@ -152,7 +153,8 @@ case MetainfoRows::Operator: case MetainfoRows::OpeningHours: case MetainfoRows::Address: - case MetainfoRows::Internet: break; + case MetainfoRows::Internet: + case MetainfoRows::Taxi: break; } } diff --git a/iphone/Maps/Classes/MWMPlacePageLayout.mm b/iphone/Maps/Classes/MWMPlacePageLayout.mm index 4f93d3e0fa..0241e8a1c0 100644 --- a/iphone/Maps/Classes/MWMPlacePageLayout.mm +++ b/iphone/Maps/Classes/MWMPlacePageLayout.mm @@ -3,12 +3,13 @@ #import "MWMCircularProgress.h" #import "MWMiPadPlacePageLayoutImpl.h" #import "MWMiPhonePlacePageLayoutImpl.h" +#import "MWMOpeningHoursLayoutHelper.h" #import "MWMPlacePageButtonCell.h" #import "MWMPlacePageCellUpdateProtocol.h" #import "MWMPlacePageData.h" #import "MWMPlacePageInfoCell.h" #import "MWMPlacePageLayoutImpl.h" -#import "MWMOpeningHoursLayoutHelper.h" +#import "MWMPlacePageTaxiCell.h" #import "MWMPPPreviewLayoutHelper.h" #import "UIColor+MapsMeColor.h" @@ -31,7 +32,8 @@ map const kMetaInfoCells = { {MetainfoRows::Cuisine, @"PlacePageInfoCell"}, {MetainfoRows::Operator, @"PlacePageInfoCell"}, {MetainfoRows::Coordinate, @"PlacePageInfoCell"}, - {MetainfoRows::Internet, @"PlacePageInfoCell"}}; + {MetainfoRows::Internet, @"PlacePageInfoCell"}, + {MetainfoRows::Taxi, @"MWMPlacePageTaxiCell"}}; array const kButtonsCells = {{@"MWMPlacePageButtonCell"}}; @@ -340,6 +342,12 @@ array const kButtonsCells = {{@"MWMPlacePageButtonCell"}}; [c configWithRow:row data:data]; return c; } + case MetainfoRows::Taxi: + { + MWMPlacePageTaxiCell * c = [tableView dequeueReusableCellWithIdentifier:kMetaInfoCells.at(row)]; + c.delegate = delegate; + return c; + } } } case Sections::Buttons: diff --git a/iphone/Maps/Classes/MWMPlacePageManager.mm b/iphone/Maps/Classes/MWMPlacePageManager.mm index a1bbe01bf4..2801ef6452 100644 --- a/iphone/Maps/Classes/MWMPlacePageManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageManager.mm @@ -175,6 +175,16 @@ [self closePlacePage]; } +- (void)taxiTo +{ + [Statistics logEvent:kStatPlacePageTaxiClick + withParameters:@{kStatProvider : kStatUber, kStatTags : self.data.statisticsTags}]; + auto router = [MWMRouter router]; + router.type = routing::RouterType::Taxi; + [router buildToPoint:self.target bestRouter:NO]; + [self closePlacePage]; +} + - (MWMRoutePoint)target { NSString * name = nil; diff --git a/iphone/Maps/Classes/MWMPlacePageProtocol.h b/iphone/Maps/Classes/MWMPlacePageProtocol.h index 8a5a4c2835..82dc518086 100644 --- a/iphone/Maps/Classes/MWMPlacePageProtocol.h +++ b/iphone/Maps/Classes/MWMPlacePageProtocol.h @@ -29,6 +29,7 @@ - (void)addBusiness; - (void)book:(BOOL)isDescription; - (void)editBookmark; +- (void)taxiTo; @end diff --git a/iphone/Maps/Classes/MWMPlacePageTaxiCell.h b/iphone/Maps/Classes/MWMPlacePageTaxiCell.h new file mode 100644 index 0000000000..8d3292f415 --- /dev/null +++ b/iphone/Maps/Classes/MWMPlacePageTaxiCell.h @@ -0,0 +1,9 @@ +#import "MWMTableViewCell.h" + +@protocol MWMPlacePageButtonsProtocol; + +@interface MWMPlacePageTaxiCell : MWMTableViewCell + +- (void)setDelegate:(id)delegate; + +@end diff --git a/iphone/Maps/Classes/MWMPlacePageTaxiCell.mm b/iphone/Maps/Classes/MWMPlacePageTaxiCell.mm new file mode 100644 index 0000000000..ccf3e84bf6 --- /dev/null +++ b/iphone/Maps/Classes/MWMPlacePageTaxiCell.mm @@ -0,0 +1,14 @@ +#import "MWMPlacePageTaxiCell.h" +#import "MWMPlacePageProtocol.h" + +@interface MWMPlacePageTaxiCell() + +@property(weak, nonatomic) id delegate; + +@end + +@implementation MWMPlacePageTaxiCell + +- (IBAction)orderTaxi { [self.delegate taxiTo]; } + +@end diff --git a/iphone/Maps/Classes/MWMPlacePageTaxiCell.xib b/iphone/Maps/Classes/MWMPlacePageTaxiCell.xib new file mode 100644 index 0000000000..cf9981eb29 --- /dev/null +++ b/iphone/Maps/Classes/MWMPlacePageTaxiCell.xib @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/Classes/Routing/MWMRouter.mm b/iphone/Maps/Classes/Routing/MWMRouter.mm index d4f0aa5dc9..820ac5e844 100644 --- a/iphone/Maps/Classes/Routing/MWMRouter.mm +++ b/iphone/Maps/Classes/Routing/MWMRouter.mm @@ -162,9 +162,6 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi - (void)rebuildWithBestRouter:(BOOL)bestRouter { [self clearAltitudeImagesData]; - // Taxi can't be used as best router. - if ([MWMRouter isTaxi]) - bestRouter = NO; bool isP2P = false; if (self.startPoint.IsMyPosition()) @@ -193,7 +190,8 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi auto & f = GetFramework(); auto const & startPoint = self.startPoint.Point(); auto const & finishPoint = self.finishPoint.Point(); - if (bestRouter) + // Taxi can't be used as best router. + if (bestRouter && ![MWMRouter isTaxi]) self.type = GetFramework().GetBestRouter(startPoint, finishPoint); f.BuildRoute(startPoint, finishPoint, isP2P, 0 /* timeoutSec */); f.SetRouteStartPoint(startPoint, isMarkerPoint(self.startPoint)); diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/Contents.json new file mode 100644 index 0000000000..513dad0d26 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/Contents.json @@ -0,0 +1,26 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_placepage_taxi.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_placepage_taxi@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_placepage_taxi@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi.png b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi.png new file mode 100644 index 0000000000..54a64703c6 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@2x.png b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@2x.png new file mode 100644 index 0000000000..f908857a1b Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@3x.png b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@3x.png new file mode 100644 index 0000000000..0c87a5096d Binary files /dev/null and b/iphone/Maps/Images.xcassets/Place Page/ic_placepage_taxi.imageset/ic_placepage_taxi@3x.png differ diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index acead740a7..3e3acd4139 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -1186,6 +1186,12 @@ F626D5301C3E840600C17D15 /* MWMNightModeController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B2E61E1C3D5F31005562DF /* MWMNightModeController.mm */; }; F626D5331C3E846E00C17D15 /* UIImageView+Coloring.mm in Sources */ = {isa = PBXBuildFile; fileRef = F62F1D941C3281F1006CF38E /* UIImageView+Coloring.mm */; }; F62F1D951C3281F1006CF38E /* UIImageView+Coloring.mm in Sources */ = {isa = PBXBuildFile; fileRef = F62F1D941C3281F1006CF38E /* UIImageView+Coloring.mm */; }; + F63421EF1DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F63421EE1DF975A800A96868 /* MWMPlacePageTaxiCell.mm */; }; + F63421F01DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F63421EE1DF975A800A96868 /* MWMPlacePageTaxiCell.mm */; }; + F63421F11DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F63421EE1DF975A800A96868 /* MWMPlacePageTaxiCell.mm */; }; + F63421F31DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F63421F21DF975CB00A96868 /* MWMPlacePageTaxiCell.xib */; }; + F63421F41DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F63421F21DF975CB00A96868 /* MWMPlacePageTaxiCell.xib */; }; + F63421F51DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F63421F21DF975CB00A96868 /* MWMPlacePageTaxiCell.xib */; }; F634C8F01D79994900BE04E2 /* _MWMPPPTitle.xib in Resources */ = {isa = PBXBuildFile; fileRef = F634C8EF1D79994900BE04E2 /* _MWMPPPTitle.xib */; }; F634C8F11D79994900BE04E2 /* _MWMPPPTitle.xib in Resources */ = {isa = PBXBuildFile; fileRef = F634C8EF1D79994900BE04E2 /* _MWMPPPTitle.xib */; }; F634C8F31D79996D00BE04E2 /* _MWMPPPExternalTitle.xib in Resources */ = {isa = PBXBuildFile; fileRef = F634C8F21D79996D00BE04E2 /* _MWMPPPExternalTitle.xib */; }; @@ -2010,6 +2016,9 @@ F626D52D1C3E6CAA00C17D15 /* MWMTableViewCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMTableViewCell.mm; sourceTree = ""; }; F62F1D931C3281F1006CF38E /* UIImageView+Coloring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+Coloring.h"; sourceTree = ""; }; F62F1D941C3281F1006CF38E /* UIImageView+Coloring.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIImageView+Coloring.mm"; sourceTree = ""; }; + F63421ED1DF975A800A96868 /* MWMPlacePageTaxiCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageTaxiCell.h; sourceTree = ""; }; + F63421EE1DF975A800A96868 /* MWMPlacePageTaxiCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageTaxiCell.mm; sourceTree = ""; }; + F63421F21DF975CB00A96868 /* MWMPlacePageTaxiCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageTaxiCell.xib; sourceTree = ""; }; F634C8EF1D79994900BE04E2 /* _MWMPPPTitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = _MWMPPPTitle.xib; sourceTree = ""; }; F634C8F21D79996D00BE04E2 /* _MWMPPPExternalTitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = _MWMPPPExternalTitle.xib; sourceTree = ""; }; F634C8F51D79997700BE04E2 /* _MWMPPPSubtitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = _MWMPPPSubtitle.xib; sourceTree = ""; }; @@ -3723,6 +3732,9 @@ 3491E7C81C06F1F10042FE24 /* MWMPlacePageButtonCell.h */, 3491E7C91C06F1F10042FE24 /* MWMPlacePageButtonCell.mm */, 3491E7CA1C06F1F10042FE24 /* MWMPlacePageButtonCell.xib */, + F63421ED1DF975A800A96868 /* MWMPlacePageTaxiCell.h */, + F63421EE1DF975A800A96868 /* MWMPlacePageTaxiCell.mm */, + F63421F21DF975CB00A96868 /* MWMPlacePageTaxiCell.xib */, ); name = Cells; sourceTree = ""; @@ -4135,6 +4147,7 @@ 34AB04B71CEC95B500CE8B36 /* MWMEditorAdditionalNamePlaceholderTableViewCell.xib in Resources */, FA46DA2C12D4166E00968C36 /* countries.txt in Resources */, 671182E21C7F0DD400CB8177 /* packed_polygons_obsolete.bin in Resources */, + F63421F31DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */, 4A23D15C1B8B4DD700D4EB6F /* resources-6plus_clear in Resources */, 341F99DB1C6B1165001C67B8 /* MWMMapDownloaderPlaceTableViewCell.xib in Resources */, EE583CBB12F773F00042CBE3 /* unicode_blocks.txt in Resources */, @@ -4301,6 +4314,7 @@ 34AB04B81CEC95B500CE8B36 /* MWMEditorAdditionalNamePlaceholderTableViewCell.xib in Resources */, 6741A9481BF340DE002C974C /* MWMSearchTabbedCollectionViewCell.xib in Resources */, 6741A9491BF340DE002C974C /* countries.txt in Resources */, + F63421F41DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */, F69E91211D994D1A00D7A778 /* MWMOpeningHoursCell.xib in Resources */, 6741A94A1BF340DE002C974C /* resources-6plus_clear in Resources */, 6741A94B1BF340DE002C974C /* unicode_blocks.txt in Resources */, @@ -4479,6 +4493,7 @@ 849CF6001DE842290024A8A5 /* MWMPPView.xib in Resources */, 849CF6011DE842290024A8A5 /* MWMDownloaderDialogHeader.xib in Resources */, 849CF6021DE842290024A8A5 /* World.mwm in Resources */, + F63421F51DF975CB00A96868 /* MWMPlacePageTaxiCell.xib in Resources */, 849CF6031DE842290024A8A5 /* resources-hdpi_dark in Resources */, 849CF6041DE842290024A8A5 /* 01_dejavusans.ttf in Resources */, 849CF6051DE842290024A8A5 /* 02_droidsans-fallback.ttf in Resources */, @@ -4872,6 +4887,7 @@ F69AEEB91DDB263E00BE034A /* MWMOpeningHoursLayoutHelper.mm in Sources */, 341F99DD1C6B1165001C67B8 /* MWMMapDownloaderSubplaceTableViewCell.mm in Sources */, 343FAC4A1CBFBDFC00A45D3B /* MWMNoMapsView.mm in Sources */, + F63421EF1DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */, 6BA0BCD11B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm in Sources */, 978F9244183B660F000D6C7C /* SwitchCell.mm in Sources */, 342AD7721B53D32F00E0B997 /* UIView+RuntimeAttributes.mm in Sources */, @@ -5125,6 +5141,7 @@ F69AEEBA1DDB263E00BE034A /* MWMOpeningHoursLayoutHelper.mm in Sources */, F626D5331C3E846E00C17D15 /* UIImageView+Coloring.mm in Sources */, 343FAC4B1CBFBDFC00A45D3B /* MWMNoMapsView.mm in Sources */, + F63421F01DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */, 6741AA191BF340DE002C974C /* MWMDownloaderDialogCell.mm in Sources */, 6741AA1B1BF340DE002C974C /* MWMDirectionView.mm in Sources */, 3491E7CC1C06F1F10042FE24 /* MWMPlacePageButtonCell.mm in Sources */, @@ -5195,6 +5212,7 @@ 849CF68D1DE842290024A8A5 /* MWMLocationManager.mm in Sources */, 849CF68E1DE842290024A8A5 /* MWMMapDownloaderAdsTableViewCell.mm in Sources */, 849CF68F1DE842290024A8A5 /* MWMSearchShowOnMapCell.mm in Sources */, + F63421F11DF975A800A96868 /* MWMPlacePageTaxiCell.mm in Sources */, 849CF6901DE842290024A8A5 /* MWMSearchTabButtonsView.mm in Sources */, 849CF6911DE842290024A8A5 /* MWMSideButtons.mm in Sources */, 849CF6921DE842290024A8A5 /* MWMMapDownloaderDataSource.mm in Sources */, diff --git a/iphone/Maps/Statistics/StatisticsStrings.h b/iphone/Maps/Statistics/StatisticsStrings.h index bc8a509887..94215cfde9 100644 --- a/iphone/Maps/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Statistics/StatisticsStrings.h @@ -157,6 +157,7 @@ static NSString * const kPlacePageHotelBook = @"Placepage_Hotel_book"; static NSString * const kPlacePageHotelDetails = @"Placepage_Hotel_details"; static NSString * const kStatPlacePageNonBuilding = @"placepage_nonbuilding"; static NSString * const kPlacePageRestaurantBook = @"Placepage_Restaurant_book"; +static NSString * const kStatPlacePageTaxiClick = @"Placepage_Taxi_click"; static NSString * const kStatPointToPoint = @"Point to point"; static NSString * const kStatPortrait = @"Portrait"; static NSString * const kStatProblem = @"Problem"; @@ -198,6 +199,7 @@ static NSString * const kStatSwapRoutingPoints = @"Swap routing points"; static NSString * const kStatTTS = @"TTS"; static NSString * const kStatTTSSettings = @"TTS settings"; static NSString * const kStatTable = @"Table"; +static NSString * const kStatTags = @"tags"; static NSString * const kStatToLocation = @"to_location"; static NSString * const kStatToMyPosition = @"To my position"; static NSString * const kStatToggleBookmark = @"Toggle bookmark";