From 9c23c074295ce6ecaa501769527a64cf9e9ae145 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Tue, 29 Sep 2015 14:43:44 +0300 Subject: [PATCH] [ios] Changed dialog on route with no current location. --- .../MapViewControls/MWMMapViewControlsManager.mm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index eb75e60b4e..817fbc3dd9 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -1,6 +1,7 @@ #import "CountryTreeVC.h" #import "MapsAppDelegate.h" #import "MapViewController.h" +#import "MWMAlertViewController.h" #import "MWMAPIBar.h" #import "MWMLocationButton.h" #import "MWMMapViewControlsManager.h" @@ -207,9 +208,19 @@ extern NSString * const kAlohalyticsTapEventKey; - (void)buildRouteWithType:(enum routing::RouterType)type { - [[MapsAppDelegate theApp].m_locationManager start:self.navigationManager]; + LocationManager * locMgr = [MapsAppDelegate theApp].m_locationManager; + if (![locMgr lastLocationIsValid]) + { + MWMAlertViewController * alert = + [[MWMAlertViewController alloc] initWithViewController:self.ownerController]; + [alert presentLocationAlert]; + return; + } + [locMgr start:self.navigationManager]; self.navigationManager.state = MWMNavigationDashboardStatePlanning; - GetFramework().BuildRoute(ToMercator([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate), self.routeDestination, 0 /* timeoutSec */); + GetFramework().BuildRoute( + ToMercator([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate), + self.routeDestination, 0 /* timeoutSec */); // This hack is needed to instantly show initial progress. // Because user may think that nothing happens when he is building a route. dispatch_async(dispatch_get_main_queue(), ^