diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm index 07b0d18e4a..4b6c1cceca 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm @@ -161,13 +161,6 @@ BOOL defaultOrientation(CGSize const & size) NSAssert([MWMLocationManager lastLocation], @"Action button is active while my location is not available"); - [Statistics logEvent:kStatRoutingAddPoint - withParameters:@{ - kStatRoutingPointType : kStatRoutingPointTypeStart, - kStatRoutingPointValue : kStatRoutingPointValueMyPosition, - kStatRoutingPointMethod : kStatRoutingPointMethodPlanning, - kStatRoutingMode : kStatRoutingModePlanning - }]; [MWMRouter buildFromPoint:[[MWMRoutePoint alloc] initWithLastLocationAndType:MWMRoutePointTypeStart intermediateIndex:0] diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift index 8b3b025e04..7cb002e6a9 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift @@ -73,6 +73,8 @@ final class RouteManagerViewController: MWMViewController, UITableViewDataSource tv.cellForRow(at: newIP)?.isHidden = true self.indexPath = newIP + + Statistics.logEvent(kStatRouteManagerRearrange) } } @@ -150,6 +152,13 @@ final class RouteManagerViewController: MWMViewController, UITableViewDataSource super.viewDidAppear(animated) dimView.setViews(container: containerView, controller: view, manager: managerView) containerView.insertSubview(chromeView, at: 0) + + Statistics.logEvent(kStatRouteManagerOpen) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + Statistics.logEvent(kStatRouteManagerClose) } override func viewWillLayoutSubviews() { diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 1c78c8e441..c80a8f206a 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -239,21 +239,6 @@ using namespace osm_auth_ios; auto const points = parsedData.m_points; if (points.size() == 2) { - [Statistics logEvent:kStatRoutingAddPoint - withParameters:@{ - kStatRoutingPointType : kStatRoutingPointTypeStart, - kStatRoutingPointValue : kStatRoutingPointValuePoint, - kStatRoutingPointMethod : kStatRoutingPointMethodApi, - kStatRoutingMode : kStatRoutingModePlanning - }]; - [Statistics logEvent:kStatRoutingAddPoint - withParameters:@{ - kStatRoutingPointType : kStatRoutingPointTypeFinish, - kStatRoutingPointValue : kStatRoutingPointValuePoint, - kStatRoutingPointMethod : kStatRoutingPointMethodApi, - kStatRoutingMode : kStatRoutingModePlanning - }]; - auto p1 = [[MWMRoutePoint alloc] initWithURLSchemeRoutePoint:points.front() type:MWMRoutePointTypeStart intermediateIndex:0]; diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index fcebf6583e..fdca417af3 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -185,12 +185,9 @@ static NSString * const kStatPlacePageOwnershipButtonClick = @"Placepage_Ownersh static NSString * const kStatPlacePageRestaurantBook = @"Placepage_Restaurant_book"; static NSString * const kStatPlacePageTaxiClick = @"Placepage_Taxi_click"; static NSString * const kStatPlacepageSponsoredError = @"Placepage_SponsoredGallery_error"; -static NSString * const kStatPlacepageSponsoredItemSelected = - @"Placepage_SponsoredGallery_ProductItem_selected"; -static NSString * const kStatPlacepageSponsoredLogoSelected = - @"Placepage_SponsoredGallery_LogoItem_selected"; -static NSString * const kStatPlacepageSponsoredMoreSelected = - @"Placepage_SponsoredGallery_MoreItem_selected"; +static NSString * const kStatPlacepageSponsoredItemSelected = @"Placepage_SponsoredGallery_ProductItem_selected"; +static NSString * const kStatPlacepageSponsoredLogoSelected = @"Placepage_SponsoredGallery_LogoItem_selected"; +static NSString * const kStatPlacepageSponsoredMoreSelected = @"Placepage_SponsoredGallery_MoreItem_selected"; static NSString * const kStatPlacepageSponsoredOpen = @"Placepage_SponsoredGalleryPage_opened"; static NSString * const kStatPlacepageSponsoredShow = @"Placepage_SponsoredGallery_shown"; static NSString * const kStatPlacepageTaxiShow = @"Placepage_Taxi_show"; @@ -212,6 +209,9 @@ static NSString * const kStatReport = @"Report"; static NSString * const kStatRestaurant = @"restaurant"; static NSString * const kStatRestaurantLocation = @"restaurant_location"; static NSString * const kStatRetry = @"retry"; +static NSString * const kStatRouteManagerClose = @"Routing_RouteManager_close"; +static NSString * const kStatRouteManagerOpen = @"Routing_RouteManager_open"; +static NSString * const kStatRouteManagerRearrange = @"Routing_RouteManager_rearrange"; static NSString * const kStatRouting = @"routing"; static NSString * const kStatRoutingAddPoint = @"Routing_Point_add"; static NSString * const kStatRoutingBookmarksClicked = @"Routing_Bookmarks_click"; diff --git a/iphone/Maps/Core/Routing/MWMRouter+RouteManager.mm b/iphone/Maps/Core/Routing/MWMRouter+RouteManager.mm index ce4660336a..79cc6c93da 100644 --- a/iphone/Maps/Core/Routing/MWMRouter+RouteManager.mm +++ b/iphone/Maps/Core/Routing/MWMRouter+RouteManager.mm @@ -33,14 +33,18 @@ auto router = [MWMRouter router]; if (router.routeManagerTransactionId == RoutingManager::InvalidRoutePointsTransactionId()) return; - GetFramework().GetRoutingManager().CancelRoutePointsTransaction(router.routeManagerTransactionId); + auto & rm = GetFramework().GetRoutingManager(); + rm.CancelRoutePointsTransaction(router.routeManagerTransactionId); router.routeManagerTransactionId = RoutingManager::InvalidRoutePointsTransactionId(); + rm.CancelPreviewMode(); } + (void)movePointAtIndex:(NSInteger)index toIndex:(NSInteger)newIndex { NSAssert(index != newIndex, @"Route manager moves point to its' current position."); - GetFramework().GetRoutingManager().MoveRoutePoint(index, newIndex); + auto & rm = GetFramework().GetRoutingManager(); + rm.MoveRoutePoint(index, newIndex); + rm.UpdatePreviewMode(); } @end diff --git a/iphone/Maps/Core/Routing/MWMRouter.mm b/iphone/Maps/Core/Routing/MWMRouter.mm index 3f2b1c7cf4..b10f7049e2 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.mm +++ b/iphone/Maps/Core/Routing/MWMRouter.mm @@ -31,6 +31,20 @@ using namespace routing; +@interface MWMRouter () + +@property(nonatomic) NSMutableDictionary * altitudeImagesData; +@property(nonatomic) NSString * altitudeElevation; +@property(nonatomic) dispatch_queue_t renderAltitudeImagesQueue; +@property(nonatomic) uint32_t taxiRoutePointTransactionId; +@property(nonatomic) uint32_t routeManagerTransactionId; +@property(nonatomic) BOOL canAutoAddLastLocation; +@property(nonatomic) BOOL isAPICall; + ++ (MWMRouter *)router; + +@end + namespace { char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeImagesQueue"; @@ -47,33 +61,26 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) case MWMRoutePointTypeIntermediate: pointTypeStr = kStatRoutingPointTypeIntermediate; break; case MWMRoutePointTypeFinish: pointTypeStr = kStatRoutingPointTypeFinish; break; } - BOOL const isPlanning = - [MWMNavigationDashboardManager manager].state != MWMNavigationDashboardStateHidden; BOOL const isOnRoute = [MWMNavigationDashboardManager manager].state != MWMNavigationDashboardStateNavigation; + NSString * method = nil; + if ([MWMRouter router].isAPICall) + method = kStatRoutingPointMethodApi; + else if ([MWMNavigationDashboardManager manager].state != MWMNavigationDashboardStateHidden) + method = kStatRoutingPointMethodPlanning; + else + method = kStatRoutingPointMethodNoPlanning; [Statistics logEvent:eventType withParameters:@{ kStatRoutingPointType : pointTypeStr, kStatRoutingPointValue : (point.isMyPosition ? kStatRoutingPointValueMyPosition : kStatRoutingPointValuePoint), - kStatRoutingPointMethod : - (isPlanning ? kStatRoutingPointMethodPlanning : kStatRoutingPointMethodNoPlanning), + kStatRoutingPointMethod : method, kStatRoutingMode : (isOnRoute ? kStatRoutingModeOnRoute : kStatRoutingModePlanning) }]; } } // namespace -@interface MWMRouter () - -@property(nonatomic) NSMutableDictionary * altitudeImagesData; -@property(nonatomic) NSString * altitudeElevation; -@property(nonatomic) dispatch_queue_t renderAltitudeImagesQueue; -@property(nonatomic) uint32_t taxiRoutePointTransactionId; -@property(nonatomic) uint32_t routeManagerTransactionId; -@property(nonatomic) BOOL canAutoAddLastLocation; - -@end - @implementation MWMRouter + (MWMRouter *)router @@ -350,8 +357,10 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) if (!startPoint || !finishPoint) return; + [MWMRouter router].isAPICall = YES; [self addPoint:startPoint]; [self addPoint:finishPoint]; + [MWMRouter router].isAPICall = NO; [self rebuildWithBestRouter:bestRouter]; }