Clang-format.

This commit is contained in:
Ilya Grechuhin 2016-09-05 12:55:35 +03:00
parent d8fabaa348
commit 72ca15ec61
7 changed files with 74 additions and 125 deletions

View file

@ -7,7 +7,7 @@
+ (nonnull MWMAlertViewController *)activeAlertController;
@property (weak, nonatomic, readonly) UIViewController * _Null_unspecified ownerViewController;
@property(weak, nonatomic, readonly) UIViewController * _Null_unspecified ownerViewController;
- (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController;
- (void)presentAlert:(routing::IRouter::ResultCode)type;
@ -19,7 +19,8 @@
downloadCompleteBlock:(nonnull TMWMVoidBlock)downloadCompleteBlock;
- (void)presentRateAlert;
- (void)presentFacebookAlert;
- (void)presentPoint2PointAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
- (void)presentPoint2PointAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock
needToRebuild:(BOOL)needToRebuild;
- (void)presentRoutingDisclaimerAlertWithOkBlock:(nonnull nonnull TMWMVoidBlock)block;
- (void)presentDisabledLocationAlert;
- (void)presentLocationAlert;
@ -35,9 +36,11 @@
- (void)presentNotEnoughSpaceAlert;
- (void)presentInvalidUserNameOrPasswordAlert;
- (void)presentDisableAutoDownloadAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock;
- (void)presentDownloaderNoConnectionAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock cancelBlock:(nonnull TMWMVoidBlock)cancelBlock;
- (void)presentDownloaderNoConnectionAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock
cancelBlock:(nonnull TMWMVoidBlock)cancelBlock;
- (void)presentDownloaderNotEnoughSpaceAlert;
- (void)presentDownloaderInternalErrorAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock cancelBlock:(nonnull TMWMVoidBlock)cancelBlock;
- (void)presentDownloaderInternalErrorAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock
cancelBlock:(nonnull TMWMVoidBlock)cancelBlock;
- (void)presentDownloaderNeedUpdateAlertWithOkBlock:(nonnull TMWMVoidBlock)okBlock;
- (void)presentPlaceDoesntExistAlertWithBlock:(nonnull MWMStringBlock)block;
- (void)presentResetChangesAlertWithBlock:(nonnull TMWMVoidBlock)block;
@ -49,7 +52,10 @@
- (void)closeAlert;
- (nonnull instancetype)init __attribute__((unavailable("call -initWithViewController: instead!")));
+ (nonnull instancetype)new __attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithCoder:(nonnull NSCoder *)aDecoder __attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil __attribute__((unavailable("call -initWithViewController: instead!")));
+ (nonnull instancetype) new __attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithCoder:(nonnull NSCoder *)aDecoder
__attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil
bundle:(nullable NSBundle *)nibBundleOrNil
__attribute__((unavailable("call -initWithViewController: instead!")));
@end

View file

@ -6,7 +6,7 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
@class MWMAlertViewController;
@interface MWMAlert : UIView
@property (weak, nonatomic) MWMAlertViewController * alertController;
@property(weak, nonatomic) MWMAlertViewController * alertController;
+ (MWMAlert *)alert:(routing::IRouter::ResultCode)type;
+ (MWMAlert *)routingMigrationAlertWithOkBlock:(TMWMVoidBlock)okBlock;
@ -18,7 +18,8 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
+ (MWMAlert *)rateAlert;
+ (MWMAlert *)facebookAlert;
+ (MWMAlert *)locationAlert;
+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation okBlock:(TMWMVoidBlock)block;
+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation
okBlock:(TMWMVoidBlock)block;
+ (MWMAlert *)disabledLocationAlert;
+ (MWMAlert *)noWiFiAlertWithOkBlock:(TMWMVoidBlock)okBlock;
+ (MWMAlert *)noConnectionAlert;
@ -33,9 +34,11 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
+ (MWMAlert *)invalidUserNameOrPasswordAlert;
+ (MWMAlert *)point2PointAlertWithOkBlock:(TMWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
+ (MWMAlert *)disableAutoDownloadAlertWithOkBlock:(TMWMVoidBlock)okBlock;
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(TMWMVoidBlock)okBlock cancelBlock:(TMWMVoidBlock)cancelBlock;
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(TMWMVoidBlock)okBlock
cancelBlock:(TMWMVoidBlock)cancelBlock;
+ (MWMAlert *)downloaderNotEnoughSpaceAlert;
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock cancelBlock:(TMWMVoidBlock)cancelBlock;
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock
cancelBlock:(TMWMVoidBlock)cancelBlock;
+ (MWMAlert *)downloaderNeedUpdateAlertWithOkBlock:(TMWMVoidBlock)okBlock;
+ (MWMAlert *)placeDoesntExistAlertWithBlock:(MWMStringBlock)block;
+ (MWMAlert *)resetChangesAlertWithBlock:(TMWMVoidBlock)block;

View file

@ -1,5 +1,5 @@
#import "Common.h"
#import "MWMAlert.h"
#import "Common.h"
#import "MWMAlertViewController.h"
#import "MWMDefaultAlert.h"
#import "MWMDownloadTransitMapAlert.h"
@ -13,56 +13,29 @@
@implementation MWMAlert
+ (MWMAlert *)rateAlert
{
return [MWMRateAlert alert];
}
+ (MWMAlert *)locationAlert
{
return [MWMLocationAlert alert];
}
+ (MWMAlert *)facebookAlert
{
return [MWMFacebookAlert alert];
}
+ (MWMAlert *)rateAlert { return [MWMRateAlert alert]; }
+ (MWMAlert *)locationAlert { return [MWMLocationAlert alert]; }
+ (MWMAlert *)facebookAlert { return [MWMFacebookAlert alert]; }
+ (MWMAlert *)point2PointAlertWithOkBlock:(TMWMVoidBlock)block needToRebuild:(BOOL)needToRebuild
{
return [MWMDefaultAlert point2PointAlertWithOkBlock:block needToRebuild:needToRebuild];
}
+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation okBlock:(TMWMVoidBlock)block
+ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation
okBlock:(TMWMVoidBlock)block
{
return [MWMRoutingDisclaimerAlert alertWithInitialOrientation:orientation okBlock:block];
}
+ (MWMAlert *)disabledLocationAlert
{
return [MWMDefaultAlert disabledLocationAlert];
}
+ (MWMAlert *)disabledLocationAlert { return [MWMDefaultAlert disabledLocationAlert]; }
+ (MWMAlert *)noWiFiAlertWithOkBlock:(TMWMVoidBlock)okBlock
{
return [MWMDefaultAlert noWiFiAlertWithOkBlock:okBlock];
}
+ (MWMAlert *)noConnectionAlert
{
return [MWMDefaultAlert noConnectionAlert];
}
+ (MWMAlert *)migrationProhibitedAlert
{
return [MWMDefaultAlert migrationProhibitedAlert];
}
+ (MWMAlert *)deleteMapProhibitedAlert
{
return [MWMDefaultAlert deleteMapProhibitedAlert];
}
+ (MWMAlert *)noConnectionAlert { return [MWMDefaultAlert noConnectionAlert]; }
+ (MWMAlert *)migrationProhibitedAlert { return [MWMDefaultAlert migrationProhibitedAlert]; }
+ (MWMAlert *)deleteMapProhibitedAlert { return [MWMDefaultAlert deleteMapProhibitedAlert]; }
+ (MWMAlert *)unsavedEditsAlertWithOkBlock:(TMWMVoidBlock)okBlock
{
return [MWMDefaultAlert unsavedEditsAlertWithOkBlock:okBlock];
@ -100,26 +73,18 @@
{
switch (type)
{
case routing::IRouter::NoCurrentPosition:
return [MWMDefaultAlert noCurrentPositionAlert];
case routing::IRouter::StartPointNotFound:
return [MWMDefaultAlert startPointNotFoundAlert];
case routing::IRouter::EndPointNotFound:
return [MWMDefaultAlert endPointNotFoundAlert];
case routing::IRouter::PointsInDifferentMWM:
return [MWMDefaultAlert pointsInDifferentMWMAlert];
case routing::IRouter::RouteNotFound:
case routing::IRouter::InconsistentMWMandRoute:
return [MWMDefaultAlert routeNotFoundAlert];
case routing::IRouter::RouteFileNotExist:
case routing::IRouter::FileTooOld:
return [MWMDefaultAlert routeFileNotExistAlert];
case routing::IRouter::InternalError:
return [MWMDefaultAlert internalRoutingErrorAlert];
case routing::IRouter::Cancelled:
case routing::IRouter::NoError:
case routing::IRouter::NeedMoreMaps:
return nil;
case routing::IRouter::NoCurrentPosition: return [MWMDefaultAlert noCurrentPositionAlert];
case routing::IRouter::StartPointNotFound: return [MWMDefaultAlert startPointNotFoundAlert];
case routing::IRouter::EndPointNotFound: return [MWMDefaultAlert endPointNotFoundAlert];
case routing::IRouter::PointsInDifferentMWM: return [MWMDefaultAlert pointsInDifferentMWMAlert];
case routing::IRouter::RouteNotFound:
case routing::IRouter::InconsistentMWMandRoute: return [MWMDefaultAlert routeNotFoundAlert];
case routing::IRouter::RouteFileNotExist:
case routing::IRouter::FileTooOld: return [MWMDefaultAlert routeFileNotExistAlert];
case routing::IRouter::InternalError: return [MWMDefaultAlert internalRoutingErrorAlert];
case routing::IRouter::Cancelled:
case routing::IRouter::NoError:
case routing::IRouter::NeedMoreMaps: return nil;
}
}
@ -128,16 +93,8 @@
return [MWMDefaultAlert incorrectFeauturePositionAlert];
}
+ (MWMAlert *)internalErrorAlert
{
return [MWMDefaultAlert internalErrorAlert];
}
+ (MWMAlert *)notEnoughSpaceAlert
{
return [MWMDefaultAlert notEnoughSpaceAlert];
}
+ (MWMAlert *)internalErrorAlert { return [MWMDefaultAlert internalErrorAlert]; }
+ (MWMAlert *)notEnoughSpaceAlert { return [MWMDefaultAlert notEnoughSpaceAlert]; }
+ (MWMAlert *)invalidUserNameOrPasswordAlert
{
return [MWMDefaultAlert invalidUserNameOrPasswordAlert];
@ -148,7 +105,8 @@
return [MWMDefaultAlert disableAutoDownloadAlertWithOkBlock:okBlock];
}
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(TMWMVoidBlock)okBlock cancelBlock:(TMWMVoidBlock)cancelBlock
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(TMWMVoidBlock)okBlock
cancelBlock:(TMWMVoidBlock)cancelBlock
{
return [MWMDefaultAlert downloaderNoConnectionAlertWithOkBlock:okBlock cancelBlock:cancelBlock];
}
@ -158,7 +116,8 @@
return [MWMDefaultAlert downloaderNotEnoughSpaceAlert];
}
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock cancelBlock:(TMWMVoidBlock)cancelBlock
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(TMWMVoidBlock)okBlock
cancelBlock:(TMWMVoidBlock)cancelBlock
{
return [MWMDefaultAlert downloaderInternalErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock];
}
@ -183,16 +142,8 @@
return [MWMDefaultAlert deleteFeatureAlertWithBlock:block];
}
+ (MWMAlert *)editorViralAlert
{
return [MWMEditorViralAlert alert];
}
+ (MWMAlert *)osmAuthAlert
{
return [MWMOsmAuthAlert alert];
}
+ (MWMAlert *)editorViralAlert { return [MWMEditorViralAlert alert]; }
+ (MWMAlert *)osmAuthAlert { return [MWMOsmAuthAlert alert]; }
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block
{
return [MWMDefaultAlert personalInfoWarningAlertWithBlock:block];
@ -205,27 +156,22 @@
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
// Should override this method if you want custom relayout after rotation.
}
- (void)close
{
[self.alertController closeAlert];
// Should override this method if you want custom relayout after rotation.
}
- (void)close { [self.alertController closeAlert]; }
- (void)setNeedsCloseAlertAfterEnterBackground
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidEnterBackground)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
}
- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; }
- (void)applicationDidEnterBackground
{
// Should close alert when application entered background.
// Should close alert when application entered background.
[self close];
}
@ -233,10 +179,10 @@
{
if (isIOS7 && [self respondsToSelector:@selector(setTransform:)])
{
[UIView animateWithDuration:duration animations:^
{
self.transform = rotation(toInterfaceOrientation);
}];
[UIView animateWithDuration:duration
animations:^{
self.transform = rotation(toInterfaceOrientation);
}];
}
if ([self respondsToSelector:@selector(willRotateToInterfaceOrientation:)])
[self willRotateToInterfaceOrientation:toInterfaceOrientation];
@ -246,15 +192,11 @@ 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;
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;
}
}

View file

@ -2,6 +2,7 @@
@interface MWMRoutingDisclaimerAlert : MWMAlert
+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation okBlock:(TMWMVoidBlock)block;
+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation
okBlock:(TMWMVoidBlock)block;
@end

View file

@ -18,7 +18,8 @@ static NSString * const kStatisticsEvent = @"Routing Disclaimer Alert";
@implementation MWMRoutingDisclaimerAlert
+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation okBlock:(TMWMVoidBlock)block
+ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation
okBlock:(TMWMVoidBlock)block
{
[Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatOpen}];
MWMRoutingDisclaimerAlert * alert =

View file

@ -204,8 +204,8 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
MWMAlertViewController * alertController = [MWMAlertViewController activeAlertController];
CLLocation * lastLocation = [MWMLocationManager lastLocation];
BOOL const needToRebuild = lastLocation &&
!location_helpers::isMyPositionPendingOrNoPosition() &&
!self.finishPoint.IsMyPosition();
!location_helpers::isMyPositionPendingOrNoPosition() &&
!self.finishPoint.IsMyPosition();
[alertController presentPoint2PointAlertWithOkBlock:^{
[self buildFromPoint:lastLocationPoint() bestRouter:NO];
}

View file

@ -116,9 +116,5 @@ NSString * const kUDAutoNightModeOff = @"AutoNightModeOff";
return enabled;
}
+ (void)setRoutingDisclaimerApproved
{
settings::Set(kRoutingDisclaimerApprovedKey, true);
}
+ (void)setRoutingDisclaimerApproved { settings::Set(kRoutingDisclaimerApprovedKey, true); }
@end