diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.h new file mode 100644 index 0000000000..a68cdcc76f --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.h @@ -0,0 +1,5 @@ +#import "MWMWelcomeController.h" + +@interface MWMWhatsNewNavigationController : MWMWelcomeController + +@end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.mm new file mode 100644 index 0000000000..7518dc7b6c --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/MWMWhatsNewNavigationController.mm @@ -0,0 +1,76 @@ +#import "MWMWhatsNewNavigationController.h" +#import "MWMPageController.h" + +@interface MWMWhatsNewNavigationController () + +@property(weak, nonatomic) IBOutlet UIView * containerView; +@property(weak, nonatomic) IBOutlet UIImageView * image; +@property(weak, nonatomic) IBOutlet UILabel * alertTitle; +@property(weak, nonatomic) IBOutlet UILabel * alertText; +@property(weak, nonatomic) IBOutlet UIButton * nextPageButton; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerWidth; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerHeight; + +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageMinHeight; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageHeight; + +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleTopOffset; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleImageOffset; + +@end + +namespace +{ +NSArray * pagesConfigBlocks = @[ + [^(MWMWhatsNewNavigationController * controller) { + controller.image.image = [UIImage imageNamed:@"img_whatsnew_car_navigation"]; + controller.alertTitle.text = L(@"whatsnew_car_navigation_header"); + controller.alertText.text = L(@"whatsnew_car_navigation_message"); + [controller.nextPageButton setTitle:L(@"whats_new_next_button") forState:UIControlStateNormal]; + [controller.nextPageButton addTarget:controller.pageController + action:@selector(nextPage) + forControlEvents:UIControlEventTouchUpInside]; + } copy], + [^(MWMWhatsNewNavigationController * controller) { + controller.image.image = [UIImage imageNamed:@"img_whatsnew_cycle_navigation_improved"]; + controller.alertTitle.text = L(@"whatsnew_cycle_navigation_2_header"); + controller.alertText.text = L(@"whatsnew_cycle_navigation_2_message"); + [controller.nextPageButton setTitle:L(@"whats_new_next_button") forState:UIControlStateNormal]; + [controller.nextPageButton addTarget:controller.pageController + action:@selector(nextPage) + forControlEvents:UIControlEventTouchUpInside]; + } copy], + [^(MWMWhatsNewNavigationController * controller) { + controller.image.image = [UIImage imageNamed:@"img_whatsnew_booking_improved"]; + controller.alertTitle.text = L(@"whatsnew_booking_2_header"); + controller.alertText.text = L(@"whatsnew_booking_2_message"); + [controller.nextPageButton setTitle:L(@"done") forState:UIControlStateNormal]; + [controller.nextPageButton addTarget:controller.pageController + action:@selector(close) + forControlEvents:UIControlEventTouchUpInside]; + } copy] +]; +} // namespace + +@implementation MWMWhatsNewNavigationController + ++ (NSString *)udWelcomeWasShownKey { return @"WhatsNewWithNavigationWasShown"; } ++ (NSArray *)pagesConfig { return pagesConfigBlocks; } +- (IBAction)close { [self.pageController close]; } +#pragma mark - Properties + +- (void)setSize:(CGSize)size +{ + super.size = size; + CGSize const newSize = super.size; + CGFloat const width = newSize.width; + CGFloat const height = newSize.height; + BOOL const hideImage = (self.imageHeight.multiplier * height <= self.imageMinHeight.constant); + self.titleImageOffset.priority = + hideImage ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh; + self.image.hidden = hideImage; + self.containerWidth.constant = width; + self.containerHeight.constant = height; +} + +@end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/Welcome.storyboard b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/Welcome.storyboard index 8485577b8c..bf20c31837 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/Welcome.storyboard +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Welcome/Welcome.storyboard @@ -1,5 +1,5 @@ - + @@ -13,6 +13,7 @@ HelveticaNeue-Medium HelveticaNeue-Medium HelveticaNeue-Medium + HelveticaNeue-Medium @@ -778,6 +779,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index aa94fd49f5..fc6dfee04d 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -24,7 +24,7 @@ #import "MWMRouter.h" #import "MWMStorage.h" #import "MWMTableViewController.h" -#import "MWMWhatsNewBookingBicycleRoutingController.h" +#import "MWMWhatsNewNavigationController.h" #import "MapsAppDelegate.h" #import "RouteState.h" #import "Statistics.h" @@ -299,7 +299,7 @@ BOOL gIsFirstMyPositionMode = YES; return; Class whatsNewClass = - [MWMWhatsNewBookingBicycleRoutingController class]; + [MWMWhatsNewNavigationController class]; BOOL const isFirstSession = [Alohalytics isFirstSession]; Class welcomeClass = isFirstSession ? [MWMFirstLaunchController class] : whatsNewClass; diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index cb73c896ee..c173633950 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -120,6 +120,8 @@ 345FDD271C3BB3AF0070C459 /* MWMEditorViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345FDD251C3BB3AF0070C459 /* MWMEditorViewController.mm */; }; 34634B1B1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34634B1A1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib */; }; 3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */; }; + 34664CFA1D4A0262003D7096 /* MWMWhatsNewNavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34664CF91D4A0262003D7096 /* MWMWhatsNewNavigationController.mm */; }; + 34664CFB1D4A0262003D7096 /* MWMWhatsNewNavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34664CF91D4A0262003D7096 /* MWMWhatsNewNavigationController.mm */; }; 34679F3D1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34679F3C1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.mm */; }; 34679F3E1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34679F3C1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.mm */; }; 346EDADB1B9F0E35004F8DB5 /* MWMMultilineLabel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 346EDADA1B9F0E35004F8DB5 /* MWMMultilineLabel.mm */; }; @@ -996,6 +998,8 @@ 34634B1A1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMBottomMenuCollectionViewLandscapeCell.xib; sourceTree = ""; }; 3465E7D61B6658C000854C4D /* MWMAPIBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBar.h; sourceTree = ""; }; 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMAPIBar.mm; sourceTree = ""; }; + 34664CF81D4A0262003D7096 /* MWMWhatsNewNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MWMWhatsNewNavigationController.h; path = Welcome/MWMWhatsNewNavigationController.h; sourceTree = ""; }; + 34664CF91D4A0262003D7096 /* MWMWhatsNewNavigationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MWMWhatsNewNavigationController.mm; path = Welcome/MWMWhatsNewNavigationController.mm; sourceTree = ""; }; 34679F3B1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MWMWhatsNewDownloaderEditorController.h; path = Welcome/MWMWhatsNewDownloaderEditorController.h; sourceTree = ""; }; 34679F3C1C92FE3700114F20 /* MWMWhatsNewDownloaderEditorController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MWMWhatsNewDownloaderEditorController.mm; path = Welcome/MWMWhatsNewDownloaderEditorController.mm; sourceTree = ""; }; 346EDAD91B9F0E35004F8DB5 /* MWMMultilineLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMMultilineLabel.h; sourceTree = ""; }; @@ -2858,6 +2862,8 @@ 34D349FA1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm */, 345A2DC91D0B0EB600A7DD39 /* MWMWhatsNewBookingBicycleRoutingController.h */, 345A2DCA1D0B0EB600A7DD39 /* MWMWhatsNewBookingBicycleRoutingController.mm */, + 34664CF81D4A0262003D7096 /* MWMWhatsNewNavigationController.h */, + 34664CF91D4A0262003D7096 /* MWMWhatsNewNavigationController.mm */, ); name = Welcome; sourceTree = ""; @@ -3616,6 +3622,7 @@ F6791B131C43DEA7007A8A6E /* MWMStartButton.mm in Sources */, 46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */, 34F9FB8B1C438ADB00F71201 /* MWMStreetEditorViewController.mm in Sources */, + 34664CFA1D4A0262003D7096 /* MWMWhatsNewNavigationController.mm in Sources */, EED10A4511F78D120095FAD4 /* MapViewController.mm in Sources */, 34CCFDD11C21945500F28959 /* MWMPlacePageOpeningHoursDayView.mm in Sources */, F61579341AC2CE9A0032D8E9 /* MWMRateAlert.mm in Sources */, @@ -3839,6 +3846,7 @@ 6741A9B81BF340DE002C974C /* MapViewController.mm in Sources */, 34F9FB8C1C438ADB00F71201 /* MWMStreetEditorViewController.mm in Sources */, 34CCFDD21C21945500F28959 /* MWMPlacePageOpeningHoursDayView.mm in Sources */, + 34664CFB1D4A0262003D7096 /* MWMWhatsNewNavigationController.mm in Sources */, 6741A9B91BF340DE002C974C /* MWMRateAlert.mm in Sources */, 6741A9BA1BF340DE002C974C /* MWMRoutePointCell.m in Sources */, 347D7C6A1C2C0703006B2D0A /* UITextView+RuntimeAttributes.mm in Sources */,