diff --git a/iphone/Maps/Bookmarks/AddSetVC.mm b/iphone/Maps/Bookmarks/AddSetVC.mm index 34acd79183..f999f03e14 100644 --- a/iphone/Maps/Bookmarks/AddSetVC.mm +++ b/iphone/Maps/Bookmarks/AddSetVC.mm @@ -46,11 +46,6 @@ static NSString * const kAddSetCellTableViewCell = @"AddSetTableViewCell"; [self.navigationController popViewControllerAnimated:YES]; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - return YES; -} - - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; diff --git a/iphone/Maps/Bookmarks/BookmarksRootVC.mm b/iphone/Maps/Bookmarks/BookmarksRootVC.mm index b2600575b4..5e2f022f5e 100644 --- a/iphone/Maps/Bookmarks/BookmarksRootVC.mm +++ b/iphone/Maps/Bookmarks/BookmarksRootVC.mm @@ -28,11 +28,6 @@ return self; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - return YES; -} - // Used to display add bookmarks hint - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { @@ -135,9 +130,12 @@ return cell; } -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id)coordinator { - [self.tableView reloadRowsAtIndexPaths:self.tableView.indexPathsForVisibleRows withRowAnimation:UITableViewRowAnimationFade]; + [coordinator animateAlongsideTransition:^(id context) { + [self.tableView reloadRowsAtIndexPaths:self.tableView.indexPathsForVisibleRows withRowAnimation:UITableViewRowAnimationFade]; + } completion:^(id context) {}]; } - (NSString *)truncateString:(NSString *)string toWidth:(CGFloat)width withFont:(UIFont *)font diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index e6cf59e4c3..42ccca7a04 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -36,11 +36,14 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController return self; } -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id)coordinator { - for (MWMAlert * alert in self.view.subviews) - [alert rotate:toInterfaceOrientation duration:duration]; + auto const orient = size.width > size.height ? UIInterfaceOrientationLandscapeLeft : UIInterfaceOrientationPortrait; + [coordinator animateAlongsideTransition:^(id context) { + for (MWMAlert * alert in self.view.subviews) + [alert rotate:orient duration:context.transitionDuration]; + } completion:^(id context) {}]; } #pragma mark - Actions @@ -113,10 +116,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController - (void)presentRoutingDisclaimerAlertWithOkBlock:(TMWMVoidBlock)block { - [self - displayAlert:[MWMAlert routingDisclaimerAlertWithInitialOrientation:self.ownerViewController - .interfaceOrientation - okBlock:block]]; + [self displayAlert:[MWMAlert routingDisclaimerAlertWithOkBlock:block]]; } - (void)presentDisabledLocationAlert { [self displayAlert:MWMAlert.disabledLocationAlert]; } diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index 896b68d813..baf9eedab6 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -18,8 +18,7 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock + (MWMAlert *)rateAlert; + (MWMAlert *)facebookAlert; + (MWMAlert *)locationAlert; -+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation - okBlock:(TMWMVoidBlock)block; ++ (MWMAlert *)routingDisclaimerAlertWithOkBlock:(TMWMVoidBlock)block; + (MWMAlert *)disabledLocationAlert; + (MWMAlert *)noWiFiAlertWithOkBlock:(TMWMVoidBlock)okBlock; + (MWMAlert *)noConnectionAlert; diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 8c0065bfc4..6eb3427259 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -21,10 +21,9 @@ return [MWMDefaultAlert point2PointAlertWithOkBlock:block needToRebuild:needToRebuild]; } -+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation - okBlock:(TMWMVoidBlock)block ++ (MWMAlert *)routingDisclaimerAlertWithOkBlock:(TMWMVoidBlock)block { - return [MWMRoutingDisclaimerAlert alertWithInitialOrientation:orientation okBlock:block]; + return [MWMRoutingDisclaimerAlert alertWithOkBlock:block]; } + (MWMAlert *)disabledLocationAlert { return [MWMDefaultAlert disabledLocationAlert]; } @@ -176,18 +175,6 @@ [self willRotateToInterfaceOrientation:toInterfaceOrientation]; } -CGAffineTransform rotation(UIInterfaceOrientation orientation) -{ - switch (orientation) - { - case UIInterfaceOrientationLandscapeLeft: return CGAffineTransformMakeRotation(-M_PI_2); - case UIInterfaceOrientationLandscapeRight: return CGAffineTransformMakeRotation(M_PI_2); - case UIInterfaceOrientationPortraitUpsideDown: return CGAffineTransformMakeRotation(M_PI); - case UIInterfaceOrientationUnknown: - case UIInterfaceOrientationPortrait: return CGAffineTransformIdentity; - } -} - - (void)addControllerViewToWindow { UIWindow * window = UIApplication.sharedApplication.delegate.window; @@ -204,7 +191,8 @@ CGAffineTransform rotation(UIInterfaceOrientation orientation) view.frame = ownerViewController.view.bounds; [ownerViewController.view addSubview:view]; [self addControllerViewToWindow]; - [self rotate:ownerViewController.interfaceOrientation duration:0.0]; + auto const orientation = [[UIApplication sharedApplication] statusBarOrientation]; + [self rotate:orientation duration:0.0]; [view addSubview:self]; self.frame = view.bounds; } diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h index ca234f54f9..db4282d404 100644 --- a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h +++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h @@ -2,7 +2,6 @@ @interface MWMRoutingDisclaimerAlert : MWMAlert -+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation - okBlock:(TMWMVoidBlock)block; ++ (instancetype)alertWithOkBlock:(TMWMVoidBlock)block; @end diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm index a5bc0aa72e..11c6d76f84 100644 --- a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm @@ -18,8 +18,7 @@ static NSString * const kStatisticsEvent = @"Routing Disclaimer Alert"; @implementation MWMRoutingDisclaimerAlert -+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation - okBlock:(TMWMVoidBlock)block ++ (instancetype)alertWithOkBlock:(TMWMVoidBlock)block { [Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatOpen}]; MWMRoutingDisclaimerAlert * alert = diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index 5a5f19be23..2208339d4c 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -265,12 +265,6 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { #pragma mark - Layout -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration -{ - [self.additionalButtons reloadData]; -} - - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h index ad672d6f22..1c86f476bc 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h @@ -33,8 +33,6 @@ - (void)mwm_refreshUI; -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration; - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 715a051424..fd59fad917 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -117,15 +117,6 @@ extern NSString * const kAlohalyticsTapEventKey; [self.placePageManager mwm_refreshUI]; } -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration -{ - [self.menuController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; - // Workaround needs for setting correct left bound while landscape place page is open. - self.navigationManager.leftBound = 0; - [self.placePageManager willRotateToInterfaceOrientation:toInterfaceOrientation]; -} - - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/PlacePage/Cells/OpeningHours/MWMPlacePageOpeningHoursCell.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/PlacePage/Cells/OpeningHours/MWMPlacePageOpeningHoursCell.mm index 5d0a01d227..4771665d64 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/PlacePage/Cells/OpeningHours/MWMPlacePageOpeningHoursCell.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/PlacePage/Cells/OpeningHours/MWMPlacePageOpeningHoursCell.mm @@ -249,7 +249,8 @@ WeekDayView getWeekDayView() - (IBAction)toggleButtonTap { - [self.delegate setOpeningHoursCellExpanded:!self.delegate.openingHoursCellExpanded]; + id delegate = self.delegate; + [delegate setOpeningHoursCellExpanded:!delegate.openingHoursCellExpanded]; // Workaround for slow devices. // Major QA can tap multiple times before first segue call is performed. diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm index cd5b977f92..750f25ab70 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm @@ -87,20 +87,6 @@ BOOL isOffsetInButton(CGFloat offset, MWMSearchTabButtonsView * button) #pragma mark - Layout -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration -{ - self.isRotating = YES; - [UIView animateWithDuration:duration - animations:^{ - [self refreshScrollPosition]; - } - completion:^(BOOL finished) { - [self refreshScrollPosition]; - self.isRotating = NO; - }]; -} - - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { diff --git a/iphone/Maps/Classes/Editor/MWMEditorTextTableViewCell.mm b/iphone/Maps/Classes/Editor/MWMEditorTextTableViewCell.mm index f29faf1257..acbbbaca2e 100644 --- a/iphone/Maps/Classes/Editor/MWMEditorTextTableViewCell.mm +++ b/iphone/Maps/Classes/Editor/MWMEditorTextTableViewCell.mm @@ -113,11 +113,4 @@ namespace return YES; } -#pragma mark - Properties - -- (NSString *)text -{ - return self.textField.text; -} - @end diff --git a/iphone/Maps/Classes/Editor/OpeningHours/MWMOpeningHoursModel.mm b/iphone/Maps/Classes/Editor/OpeningHours/MWMOpeningHoursModel.mm index 583bc3ecd7..4497a9af87 100644 --- a/iphone/Maps/Classes/Editor/OpeningHours/MWMOpeningHoursModel.mm +++ b/iphone/Maps/Classes/Editor/OpeningHours/MWMOpeningHoursModel.mm @@ -174,16 +174,19 @@ using namespace osmoh; if (isSimpleMode && oh) isSimpleMode = MakeTimeTableSet(osmoh::OpeningHours(oh.UTF8String), timeTableSet); + delegate.advancedEditor.hidden = isSimpleMode; + UITableView * tv = delegate.tableView; + UIButton * toggleModeButton = delegate.toggleModeButton; + if (isSimpleMode) { _isSimpleMode = YES; - delegate.tableView.hidden = NO; - delegate.advancedEditor.hidden = YES; - [delegate.toggleModeButton setTitle:L(@"editor_time_advanced") forState:UIControlStateNormal]; + tv.hidden = NO; + [toggleModeButton setTitle:L(@"editor_time_advanced") forState:UIControlStateNormal]; _sections = [NSMutableArray arrayWithCapacity:timeTableSet.Size()]; while (self.sections.count < timeTableSet.Size()) [self addSection]; - [delegate.tableView reloadData]; + [tv reloadData]; } else { @@ -192,9 +195,8 @@ using namespace osmoh; [self updateOpeningHours]; _isSimpleMode = NO; } - delegate.tableView.hidden = YES; - delegate.advancedEditor.hidden = NO; - [delegate.toggleModeButton setTitle:L(@"editor_time_simple") forState:UIControlStateNormal]; + tv.hidden = YES; + [toggleModeButton setTitle:L(@"editor_time_simple") forState:UIControlStateNormal]; MWMTextView * ev = delegate.editorView; ev.text = delegate.openingHours; [ev becomeFirstResponder]; diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm index 6a59942f39..3f153e4c9e 100644 --- a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm @@ -40,44 +40,46 @@ - (void)configWithRow:(place_page::MetainfoRows)row data:(MWMPlacePageData *)data; { + using place_page::MetainfoRows; self.rowType = row; self.data = data; NSString * name; switch (row) { - case place_page::MetainfoRows::Address: + case MetainfoRows::Address: self.toggleImage.hidden = YES; name = @"address"; break; - case place_page::MetainfoRows::Phone: + case MetainfoRows::Phone: self.toggleImage.hidden = YES; name = @"phone_number"; break; - case place_page::MetainfoRows::Website: + case MetainfoRows::Website: self.toggleImage.hidden = YES; name = @"website"; break; - case place_page::MetainfoRows::Email: + case MetainfoRows::Email: self.toggleImage.hidden = YES; name = @"email"; break; - case place_page::MetainfoRows::Cuisine: + case MetainfoRows::Cuisine: self.toggleImage.hidden = YES; name = @"cuisine"; break; - case place_page::MetainfoRows::Operator: + case MetainfoRows::Operator: self.toggleImage.hidden = YES; name = @"operator"; break; - case place_page::MetainfoRows::Internet: + case MetainfoRows::Internet: self.toggleImage.hidden = YES; name = @"wifi"; break; - case place_page::MetainfoRows::Coordinate: + case MetainfoRows::Coordinate: self.toggleImage.hidden = NO; name = @"coordinate"; break; - case place_page::MetainfoRows::OpeningHours: NSAssert(false, @"Incorrect cell type!"); break; + case MetainfoRows::ExtendedOpeningHours: + case MetainfoRows::OpeningHours: NSAssert(false, @"Incorrect cell type!"); break; } [self configWithIconName:name data:[data stringForRow:row]]; } @@ -128,28 +130,29 @@ - (IBAction)cellTap { + using place_page::MetainfoRows; switch (self.rowType) { - case place_page::MetainfoRows::Phone: + case MetainfoRows::Phone: [Statistics logEvent:kStatEventName(kStatPlacePage, kStatCallPhoneNumber)]; break; - case place_page::MetainfoRows::Website: + case MetainfoRows::Website: [Statistics logEvent:kStatEventName(kStatPlacePage, kStatOpenSite)]; break; - case place_page::MetainfoRows::Email: + case MetainfoRows::Email: [Statistics logEvent:kStatEventName(kStatPlacePage, kStatSendEmail)]; break; - case place_page::MetainfoRows::Coordinate: + case MetainfoRows::Coordinate: [Statistics logEvent:kStatEventName(kStatPlacePage, kStatToggleCoordinates)]; [MWMPlacePageData toggleCoordinateSystem]; [self changeText:[self.data stringForRow:self.rowType]]; break; - - case place_page::MetainfoRows::Cuisine: - case place_page::MetainfoRows::Operator: - case place_page::MetainfoRows::OpeningHours: - case place_page::MetainfoRows::Address: - case place_page::MetainfoRows::Internet: break; + case MetainfoRows::ExtendedOpeningHours: + case MetainfoRows::Cuisine: + case MetainfoRows::Operator: + case MetainfoRows::OpeningHours: + case MetainfoRows::Address: + case MetainfoRows::Internet: break; } } diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 4f15b37aa2..d654af9a8b 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -235,25 +235,11 @@ BOOL gIsFirstMyPositionMode = YES; #pragma mark - ViewController lifecycle - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - return YES; // We support all orientations -} - -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation - duration:(NSTimeInterval)duration -{ - [self.alertController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; - [self.controlsManager willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; -} - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { - [self.alertController willRotateToInterfaceOrientation:(size.width > size.height) - ? UIInterfaceOrientationLandscapeLeft - : UIInterfaceOrientationPortrait - duration:kDefaultAnimationDuration]; + [self.alertController viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [self.controlsManager viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [self.pageViewController viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } @@ -348,15 +334,6 @@ BOOL gIsFirstMyPositionMode = YES; { [super viewWillDisappear:animated]; self.controlsManager.menuRestoreState = self.controlsManager.menuState; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(orientationChanged:) - name:UIDeviceOrientationDidChangeNotification - object:nil]; -} - -- (void)orientationChanged:(NSNotification *)notification -{ - [self willRotateToInterfaceOrientation:self.interfaceOrientation duration:0.]; } - (BOOL)prefersStatusBarHidden { return self.apiBar.isVisible; } diff --git a/iphone/Maps/Common/WebViewController.mm b/iphone/Maps/Common/WebViewController.mm index 61519defa0..425a92b907 100644 --- a/iphone/Maps/Common/WebViewController.mm +++ b/iphone/Maps/Common/WebViewController.mm @@ -46,11 +46,6 @@ self.view = webView; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - return YES; -} - - (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType { if (self.openInSafari && inType == UIWebViewNavigationTypeLinkClicked diff --git a/iphone/Maps/Settings/SwitchCell.h b/iphone/Maps/Settings/SwitchCell.h index ca1803e6bb..8dfb1ad1c4 100644 --- a/iphone/Maps/Settings/SwitchCell.h +++ b/iphone/Maps/Settings/SwitchCell.h @@ -9,9 +9,9 @@ @interface SwitchCell : MWMTableViewCell -@property (weak, nonatomic) IBOutlet UILabel * titleLabel; -@property (weak, nonatomic) IBOutlet UISwitch * switchButton; +@property(weak, nonatomic) IBOutlet UILabel * titleLabel; +@property(weak, nonatomic) IBOutlet UISwitch * switchButton; -@property (weak) id delegate; +@property(weak, nonatomic) id delegate; @end