Fixed bug with map view controller.

Signed-off-by: v.mikhaylenko <v.mikhaylenko@corp.mail.ru>
This commit is contained in:
v.mikhaylenko 2015-09-29 12:46:08 +03:00
parent 056e361f03
commit ef80f2b347
6 changed files with 22 additions and 20 deletions

View file

@ -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];

View file

@ -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;

View file

@ -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];
}

View file

@ -6,7 +6,7 @@
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Mmap View Controller-->
<!--Map View Controller-->
<scene sceneID="Wq1-a3-f7n">
<objects>
<viewController id="xTf-lf-yxN" customClass="MapViewController" sceneMemberID="viewController">
@ -22,11 +22,6 @@
<navigationItem key="navigationItem" id="8E8-0f-UV9"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cKg-Q7-bFd" userLabel="First Responder" sceneMemberID="firstResponder"/>
<customObject id="Lhh-vc-djn" customClass="MapsAppDelegate">
<connections>
<outlet property="m_mapViewController" destination="xTf-lf-yxN" id="1hz-hc-JUi"/>
</connections>
</customObject>
</objects>
<point key="canvasLocation" x="1134" y="444"/>
</scene>

View file

@ -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;

View file

@ -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];
}
}