diff --git a/iphone/Maps/Classes/LocalNotificationManager.mm b/iphone/Maps/Classes/LocalNotificationManager.mm index 6a1eb3f537..eeaee8550e 100644 --- a/iphone/Maps/Classes/LocalNotificationManager.mm +++ b/iphone/Maps/Classes/LocalNotificationManager.mm @@ -54,7 +54,7 @@ typedef void (^CompletionHandler)(UIBackgroundFetchResult); if ([userInfo[@"Action"] isEqualToString:kDownloadMapActionName]) { [[Statistics instance] logEvent:@"'Download Map' Notification Clicked"]; - [[MapsAppDelegate theApp].m_mapViewController.navigationController popToRootViewControllerAnimated:NO]; + [[MapsAppDelegate theApp].mapViewController.navigationController popToRootViewControllerAnimated:NO]; TIndex const index = TIndex([userInfo[@"Group"] intValue], [userInfo[@"Country"] intValue], [userInfo[@"Region"] intValue]); [self downloadCountryWithIndex:index]; diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h index 2fc2e85885..85e07dd48b 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.h +++ b/iphone/Maps/Classes/MapsAppDelegate.h @@ -17,7 +17,7 @@ @property (nonatomic) UIWindow * window; -@property (nonatomic, weak) IBOutlet MapViewController * m_mapViewController; +@property (nonatomic, readonly) MapViewController * mapViewController; @property (nonatomic, readonly) LocationManager * m_locationManager; + (MapsAppDelegate *)theApp; diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 3eec40544b..ec1d7d43be 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -175,9 +175,9 @@ void InitLocalizedStrings() InitLocalizedStrings(); - [self.m_mapViewController onEnterForeground]; + [self.mapViewController onEnterForeground]; - [Preferences setup:self.m_mapViewController]; + [Preferences setup:self.mapViewController]; _m_locationManager = [[LocationManager alloc] init]; [self subscribeToStorage]; @@ -223,12 +223,12 @@ void InitLocalizedStrings() - (void)applicationWillTerminate:(UIApplication *)application { - [self.m_mapViewController onTerminate]; + [self.mapViewController onTerminate]; } - (void)applicationDidEnterBackground:(UIApplication *)application { - [self.m_mapViewController onEnterBackground]; + [self.mapViewController onEnterBackground]; if (m_activeDownloadsCounter) { m_backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{ @@ -246,7 +246,7 @@ void InitLocalizedStrings() - (void)applicationWillEnterForeground:(UIApplication *)application { [self.m_locationManager orientationChanged]; - [self.m_mapViewController onEnterForeground]; + [self.mapViewController onEnterForeground]; } - (void)applicationDidBecomeActive:(UIApplication *)application @@ -270,7 +270,7 @@ void InitLocalizedStrings() { [[Statistics instance] logApiUsage:m_sourceApplication]; [self showMap]; - [self.m_mapViewController showAPIBar]; + [self.mapViewController showAPIBar]; } } else if (m_fileURL) @@ -334,7 +334,7 @@ void InitLocalizedStrings() - (void)setMapStyle:(MapStyle)mapStyle { - [self.m_mapViewController setMapStyle: mapStyle]; + [self.mapViewController setMapStyle: mapStyle]; } - (void)customizeAppearance @@ -417,7 +417,7 @@ void InitLocalizedStrings() - (void)showMap { [(UINavigationController *)self.window.rootViewController popToRootViewControllerAnimated:YES]; - [self.m_mapViewController dismissPopover]; + [self.mapViewController dismissPopover]; } - (void)subscribeToStorage @@ -480,6 +480,13 @@ void InitLocalizedStrings() } } +#pragma mark - Properties + +- (MapViewController *)mapViewController +{ + return [(UINavigationController *)self.window.rootViewController viewControllers].firstObject; +} + #pragma mark - Route state - (void)restoreRouteState @@ -488,7 +495,7 @@ void InitLocalizedStrings() return; RouteState const * const state = [RouteState savedState]; if (state.hasActualRoute) - self.m_mapViewController.restoreRouteDestination = state.endPoint; + self.mapViewController.restoreRouteDestination = state.endPoint; else [RouteState remove]; } diff --git a/iphone/Maps/Mapsme.storyboard b/iphone/Maps/Mapsme.storyboard index 1ba550be52..48aec185ca 100644 --- a/iphone/Maps/Mapsme.storyboard +++ b/iphone/Maps/Mapsme.storyboard @@ -6,7 +6,7 @@ - + @@ -22,11 +22,6 @@ - - - - - diff --git a/iphone/Maps/Platform/LocationManager.mm b/iphone/Maps/Platform/LocationManager.mm index 3bcdcfbf4b..1c3f9ffd0b 100644 --- a/iphone/Maps/Platform/LocationManager.mm +++ b/iphone/Maps/Platform/LocationManager.mm @@ -215,7 +215,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw if (!on) return NO; - if (!MapsAppDelegate.theApp.m_mapViewController.controlsManager.searchHidden) + if (!MapsAppDelegate.theApp.mapViewController.controlsManager.searchHidden) return NO; if (!manager.heading) return YES; diff --git a/iphone/Maps/Settings/SettingsViewController.mm b/iphone/Maps/Settings/SettingsViewController.mm index a3863a5185..9fbcb7eefa 100644 --- a/iphone/Maps/Settings/SettingsViewController.mm +++ b/iphone/Maps/Settings/SettingsViewController.mm @@ -138,7 +138,7 @@ typedef NS_ENUM(NSUInteger, Section) else if (indexPath.section == SectionZoomButtons) { Settings::Set("ZoomButtonsEnabled", (bool)value); - [MapsAppDelegate theApp].m_mapViewController.controlsManager.zoomHidden = !value; + [MapsAppDelegate theApp].mapViewController.controlsManager.zoomHidden = !value; } else if (indexPath.section == SectionCalibration) { @@ -158,7 +158,7 @@ Settings::Units unitsForIndex(NSInteger index) Settings::Units units = unitsForIndex(indexPath.row); Settings::Set("Units", units); [tableView reloadSections:[NSIndexSet indexSetWithIndex:SectionMetrics] withRowAnimation:UITableViewRowAnimationFade]; - [[MapsAppDelegate theApp].m_mapViewController setupMeasurementSystem]; + [[MapsAppDelegate theApp].mapViewController setupMeasurementSystem]; } }