From 8e5c08cfa058cd9d82f21d868046f913ef9f2b4a Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Mon, 15 Nov 2021 01:37:44 +0100 Subject: [PATCH] [ios] Fixed some warnings Signed-off-by: Alexander Borsuk --- .../CoreApi/CoreApi.xcodeproj/project.pbxproj | 2 -- .../CustomAlert/RateAlert/MWMRateAlert.mm | 20 +++++++++---------- .../MWMMapViewControlsManager.mm | 20 +++++++------------ .../Routing/MWMRouterResultCode.h | 2 +- iphone/Maps/Core/Location/MWMMyPositionMode.h | 2 +- iphone/Maps/Core/Routing/MWMRoutePoint.h | 2 +- .../Menu/BottomMenuInteractor.swift | 7 +++---- .../TabBar/BottomTabBarInteractor.swift | 12 +++++------ .../Maps/UI/Search/SearchActionBarView.swift | 4 +++- iphone/Maps/UI/Settings/MWMHelpController.m | 12 ++++++----- 10 files changed, 37 insertions(+), 46 deletions(-) diff --git a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj index 72f7f13ddb..3bbff1f770 100644 --- a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj +++ b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj @@ -598,7 +598,6 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -631,7 +630,6 @@ CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; diff --git a/iphone/Maps/Classes/CustomAlert/RateAlert/MWMRateAlert.mm b/iphone/Maps/Classes/CustomAlert/RateAlert/MWMRateAlert.mm index 209e119f8f..93d678ac91 100644 --- a/iphone/Maps/Classes/CustomAlert/RateAlert/MWMRateAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/RateAlert/MWMRateAlert.mm @@ -122,9 +122,7 @@ static NSString * const kRateEmail = @"rating@organicmaps.app"; - (void)sendFeedback { - self.alpha = 0.; - MWMAlertViewController * alertController = self.alertController; - alertController.view.alpha = 0.; + UIViewController * ownerVC = self.alertController.ownerViewController; if ([MWMMailViewController canSendMail]) { NSString * deviceModel = [AppInfo sharedInfo].deviceModel; @@ -147,18 +145,18 @@ static NSString * const kRateEmail = @"rating@organicmaps.app"; [mailController setToRecipients:@[ kRateEmail ]]; [mailController setMessageBody:text isHTML:NO]; mailController.navigationBar.tintColor = UIColor.blackColor; - [alertController.ownerViewController presentViewController:mailController - animated:YES - completion:nil]; + [ownerVC presentViewController:mailController animated:YES completion:nil]; } else { NSString * text = [NSString stringWithFormat:L(@"email_error_body"), kRateEmail]; - [[[UIAlertView alloc] initWithTitle:L(@"email_error_title") - message:text - delegate:nil - cancelButtonTitle:L(@"ok") - otherButtonTitles:nil] show]; + UIAlertController * alert = [UIAlertController alertControllerWithTitle:L(@"email_error_title") + message:text + preferredStyle:UIAlertControllerStyleAlert]; + [alert addAction:[UIAlertAction actionWithTitle:L(@"ok") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) {}]]; + [ownerVC presentViewController:alert animated:YES completion:nil]; } } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index cf6f06999a..13b3955c97 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -249,9 +249,10 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue"; - (BottomTabBarViewController *)tabBarController { if (!_tabBarController) { - _tabBarController = [BottomTabBarBuilder buildWithMapViewController:_ownerController controlsManager:self]; - [self.ownerController addChildViewController:_tabBarController]; - UIView *tabBarViewSuperView = self.ownerController.controlsView; + MapViewController * ownerController = _ownerController; + _tabBarController = [BottomTabBarBuilder buildWithMapViewController:ownerController controlsManager:self]; + [ownerController addChildViewController:_tabBarController]; + UIView * tabBarViewSuperView = ownerController.controlsView; [tabBarViewSuperView addSubview:_tabBarController.view]; } @@ -307,23 +308,16 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue"; - (void)setMenuState:(MWMBottomMenuState)menuState { _menuState = menuState; + MapViewController * ownerController = _ownerController; switch (_menuState) { case MWMBottomMenuStateActive: - _tabBarController.isHidden = NO; - if (_menuController == nil) { - _menuController = [BottomMenuBuilder buildMenuWithMapViewController:_ownerController - controlsManager:self - delegate:self]; - [_ownerController presentViewController:_menuController animated:YES completion:nil]; - } - break; case MWMBottomMenuStateLayers: _tabBarController.isHidden = NO; if (_menuController == nil) { - _menuController = [BottomMenuBuilder buildLayersWithMapViewController:_ownerController + _menuController = [BottomMenuBuilder buildLayersWithMapViewController:ownerController controlsManager:self delegate:self]; - [_ownerController presentViewController:_menuController animated:YES completion:nil]; + [ownerController presentViewController:_menuController animated:YES completion:nil]; } break; case MWMBottomMenuStateInactive: diff --git a/iphone/Maps/Core/Framework/ProxyObjects/Routing/MWMRouterResultCode.h b/iphone/Maps/Core/Framework/ProxyObjects/Routing/MWMRouterResultCode.h index 001022559b..4e9a890f68 100644 --- a/iphone/Maps/Core/Framework/ProxyObjects/Routing/MWMRouterResultCode.h +++ b/iphone/Maps/Core/Framework/ProxyObjects/Routing/MWMRouterResultCode.h @@ -1,4 +1,4 @@ -typedef NS_ENUM(NSUInteger, MWMRouterResultCode) { +typedef NS_CLOSED_ENUM(NSUInteger, MWMRouterResultCode) { MWMRouterResultCodeNoError = 0, MWMRouterResultCodeCancelled = 1, MWMRouterResultCodeNoCurrentPosition = 2, diff --git a/iphone/Maps/Core/Location/MWMMyPositionMode.h b/iphone/Maps/Core/Location/MWMMyPositionMode.h index 64e8fbbca1..54171849c4 100644 --- a/iphone/Maps/Core/Location/MWMMyPositionMode.h +++ b/iphone/Maps/Core/Location/MWMMyPositionMode.h @@ -1,4 +1,4 @@ -typedef NS_ENUM(NSUInteger, MWMMyPositionMode) { +typedef NS_CLOSED_ENUM(NSUInteger, MWMMyPositionMode) { MWMMyPositionModePendingPosition, MWMMyPositionModeNotFollowNoPosition, MWMMyPositionModeNotFollow, diff --git a/iphone/Maps/Core/Routing/MWMRoutePoint.h b/iphone/Maps/Core/Routing/MWMRoutePoint.h index 3a30d61163..f0641b29b4 100644 --- a/iphone/Maps/Core/Routing/MWMRoutePoint.h +++ b/iphone/Maps/Core/Routing/MWMRoutePoint.h @@ -1,4 +1,4 @@ -typedef NS_ENUM(NSUInteger, MWMRoutePointType) { +typedef NS_CLOSED_ENUM(NSUInteger, MWMRoutePointType) { MWMRoutePointTypeStart, MWMRoutePointTypeIntermediate, MWMRoutePointTypeFinish diff --git a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift index 8793057cd6..9a3002adcb 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift @@ -60,10 +60,9 @@ extension BottomMenuInteractor: BottomMenuInteractorProtocol { func shareLocation(cell: BottomMenuItemCell) { let lastLocation = LocationManager.lastLocation() guard let coordinates = lastLocation?.coordinate else { - UIAlertView(title: L("unknown_current_position"), - message: nil, - delegate: nil, - cancelButtonTitle: L("ok")).show() + let alert = UIAlertController(title: L("unknown_current_position"), message: nil, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: L("ok"), style: .default, handler: nil)) + viewController?.present(alert, animated: true, completion: nil) return; } guard let viewController = viewController else { return } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift index 2fd88904a3..8a1f76c730 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift @@ -62,13 +62,11 @@ extension BottomTabBarInteractor: BottomTabBarInteractorProtocol { fatalError() } switch state { - case .hidden: assertionFailure("Incorrect state") - case .inactive: - controlsManager?.menuState = .active - case .active: - controlsManager?.menuState = .inactive - @unknown default: - fatalError() + case .inactive: controlsManager?.menuState = .active + case .active: controlsManager?.menuState = .inactive + case .hidden: fallthrough + case .layers: fallthrough + @unknown default: fatalError() } } } diff --git a/iphone/Maps/UI/Search/SearchActionBarView.swift b/iphone/Maps/UI/Search/SearchActionBarView.swift index aa2d5e0a2b..184304f5ca 100644 --- a/iphone/Maps/UI/Search/SearchActionBarView.swift +++ b/iphone/Maps/UI/Search/SearchActionBarView.swift @@ -23,7 +23,9 @@ hideView(listButton, isHidden: false, animated: true) case .default: break - @unknown default: + case .hidden: fallthrough + case .result: fallthrough + @unknown default: break } } diff --git a/iphone/Maps/UI/Settings/MWMHelpController.m b/iphone/Maps/UI/Settings/MWMHelpController.m index 660bdce4b0..21d5b34bb4 100644 --- a/iphone/Maps/UI/Settings/MWMHelpController.m +++ b/iphone/Maps/UI/Settings/MWMHelpController.m @@ -147,11 +147,13 @@ static NSString * const kiOSEmail = @"ios@organicmaps.app"; else { NSString * text = [NSString stringWithFormat:L(@"email_error_body"), email]; - [[[UIAlertView alloc] initWithTitle:L(@"email_error_title") - message:text - delegate:nil - cancelButtonTitle:L(@"ok") - otherButtonTitles:nil] show]; + UIAlertController * alert = [UIAlertController alertControllerWithTitle:L(@"email_error_title") + message:text + preferredStyle:UIAlertControllerStyleAlert]; + [alert addAction:[UIAlertAction actionWithTitle:L(@"ok") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _) {}]]; + [self presentViewController:alert animated:YES completion:nil]; } }