diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index fc27420527..2e0da13df1 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -380,7 +380,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) - (void)onEnterForeground { - if (MapsAppDelegate.theApp.m_locationManager.isDaemonMode) + if (self.isDaemon) return; // Notify about entering foreground (should be called on the first launch too). GetFramework().EnterForeground(); @@ -394,7 +394,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - if (MapsAppDelegate.theApp.m_locationManager.isDaemonMode) + if (self.isDaemon) return; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; @@ -409,7 +409,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) - (void)viewDidLoad { [super viewDidLoad]; - if (MapsAppDelegate.theApp.m_locationManager.isDaemonMode) + if (self.isDaemon) return; self.view.clipsToBounds = YES; [MTRGManager setMyCom:YES]; @@ -483,12 +483,16 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) [self setNeedsStatusBarAppearanceUpdate]; } +- (BOOL)isDaemon +{ + return MapsAppDelegate.theApp.m_locationManager.isDaemonMode; +} + - (id)initWithCoder:(NSCoder *)coder { NSLog(@"MapViewController initWithCoder Started"); - BOOL const isDaemon = MapsAppDelegate.theApp.m_locationManager.isDaemonMode; self = [super initWithCoder:coder]; - if (self && !isDaemon) + if (self && !self.isDaemon) [self initialize]; NSLog(@"MapViewController initWithCoder Ended"); diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 6a9bde77ff..aefc5fd8e9 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -300,13 +300,12 @@ void InitLocalizedStrings() - (void)applicationWillTerminate:(UIApplication *)application { -// [self.m_locationManager beforeTerminate]; + [self.m_locationManager beforeTerminate]; [self.mapViewController onTerminate]; } - (void)applicationDidEnterBackground:(UIApplication *)application { - [self.m_locationManager beforeTerminate]; [self.mapViewController onEnterBackground]; if (m_activeDownloadsCounter) {