diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.h index 5d6a7afaaf..0d1ccc9323 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.h @@ -5,4 +5,9 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageController : UIPageViewController - (void)nextPage; - (void)show; +- (void)enableFirst:(UIButton *)button; +- (void)enableSecond; +- (void)skipFirst; +- (void)skipSecond; + @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.mm index f5009e3f25..c7afdba79c 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMPageController.mm @@ -2,9 +2,17 @@ #import "MWMWhatsNewController.h" #import "Statistics.h" -static NSString * const kPageViewControllerStoryboardID = @"PageViewController"; -static NSString * const kContentViewControllerStoryboardID = @"PageContentController"; -static NSUInteger const kNumberOfPages = 2; +#include "Framework.h" + +namespace +{ + +NSString * const kPageViewControllerStoryboardID = @"PageViewController"; +NSString * const kContentViewControllerStoryboardID = @"PageContentController"; +NSUInteger const kNumberOfPages = 2; + +} // namespace + extern NSString * const kUDWhatsNewWasShown; @protocol MWMPageControllerDataSource @@ -16,6 +24,7 @@ extern NSString * const kUDWhatsNewWasShown; NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObject @property (weak, nonatomic, readonly) MWMPageController * pageController; +@property (nonatomic) BOOL isButtonSelectedOnFirstScreen; - (instancetype)initWithPageController:(MWMPageController *)pageController; @@ -55,28 +64,27 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObjec bundle:[NSBundle mainBundle]]; } -- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController +- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(MWMWhatsNewController *)viewController { - NSUInteger index = [(MWMWhatsNewController *)viewController pageIndex]; + NSUInteger index = viewController.pageIndex; + viewController.enableButton.selected = self.isButtonSelectedOnFirstScreen; - if ((index == 0) || (index == NSNotFound)) + if (index == 0 || index == NSNotFound) return nil; index--; return [self viewControllerAtIndex:index]; } -- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController +- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(MWMWhatsNewController *)viewController { - NSUInteger index = [(MWMWhatsNewController *)viewController pageIndex]; + NSUInteger index = viewController.pageIndex; + viewController.enableButton.selected = NO; - if (index == NSNotFound) + if (index == NSNotFound || index == kNumberOfPages - 1) return nil; index++; - if (index == kNumberOfPages) - return nil; - return [self viewControllerAtIndex:index]; } @@ -105,7 +113,8 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObjec - (void)close { - [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) withParameters:@{kStatAction : kStatClose}]; + [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) + withParameters:@{kStatAction : kStatClose}]; [self.iPadBackgroundView removeFromSuperview]; [self.view removeFromSuperview]; [self removeFromParentViewController]; @@ -113,13 +122,15 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObjec - (void)nextPage { - [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) withParameters:@{kStatAction : kStatNext}]; + [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) + withParameters:@{kStatAction : kStatNext}]; [self setViewControllers:@[[self.pageControllerDataSource viewControllerAtIndex:1]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; } - (void)show { - [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) withParameters:@{kStatAction : kStatOpen}]; + [[Statistics instance] logEvent:kStatEventName(kStatWhatsNew, kUDWhatsNewWasShown) + withParameters:@{kStatAction : kStatOpen}]; if (IPAD) [self.parent.view addSubview:self.iPadBackgroundView]; [self.parent addChildViewController:self]; @@ -127,19 +138,64 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObjec [self didMoveToParentViewController:self.parent]; } +#pragma mark - Enabled methods + +- (void)enableFirst:(UIButton *)button +{ + auto & f = GetFramework(); + bool _ = true, is3dBuildings = true; + f.Load3dMode(_, is3dBuildings); + BOOL const isEnabled = !button.selected; + f.Save3dMode(_, isEnabled); + f.Allow3dMode(_, isEnabled); + button.selected = self.pageControllerDataSource.isButtonSelectedOnFirstScreen = isEnabled; + [self nextPage]; +} + +- (void)enableSecond +{ + auto & f = GetFramework(); + bool _ = true; + f.Load3dMode(_, _); + f.Save3dMode(true, _); + f.Allow3dMode(true, _); + [self close]; +} + +- (void)skipFirst +{ + auto & f = GetFramework(); + bool _ = true, is3dBuildings = true; + f.Load3dMode(_, is3dBuildings); + f.Save3dMode(_, false); + f.Allow3dMode(_, false); + [self nextPage]; +} + +- (void)skipSecond +{ + auto & f = GetFramework(); + bool _ = true; + f.Load3dMode(_, _); + f.Save3dMode(false, _); + f.Allow3dMode(false, _); + [self close]; +} + +#pragma mark - Private methods + - (CGSize)defaultSize { return IPAD ? CGSizeMake(520.0, 600.0) : self.parent.view.frame.size; } -#pragma mark Private methods - - (void)configure { UIView * mainView = self.view; UIView * parentView = self.parent.view; CGSize const size = self.defaultSize; - CGPoint const origin = IPAD ? CGPointMake(parentView.center.x - size.width / 2, parentView.center.y - size.height / 2) : CGPointZero; + CGPoint const origin = IPAD ? CGPointMake(parentView.center.x - size.width / 2, parentView.center.y - size.height / 2) : + CGPointZero; mainView.frame = {origin, size}; mainView.backgroundColor = [UIColor whiteColor]; if (IPAD) @@ -158,7 +214,7 @@ NS_CLASS_AVAILABLE_IOS(8_0) @interface MWMPageControllerDataSourceImpl : NSObjec { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; if (IPAD) - self.view.center = {size.width / 2, size.height / 2 }; + self.view.center = self.parent.view.center; else self.view.origin = {}; } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.h index b7a75a3a7a..07b761803d 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.h @@ -4,6 +4,7 @@ @property (nonatomic) NSUInteger pageIndex; @property (weak, nonatomic) MWMPageController * pageController; +@property (weak, nonatomic, readonly) IBOutlet UIButton * enableButton; - (void)updateForSize:(CGSize)size; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.mm index 9022b31921..579af745da 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMWhatsNewController.mm @@ -7,7 +7,8 @@ @property (weak, nonatomic) IBOutlet UIImageView * image; @property (weak, nonatomic) IBOutlet UILabel * alertTitle; @property (weak, nonatomic) IBOutlet UILabel * alertText; -@property (weak, nonatomic) IBOutlet UIButton * button; +@property (weak, nonatomic) IBOutlet UIButton * nextPageButton; +@property (weak, nonatomic, readwrite) IBOutlet UIButton * enableButton; @property (weak, nonatomic) IBOutlet NSLayoutConstraint * containerWidth; @property (weak, nonatomic) IBOutlet NSLayoutConstraint * containerHeight; @@ -16,6 +17,7 @@ @property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleTopOffset; @property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleImageOffset; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint * betweenButtonsOffset; @end @@ -33,20 +35,25 @@ - (void)configureFirstPage { - self.image.image = [UIImage imageNamed:@"img_tts"]; - self.alertTitle.text = L(@"whats_new_where_to_turn"); - self.alertText.text = L(@"whats_new_voice_instructions"); - [self.button setTitle:L(@"whats_new_next") forState:UIControlStateNormal]; - [self.button addTarget:self.pageController action:@selector(nextPage) forControlEvents:UIControlEventTouchUpInside]; + self.image.image = [UIImage imageNamed:@"img_3d_buildings"]; + self.alertTitle.text = L(@"whats_new_3d_buildings_title"); + self.alertText.text = [NSString stringWithFormat:@"%@\n\n%@", L(@"whats_new_3d_buildings_subtitle"), L(@"3d_new_update_maps")]; + [self.enableButton setTitle:L(@"3d_new_buildings_on") forState:UIControlStateNormal]; + [self.nextPageButton setTitle:L(@"dialog_routing_not_now") forState:UIControlStateNormal]; + [self.nextPageButton addTarget:self.pageController action:@selector(skipFirst) forControlEvents:UIControlEventTouchUpInside]; + [self.enableButton addTarget:self.pageController action:@selector(enableFirst:) forControlEvents:UIControlEventTouchUpInside]; } - (void)configureSecondPage { - self.image.image = [UIImage imageNamed:@"img_p2p"]; - self.alertTitle.text = L(@"whats_new_between_any_points"); - self.alertText.text = L(@"whats_new_happy_day"); - [self.button setTitle:L(@"done") forState:UIControlStateNormal]; - [self.button addTarget:self.pageController action:@selector(close) forControlEvents:UIControlEventTouchUpInside]; + self.image.image = [UIImage imageNamed:@"img_perspective_view"]; + self.alertTitle.text = L(@"whats_new_3d_title"); + self.alertText.text = L(@"whats_new_3d_subtitle"); + [self.enableButton setTitle:L(@"3d_new_on") forState:UIControlStateNormal]; + [self.nextPageButton setTitle:L(@"dialog_routing_not_now") forState:UIControlStateNormal]; + [self.nextPageButton addTarget:self.pageController action:@selector(skipSecond) forControlEvents:UIControlEventTouchUpInside]; + [self.enableButton addTarget:self.pageController action:@selector(enableSecond) forControlEvents:UIControlEventTouchUpInside]; + self.enableButton.selected = NO; } - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator @@ -71,6 +78,8 @@ self.image.hidden = hideImage; self.containerWidth.constant = width; self.containerHeight.constant = height; + BOOL const isPortrait = (!IPAD && size.height > size.width); + self.betweenButtonsOffset.constant = isPortrait ? 16 : 8; } @end diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 3ad3214523..9a2d3c0edf 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -33,7 +33,7 @@ #import "../../../private.h" extern NSString * const kAlohalyticsTapEventKey = @"$onClick"; -extern NSString * const kUDWhatsNewWasShown = @"WhatsNewWithTTSAndP2PWasShown"; +extern NSString * const kUDWhatsNewWasShown = @"WhatsNewWith3dAndPerspectiveWasShown"; extern char const * kAdForbiddenSettingsKey; extern char const * kAdServerForbiddenKey; @@ -395,8 +395,9 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) self.controlsManager.menuState = self.menuRestoreState; [self refreshAd]; - + GetFramework().InvalidateRendering(); + [self showWhatsNewIfNeeded]; } - (void)viewDidLoad diff --git a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/Contents.json b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/Contents.json similarity index 66% rename from iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/Contents.json rename to iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/Contents.json index 4adc917786..004ac967c8 100644 --- a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/Contents.json +++ b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "img_p2p.png", + "filename" : "img_3d_buildings.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "img_p2p@2x.png", + "filename" : "img_3d_buildings@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "img_p2p@3x.png", + "filename" : "img_3d_buildings@3x.png", "scale" : "3x" } ], diff --git a/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings.png b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings.png new file mode 100644 index 0000000000..6306305c06 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@2x.png b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@2x.png new file mode 100644 index 0000000000..54695ef60f Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@3x.png b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@3x.png new file mode 100644 index 0000000000..2ba738955d Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_3d_buildings.imageset/img_3d_buildings@3x.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p.png b/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p.png deleted file mode 100644 index e671e17cc3..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@2x.png b/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@2x.png deleted file mode 100644 index 8fdb99a09c..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@3x.png b/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@3x.png deleted file mode 100644 index dba08efb35..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_p2p.imageset/img_p2p@3x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/Contents.json b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/Contents.json similarity index 64% rename from iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/Contents.json rename to iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/Contents.json index 87abf4c2be..06aa16b88b 100644 --- a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/Contents.json +++ b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/Contents.json @@ -2,17 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "img_tts.png", + "filename" : "img_perspective_view.png", "scale" : "1x" }, { "idiom" : "universal", - "filename" : "img_tts@2x.png", + "filename" : "img_perspective_view@2x.png", "scale" : "2x" }, { "idiom" : "universal", - "filename" : "img_tts@3x.png", + "filename" : "img_perspective_view@3x.png", "scale" : "3x" } ], diff --git a/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view.png b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view.png new file mode 100644 index 0000000000..56ee81f590 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@2x.png b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@2x.png new file mode 100644 index 0000000000..e365a8749e Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@2x.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@3x.png b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@3x.png new file mode 100644 index 0000000000..6c466110ad Binary files /dev/null and b/iphone/Maps/Images.xcassets/Whats New/img_perspective_view.imageset/img_perspective_view@3x.png differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts.png b/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts.png deleted file mode 100644 index 06ef930bfa..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@2x.png b/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@2x.png deleted file mode 100644 index 5c5c15a623..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@3x.png b/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@3x.png deleted file mode 100644 index 46dc6a6281..0000000000 Binary files a/iphone/Maps/Images.xcassets/Whats New/img_tts.imageset/img_tts@3x.png and /dev/null differ diff --git a/iphone/Maps/Mapsme.storyboard b/iphone/Maps/Mapsme.storyboard index 893ee8557d..3c46f99804 100644 --- a/iphone/Maps/Mapsme.storyboard +++ b/iphone/Maps/Mapsme.storyboard @@ -10,6 +10,7 @@ HelveticaNeue-Medium + HelveticaNeue-Medium @@ -494,7 +495,7 @@ - + @@ -512,7 +513,7 @@ - + @@ -520,7 +521,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/iphone/Maps/Settings/SettingsViewController.mm b/iphone/Maps/Settings/SettingsViewController.mm index 6294233a86..88491c0d27 100644 --- a/iphone/Maps/Settings/SettingsViewController.mm +++ b/iphone/Maps/Settings/SettingsViewController.mm @@ -124,7 +124,7 @@ typedef NS_ENUM(NSUInteger, Section) { bool _ = true; GetFramework().Load3dMode(_, on); - customCell.titleLabel.text = L(@"pref_3d_buildings"); + customCell.titleLabel.text = L(@"pref_map_3d_buildings_title"); } else { @@ -143,7 +143,7 @@ typedef NS_ENUM(NSUInteger, Section) { cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; SwitchCell * customCell = (SwitchCell *)cell; - customCell.titleLabel.text = L(@"prefs_3d_mode"); + customCell.titleLabel.text = L(@"pref_map_3d_title"); customCell.delegate = self; bool _ = true, on = true; GetFramework().Load3dMode(on, _); diff --git a/iphone/Maps/UIButton+RuntimeAttributes.mm b/iphone/Maps/UIButton+RuntimeAttributes.mm index 734f19ca57..3fee4b2e6f 100644 --- a/iphone/Maps/UIButton+RuntimeAttributes.mm +++ b/iphone/Maps/UIButton+RuntimeAttributes.mm @@ -29,6 +29,11 @@ [self setTitleColor:[UIColor colorWithName:colorName] forState:UIControlStateHighlighted]; } +- (void)setTextColorSelectedName:(NSString *)colorName +{ + [self setTitleColor:[UIColor colorWithName:colorName] forState:UIControlStateSelected]; +} + - (void)setBackgroundColorName:(NSString *)colorName { [self setBackgroundColor:[UIColor colorWithName:colorName] forState:UIControlStateNormal]; @@ -39,6 +44,11 @@ [self setBackgroundColor:[UIColor colorWithName:colorName] forState:UIControlStateHighlighted]; } +- (void)setBackgroundSelectedColorName:(NSString *)colorName +{ + [self setBackgroundColor:[UIColor colorWithName:colorName] forState:UIControlStateSelected]; +} + - (void)setBackgroundColor:(UIColor *)color forState:(UIControlState)state { [self setBackgroundImage:[UIImage imageWithColor:color] forState:state];