[ios] Fixed some warnings

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2021-11-15 01:37:44 +01:00 committed by Alexander Borsuk
parent fe14ea5372
commit 8e5c08cfa0
10 changed files with 37 additions and 46 deletions

View file

@ -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;

View file

@ -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];
}
}

View file

@ -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:

View file

@ -1,4 +1,4 @@
typedef NS_ENUM(NSUInteger, MWMRouterResultCode) {
typedef NS_CLOSED_ENUM(NSUInteger, MWMRouterResultCode) {
MWMRouterResultCodeNoError = 0,
MWMRouterResultCodeCancelled = 1,
MWMRouterResultCodeNoCurrentPosition = 2,

View file

@ -1,4 +1,4 @@
typedef NS_ENUM(NSUInteger, MWMMyPositionMode) {
typedef NS_CLOSED_ENUM(NSUInteger, MWMMyPositionMode) {
MWMMyPositionModePendingPosition,
MWMMyPositionModeNotFollowNoPosition,
MWMMyPositionModeNotFollow,

View file

@ -1,4 +1,4 @@
typedef NS_ENUM(NSUInteger, MWMRoutePointType) {
typedef NS_CLOSED_ENUM(NSUInteger, MWMRoutePointType) {
MWMRoutePointTypeStart,
MWMRoutePointTypeIntermediate,
MWMRoutePointTypeFinish

View file

@ -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 }

View file

@ -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()
}
}
}

View file

@ -23,7 +23,9 @@
hideView(listButton, isHidden: false, animated: true)
case .default:
break
@unknown default:
case .hidden: fallthrough
case .result: fallthrough
@unknown default:
break
}
}

View file

@ -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];
}
}