From 545aaaafecb7c2add5029b7e4c635f2b6980ce6e Mon Sep 17 00:00:00 2001 From: Igor Khmurets Date: Fri, 10 Oct 2014 17:05:04 +0300 Subject: [PATCH] [ios] Updated RouteView --- iphone/Maps/Classes/MapViewController.mm | 34 +++++++++++++++--------- iphone/Maps/Classes/RouteView.h | 2 ++ iphone/Maps/Classes/RouteView.m | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 6082a1ee28..484374aec9 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -17,8 +17,8 @@ #import "AccountManager.h" #import "SettingsAndMoreVC.h" #import "RouteView.h" +#import "CountryTreeVC.h" -#import "../Settings/SettingsManager.h" #import "../../Common/CustomAlertView.h" #include "Framework.h" @@ -35,7 +35,7 @@ #define ALERT_VIEW_FACEBOOK 1 #define ALERT_VIEW_APPSTORE 2 #define ALERT_VIEW_BOOKMARKS 4 -#define ALERT_VIEW_PROMO 777 +#define ALERT_VIEW_ERROR 5 #define FACEBOOK_URL @"http://www.facebook.com/MapsWithMe" #define FACEBOOK_SCHEME @"fb://profile/111923085594432" @@ -129,6 +129,8 @@ - (void)onLocationStateModeChanged:(location::State::Mode)newMode { + [UIApplication sharedApplication].idleTimerDisabled = NO; + switch (newMode) { case location::State::UnknownPosition: @@ -170,6 +172,7 @@ { [self.toolbarView.locationButton setImage:[UIImage imageNamed:@"LocationFollow"] forState:UIControlStateSelected]; self.toolbarView.locationButton.selected = YES; + [UIApplication sharedApplication].idleTimerDisabled = YES; break; } } @@ -510,6 +513,10 @@ [self.view addSubview:self.containerView]; [self.view addSubview:self.bottomMenu]; + +// [self performAfterDelay:0.3 block:^{ +// [self bottomMenu:self.bottomMenu didPressItemWithName:@"Maps" appURL:nil webURL:nil]; +// }]; } - (void)viewDidAppear:(BOOL)animated @@ -762,7 +769,8 @@ { if ([itemName isEqualToString:@"Location"]) { - [self onMyPositionClicked:nil]; +// [self onMyPositionClicked:nil]; + [self.routeView setVisible:!self.routeView.visible animated:YES]; } else if ([itemName isEqualToString:@"Search"]) { @@ -788,6 +796,11 @@ } } +- (void)routeViewDidStartRouting:(RouteView *)routeView +{ + +} + - (void)routeViewDidCancelRouting:(RouteView *)routeView { GetFramework().CloseRouting(); @@ -868,7 +881,8 @@ { if ([itemName isEqualToString:@"Maps"]) { - [[[MapsAppDelegate theApp] settingsManager] show:self]; + CountryTreeVC * vc = [[CountryTreeVC alloc] initWithNodePosition:-1]; + [self.navigationController pushViewController:vc animated:YES]; } else if ([itemName isEqualToString:@"Settings"]) { @@ -974,17 +988,11 @@ [[UIApplication sharedApplication] openProVersionFrom:@"ios_toolabar_bookmarks"]; } } - case ALERT_VIEW_PROMO: + case ALERT_VIEW_ERROR: { - if (buttonIndex == alertView.cancelButtonIndex) + if (buttonIndex != alertView.cancelButtonIndex) { - [[Statistics instance] logEvent:@"17th august promo" withParameters:@{@"Shared" : @"NO"}]; - } - else - { - [[AccountManager sharedManager] shareToFacebookWithCompletion:^(BOOL success) { - [[Statistics instance] logEvent:@"17th august promo" withParameters:@{@"Shared" : (success ? @"YES" : @"NO")}]; - }]; + } } default: diff --git a/iphone/Maps/Classes/RouteView.h b/iphone/Maps/Classes/RouteView.h index 226fd2eda9..dd306841c2 100644 --- a/iphone/Maps/Classes/RouteView.h +++ b/iphone/Maps/Classes/RouteView.h @@ -6,6 +6,7 @@ @protocol RouteViewDelegate - (void)routeViewDidCancelRouting:(RouteView *)routeView; +- (void)routeViewDidStartRouting:(RouteView *)routeView; @end @@ -16,5 +17,6 @@ - (void)updateDistance:(NSString *)distance withMetrics:(NSString *)metrics; @property (nonatomic, weak) id delegate; +@property (nonatomic, readonly) BOOL visible; @end diff --git a/iphone/Maps/Classes/RouteView.m b/iphone/Maps/Classes/RouteView.m index 2be3775168..b805e0bdcb 100644 --- a/iphone/Maps/Classes/RouteView.m +++ b/iphone/Maps/Classes/RouteView.m @@ -125,7 +125,7 @@ { if (!_startButton) { - UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"StopRoutingButton"]]; + UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"StartRoutingButton"]]; NSString * title = @"Поехали!"; UIFont * font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14]; CGFloat const width = [title sizeWithDrawSize:CGSizeMake(200, 30) font:font].width + imageView.width + 40;