Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,18 @@
#import "MWMAlert+CPP.h"
#import "MWMAlertViewController.h"
#include "routing/router.hpp"
#include "routing/routing_callbacks.hpp"
#include "storage/storage.hpp"
#include "storage/storage_defines.hpp"
@interface MWMAlertViewController (CPP)
- (void)presentAlert:(routing::RouterResultCode)type;
- (void)presentDownloaderAlertWithCountries:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(nonnull MWMVoidBlock)cancelBlock
downloadBlock:(nonnull MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(nonnull MWMVoidBlock)downloadCompleteBlock;
@end

View file

@ -0,0 +1,60 @@
#import "MWMAlert.h"
#import "MWMMobileInternetAlert.h"
#import "MWMViewController.h"
@interface MWMAlertViewController : MWMViewController
+ (nonnull MWMAlertViewController *)activeAlertController;
@property(weak, nonatomic, readonly) UIViewController *_Null_unspecified ownerViewController;
- (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController;
- (void)presentPoint2PointAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
- (void)presentRoutingDisclaimerAlertWithOkBlock:(nonnull nonnull MWMVoidBlock)block;
- (void)presentDisabledLocationAlert;
- (void)presentLocationAlertWithCancelBlock:(MWMVoidBlock _Nonnull )cancelBlock;
- (void)presentLocationServicesDisabledAlert;
- (void)presentLocationServiceNotSupportedAlert;
- (void)presentNoConnectionAlert;
- (void)presentDeleteMapProhibitedAlert;
- (void)presentUnsavedEditsAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock;
- (void)presentNoWiFiAlertWithOkBlock:(nullable MWMVoidBlock)okBlock andCancelBlock:(nullable MWMVoidBlock)cancelBlock;
- (void)presentIncorrectFeauturePositionAlert;
- (void)presentNotEnoughSpaceAlert;
- (void)presentInvalidUserNameOrPasswordAlert;
- (void)presentDownloaderNoConnectionAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock
cancelBlock:(nonnull MWMVoidBlock)cancelBlock;
- (void)presentDownloaderNotEnoughSpaceAlert;
- (void)presentDownloaderInternalErrorAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock
cancelBlock:(nonnull MWMVoidBlock)cancelBlock;
- (void)presentPlaceDoesntExistAlertWithBlock:(nonnull MWMStringBlock)block;
- (void)presentResetChangesAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentDeleteFeatureAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentTrackWarningAlertWithCancelBlock:(nonnull MWMVoidBlock)block;
- (void)presentMobileInternetAlertWithBlock:(nonnull MWMMobileInternetAlertCompletionBlock)block;
- (void)presentInfoAlert:(nonnull NSString *)title text:(nonnull NSString *)text;
- (void)presentInfoAlert:(nonnull NSString *)title;
- (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
minCharacterNum:(NSUInteger)min
callback:(nonnull MWMCheckStringBlock)callback;
- (void)presentBookmarkConversionErrorAlert;
- (void)presentBugReportAlertWithTitle:(nonnull NSString *)title;
- (void)presentDefaultAlertWithTitle:(nonnull NSString *)title
message:(nullable NSString *)message
rightButtonTitle:(nonnull NSString *)rightButtonTitle
leftButtonTitle:(nullable NSString *)leftButtonTitle
rightButtonAction:(nullable MWMVoidBlock)action;
- (void)closeAlert:(nullable MWMVoidBlock)completion;
- (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!")));
@end

View file

@ -0,0 +1,278 @@
#import "MWMAlertViewController+CPP.h"
#import "MWMController.h"
#import "MWMDownloadTransitMapAlert.h"
#import "MWMLocationAlert.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "SwiftBridge.h"
static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController";
@interface MWMAlertViewController () <UIGestureRecognizerDelegate>
@property(weak, nonatomic, readwrite) UIViewController *ownerViewController;
@end
@implementation MWMAlertViewController
+ (nonnull MWMAlertViewController *)activeAlertController {
UIViewController *tvc = [MapViewController sharedController];
ASSERT([tvc conformsToProtocol:@protocol(MWMController)], ());
UIViewController<MWMController> *mwmController = static_cast<UIViewController<MWMController> *>(tvc);
return mwmController.alertController;
}
- (nonnull instancetype)initWithViewController:(nonnull UIViewController *)viewController {
self = [super initWithNibName:kAlertControllerNibIdentifier bundle:nil];
if (self)
_ownerViewController = viewController;
return self;
}
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
auto const orient = size.width > size.height ? UIInterfaceOrientationLandscapeLeft : UIInterfaceOrientationPortrait;
[coordinator
animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
for (MWMAlert *alert in self.view.subviews)
[alert rotate:orient duration:context.transitionDuration];
}
completion:^(id<UIViewControllerTransitionCoordinatorContext> context){
}];
}
#pragma mark - Actions
- (void)presentLocationAlertWithCancelBlock:(MWMVoidBlock)cancelBlock {
[self displayAlert:[MWMAlert locationAlertWithCancelBlock:cancelBlock]];
}
- (void)presentPoint2PointAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild {
[self displayAlert:[MWMAlert point2PointAlertWithOkBlock:okBlock needToRebuild:needToRebuild]];
}
- (void)presentLocationServiceNotSupportedAlert {
[self displayAlert:[MWMAlert locationServiceNotSupportedAlert]];
}
- (void)presentNoConnectionAlert {
[self displayAlert:[MWMAlert noConnectionAlert]];
}
- (void)presentDeleteMapProhibitedAlert {
[self displayAlert:[MWMAlert deleteMapProhibitedAlert]];
}
- (void)presentUnsavedEditsAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock {
[self displayAlert:[MWMAlert unsavedEditsAlertWithOkBlock:okBlock]];
}
- (void)presentNoWiFiAlertWithOkBlock:(nullable MWMVoidBlock)okBlock andCancelBlock:(MWMVoidBlock)cancelBlock {
[self displayAlert:[MWMAlert noWiFiAlertWithOkBlock:okBlock andCancelBlock:cancelBlock]];
}
- (void)presentIncorrectFeauturePositionAlert {
[self displayAlert:[MWMAlert incorrectFeaturePositionAlert]];
}
- (void)presentNotEnoughSpaceAlert {
[self displayAlert:[MWMAlert notEnoughSpaceAlert]];
}
- (void)presentInvalidUserNameOrPasswordAlert {
[self displayAlert:[MWMAlert invalidUserNameOrPasswordAlert]];
}
- (void)presentDownloaderAlertWithCountries:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(MWMVoidBlock)cancelBlock
downloadBlock:(MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(MWMVoidBlock)downloadCompleteBlock {
[self displayAlert:[MWMAlert downloaderAlertWithAbsentCountries:countries
code:code
cancelBlock:cancelBlock
downloadBlock:downloadBlock
downloadCompleteBlock:downloadCompleteBlock]];
}
- (void)presentRoutingDisclaimerAlertWithOkBlock:(MWMVoidBlock)block {
[self displayAlert:[MWMAlert routingDisclaimerAlertWithOkBlock:block]];
}
- (void)presentDisabledLocationAlert {
[self displayAlert:[MWMAlert disabledLocationAlert]];
}
- (void)presentLocationServicesDisabledAlert; {
[self displayAlert:[MWMAlert locationServicesDisabledAlert]];
}
- (void)presentAlert:(routing::RouterResultCode)type {
[self displayAlert:[MWMAlert alert:type]];
}
- (void)presentDownloaderNoConnectionAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock
cancelBlock:(nonnull MWMVoidBlock)cancelBlock {
[self displayAlert:[MWMAlert downloaderNoConnectionAlertWithOkBlock:okBlock cancelBlock:cancelBlock]];
}
- (void)presentDownloaderNotEnoughSpaceAlert {
[self displayAlert:[MWMAlert downloaderNotEnoughSpaceAlert]];
}
- (void)presentDownloaderInternalErrorAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock
cancelBlock:(nonnull MWMVoidBlock)cancelBlock {
[self displayAlert:[MWMAlert downloaderInternalErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock]];
}
- (void)presentPlaceDoesntExistAlertWithBlock:(MWMStringBlock)block {
[self displayAlert:[MWMAlert placeDoesntExistAlertWithBlock:block]];
}
- (void)presentResetChangesAlertWithBlock:(MWMVoidBlock)block {
[self displayAlert:[MWMAlert resetChangesAlertWithBlock:block]];
}
- (void)presentDeleteFeatureAlertWithBlock:(MWMVoidBlock)block {
[self displayAlert:[MWMAlert deleteFeatureAlertWithBlock:block]];
}
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull MWMVoidBlock)block {
[self displayAlert:[MWMAlert personalInfoWarningAlertWithBlock:block]];
}
- (void)presentTrackWarningAlertWithCancelBlock:(nonnull MWMVoidBlock)block {
[self displayAlert:[MWMAlert trackWarningAlertWithCancelBlock:block]];
}
- (void)presentMobileInternetAlertWithBlock:(nonnull MWMMobileInternetAlertCompletionBlock)block {
[self displayAlert:[MWMMobileInternetAlert alertWithBlock:block]];
}
- (void)presentInfoAlert:(nonnull NSString *)title text:(nonnull NSString *)text {
[self displayAlert:[MWMAlert infoAlert:title text:text]];
}
- (void)presentInfoAlert:(nonnull NSString *)title {
[self displayAlert:[MWMAlert infoAlert:title text:nil]];
}
- (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
minCharacterNum:(NSUInteger)min
callback:(nonnull MWMCheckStringBlock)callback {
auto alert =
static_cast<MWMBCCreateCategoryAlert *>([MWMAlert createBookmarkCategoryAlertWithMaxCharacterNum:max
minCharacterNum:min
callback:callback]);
[self displayAlert:alert];
dispatch_async(dispatch_get_main_queue(), ^{
[alert.textField becomeFirstResponder];
});
}
- (void)presentSpinnerAlertWithTitle:(nonnull NSString *)title cancel:(nullable MWMVoidBlock)cancel {
[self displayAlert:[MWMAlert spinnerAlertWithTitle:title cancel:cancel]];
}
- (void)presentBookmarkConversionErrorAlert {
[self displayAlert:[MWMAlert bookmarkConversionErrorAlert]];
}
- (void)presentTagsLoadingErrorAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock
cancelBlock:(nonnull MWMVoidBlock)cancelBlock {
[self displayAlert:[MWMAlert tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock]];
}
- (void)presentBugReportAlertWithTitle:(nonnull NSString *)title {
[self displayAlert:[MWMAlert bugReportAlertWithTitle:title]];
}
- (void)presentDefaultAlertWithTitle:(nonnull NSString *)title
message:(nullable NSString *)message
rightButtonTitle:(nonnull NSString *)rightButtonTitle
leftButtonTitle:(nullable NSString *)leftButtonTitle
rightButtonAction:(nullable MWMVoidBlock)action {
[self displayAlert:[MWMAlert defaultAlertWithTitle:title
message:message
rightButtonTitle:rightButtonTitle
leftButtonTitle:leftButtonTitle
rightButtonAction:action]];
}
- (void)displayAlert:(MWMAlert *)alert {
UIViewController *ownerVC = self.ownerViewController;
if (ownerVC.navigationController != nil) {
ownerVC = ownerVC.navigationController;
}
BOOL isOwnerLoaded = ownerVC.isViewLoaded;
if (!isOwnerLoaded) {
return;
}
// TODO(igrechuhin): Remove this check on location manager refactoring.
// Workaround for current location manager duplicate error alerts.
if ([alert isKindOfClass:[MWMLocationAlert class]]) {
for (MWMAlert *view in self.view.subviews) {
if ([view isKindOfClass:[MWMLocationAlert class]])
return;
}
}
[UIView animateWithDuration:kDefaultAnimationDuration
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
for (MWMAlert *view in self.view.subviews) {
if (view != alert)
view.alpha = 0.0;
}
}
completion:nil];
[self willMoveToParentViewController:NULL];
[self.view removeFromSuperview];
[self removeFromParentViewController];
alert.alertController = self;
[ownerVC addChildViewController:self];
self.view.frame = CGRectMake(0, 0, ownerVC.view.frame.size.width, ownerVC.view.frame.size.height);
[ownerVC.view addSubview:self.view];
[self didMoveToParentViewController:ownerVC];
alert.alpha = 0.;
[self.view addSubview:alert];
CGFloat const scale = 1.1;
alert.transform = CGAffineTransformMakeScale(scale, scale);
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
self.view.alpha = 1.;
alert.alpha = 1.;
alert.transform = CGAffineTransformIdentity;
}];
[[MapsAppDelegate theApp].window endEditing:YES];
}
- (void)closeAlert:(nullable MWMVoidBlock)completion {
NSArray *subviews = self.view.subviews;
MWMAlert *closeAlert = subviews.lastObject;
MWMAlert *showAlert = (subviews.count >= 2 ? subviews[subviews.count - 2] : nil);
[UIView animateWithDuration:kDefaultAnimationDuration
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
closeAlert.alpha = 0.;
if (showAlert)
showAlert.alpha = 1.;
else
self.view.alpha = 0.;
}
completion:^(BOOL finished) {
[closeAlert removeFromSuperview];
if (!showAlert) {
[self.view removeFromSuperview];
[self removeFromParentViewController];
}
if (completion)
completion();
}];
}
@end

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMAlertViewController">
<connections>
<outlet property="view" destination="PTX-3C-07U" id="OUb-QU-9sV"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view multipleTouchEnabled="YES" contentMode="scaleToFill" id="PTX-3C-07U" customClass="SolidTouchView" propertyAccessControl="all">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="1tF-gt-bLj"/>
<point key="canvasLocation" x="528" y="235"/>
</view>
</objects>
</document>

View file

@ -0,0 +1,19 @@
#import "MWMAlert.h"
#include "routing/router.hpp"
#include "routing/routing_callbacks.hpp"
#include "storage/storage.hpp"
#include "storage/storage_defines.hpp"
using MWMDownloadBlock = void (^)(storage::CountriesVec const &, MWMVoidBlock);
@interface MWMAlert (CPP)
+ (MWMAlert *)alert:(routing::RouterResultCode)type;
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(MWMVoidBlock)cancelBlock
downloadBlock:(MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(MWMVoidBlock)downloadCompleteBlock;
@end

View file

@ -0,0 +1,51 @@
@class MWMAlertViewController;
@interface MWMAlert : UIView
@property(weak, nonatomic) MWMAlertViewController *alertController;
+ (MWMAlert *)locationAlertWithCancelBlock:(MWMVoidBlock)cancelBlock;
+ (MWMAlert *)routingDisclaimerAlertWithOkBlock:(MWMVoidBlock)block;
+ (MWMAlert *)disabledLocationAlert;
+ (MWMAlert *)locationServicesDisabledAlert;
+ (MWMAlert *)noWiFiAlertWithOkBlock:(MWMVoidBlock)okBlock andCancelBlock:(MWMVoidBlock)cancelBlock;
+ (MWMAlert *)noConnectionAlert;
+ (MWMAlert *)deleteMapProhibitedAlert;
+ (MWMAlert *)unsavedEditsAlertWithOkBlock:(MWMVoidBlock)okBlock;
+ (MWMAlert *)locationServiceNotSupportedAlert;
+ (MWMAlert *)incorrectFeaturePositionAlert;
+ (MWMAlert *)notEnoughSpaceAlert;
+ (MWMAlert *)invalidUserNameOrPasswordAlert;
+ (MWMAlert *)point2PointAlertWithOkBlock:(MWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock;
+ (MWMAlert *)downloaderNotEnoughSpaceAlert;
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock;
+ (MWMAlert *)placeDoesntExistAlertWithBlock:(MWMStringBlock)block;
+ (MWMAlert *)resetChangesAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)deleteFeatureAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)trackWarningAlertWithCancelBlock:(MWMVoidBlock)block;
+ (MWMAlert *)infoAlert:(NSString *)title text:(NSString *)text;
+ (MWMAlert *)createBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
minCharacterNum:(NSUInteger)min
callback:(MWMCheckStringBlock)callback;
+ (MWMAlert *)spinnerAlertWithTitle:(NSString *)title cancel:(MWMVoidBlock)cancel;
+ (MWMAlert *)bookmarkConversionErrorAlert;
+ (MWMAlert *)tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock;
+ (MWMAlert *)bugReportAlertWithTitle:(NSString *)title;
+ (MWMAlert *)defaultAlertWithTitle:(NSString *)title
message:(NSString *)message
rightButtonTitle:(NSString *)rightButtonTitle
leftButtonTitle:(NSString *)leftButtonTitle
rightButtonAction:(MWMVoidBlock)action;
- (void)close:(MWMVoidBlock)completion;
- (void)setNeedsCloseAlertAfterEnterBackground;
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation;
- (void)rotate:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
- (void)addControllerViewToWindow;
@end

View file

@ -0,0 +1,234 @@
#import "MWMAlert+CPP.h"
#import "MWMAlertViewController.h"
#import "MWMDefaultAlert.h"
#import "MWMDownloadTransitMapAlert.h"
#import "MWMLocationAlert.h"
#import "MWMPlaceDoesntExistAlert.h"
#import "MWMRoutingDisclaimerAlert.h"
#import "SwiftBridge.h"
@implementation MWMAlert
+ (MWMAlert *)locationAlertWithCancelBlock:(MWMVoidBlock)cancelBlock {
return [MWMLocationAlert alertWithCancelBlock:cancelBlock];
}
+ (MWMAlert *)point2PointAlertWithOkBlock:(MWMVoidBlock)block needToRebuild:(BOOL)needToRebuild {
return [MWMDefaultAlert point2PointAlertWithOkBlock:block needToRebuild:needToRebuild];
}
+ (MWMAlert *)routingDisclaimerAlertWithOkBlock:(MWMVoidBlock)block {
return [MWMRoutingDisclaimerAlert alertWithOkBlock:block];
}
+ (MWMAlert *)disabledLocationAlert {
return [MWMDefaultAlert disabledLocationAlert];
}
+ (MWMAlert *)locationServicesDisabledAlert {
return [LocationServicesDisabledAlert alert];
}
+ (MWMAlert *)noWiFiAlertWithOkBlock:(MWMVoidBlock)okBlock andCancelBlock:(MWMVoidBlock)cancelBlock {
return [MWMDefaultAlert noWiFiAlertWithOkBlock:okBlock andCancelBlock:cancelBlock];
}
+ (MWMAlert *)noConnectionAlert {
return [MWMDefaultAlert noConnectionAlert];
}
+ (MWMAlert *)deleteMapProhibitedAlert {
return [MWMDefaultAlert deleteMapProhibitedAlert];
}
+ (MWMAlert *)unsavedEditsAlertWithOkBlock:(MWMVoidBlock)okBlock {
return [MWMDefaultAlert unsavedEditsAlertWithOkBlock:okBlock];
}
+ (MWMAlert *)locationServiceNotSupportedAlert {
return [MWMDefaultAlert locationServiceNotSupportedAlert];
}
+ (MWMAlert *)downloaderAlertWithAbsentCountries:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(MWMVoidBlock)cancelBlock
downloadBlock:(MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(MWMVoidBlock)downloadCompleteBlock {
return [MWMDownloadTransitMapAlert downloaderAlertWithMaps:countries
code:code
cancelBlock:cancelBlock
downloadBlock:downloadBlock
downloadCompleteBlock:downloadCompleteBlock];
}
+ (MWMAlert *)alert:(routing::RouterResultCode)type {
switch (type) {
case routing::RouterResultCode::NoCurrentPosition:
return [MWMDefaultAlert noCurrentPositionAlert];
case routing::RouterResultCode::StartPointNotFound:
return [MWMDefaultAlert startPointNotFoundAlert];
case routing::RouterResultCode::EndPointNotFound:
return [MWMDefaultAlert endPointNotFoundAlert];
case routing::RouterResultCode::PointsInDifferentMWM:
return [MWMDefaultAlert pointsInDifferentMWMAlert];
case routing::RouterResultCode::TransitRouteNotFoundNoNetwork:
return [MWMDefaultAlert routeNotFoundNoPublicTransportAlert];
case routing::RouterResultCode::TransitRouteNotFoundTooLongPedestrian:
return [MWMDefaultAlert routeNotFoundTooLongPedestrianAlert];
case routing::RouterResultCode::RouteNotFoundRedressRouteError:
case routing::RouterResultCode::RouteNotFound:
case routing::RouterResultCode::InconsistentMWMandRoute:
return [MWMDefaultAlert routeNotFoundAlert];
case routing::RouterResultCode::RouteFileNotExist:
case routing::RouterResultCode::FileTooOld:
return [MWMDefaultAlert routeFileNotExistAlert];
case routing::RouterResultCode::InternalError:
return [MWMDefaultAlert internalRoutingErrorAlert];
case routing::RouterResultCode::Cancelled:
case routing::RouterResultCode::NoError:
case routing::RouterResultCode::HasWarnings:
case routing::RouterResultCode::NeedMoreMaps:
return nil;
case routing::RouterResultCode::IntermediatePointNotFound:
return [MWMDefaultAlert intermediatePointNotFoundAlert];
}
}
+ (MWMAlert *)incorrectFeaturePositionAlert {
return [MWMDefaultAlert incorrectFeaturePositionAlert];
}
+ (MWMAlert *)notEnoughSpaceAlert {
return [MWMDefaultAlert notEnoughSpaceAlert];
}
+ (MWMAlert *)invalidUserNameOrPasswordAlert {
return [MWMDefaultAlert invalidUserNameOrPasswordAlert];
}
+ (MWMAlert *)downloaderNoConnectionAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock {
return [MWMDefaultAlert downloaderNoConnectionAlertWithOkBlock:okBlock cancelBlock:cancelBlock];
}
+ (MWMAlert *)downloaderNotEnoughSpaceAlert {
return [MWMDefaultAlert downloaderNotEnoughSpaceAlert];
}
+ (MWMAlert *)downloaderInternalErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock {
return [MWMDefaultAlert downloaderInternalErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock];
}
+ (MWMAlert *)placeDoesntExistAlertWithBlock:(MWMStringBlock)block {
return [MWMPlaceDoesntExistAlert alertWithBlock:block];
}
+ (MWMAlert *)resetChangesAlertWithBlock:(MWMVoidBlock)block {
return [MWMDefaultAlert resetChangesAlertWithBlock:block];
}
+ (MWMAlert *)deleteFeatureAlertWithBlock:(MWMVoidBlock)block {
return [MWMDefaultAlert deleteFeatureAlertWithBlock:block];
}
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block {
return [MWMDefaultAlert personalInfoWarningAlertWithBlock:block];
}
+ (MWMAlert *)trackWarningAlertWithCancelBlock:(MWMVoidBlock)block {
return [MWMDefaultAlert trackWarningAlertWithCancelBlock:block];
}
+ (MWMAlert *)infoAlert:(NSString *)title text:(NSString *)text {
return [MWMDefaultAlert infoAlert:title text:text];
}
+ (MWMAlert *)createBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
minCharacterNum:(NSUInteger)min
callback:(MWMCheckStringBlock)callback {
return [MWMBCCreateCategoryAlert alertWithMaxCharachersNum:max minCharactersNum:min callback:callback];
}
+ (MWMAlert *)spinnerAlertWithTitle:(NSString *)title cancel:(MWMVoidBlock)cancel {
return [MWMSpinnerAlert alertWithTitle:title cancel:cancel];
}
+ (MWMAlert *)bookmarkConversionErrorAlert {
return [MWMDefaultAlert bookmarkConversionErrorAlert];
}
+ (MWMAlert *)tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock {
return [MWMDefaultAlert tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock];
}
+ (MWMAlert *)bugReportAlertWithTitle:(NSString *)title {
return [MWMDefaultAlert bugReportAlertWithTitle:title];
}
+ (MWMAlert *)defaultAlertWithTitle:(NSString *)title
message:(NSString *)message
rightButtonTitle:(NSString *)rightButtonTitle
leftButtonTitle:(NSString *)leftButtonTitle
rightButtonAction:(MWMVoidBlock)action {
return [MWMDefaultAlert defaultAlertWithTitle:title
message:message
rightButtonTitle:rightButtonTitle
leftButtonTitle:leftButtonTitle
rightButtonAction:action
log:nil];
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
// Should override this method if you want custom relayout after rotation.
}
- (void)close:(MWMVoidBlock)completion {
[self.alertController closeAlert:completion];
}
- (void)setNeedsCloseAlertAfterEnterBackground {
[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.
[self close:nil];
}
- (void)rotate:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if ([self respondsToSelector:@selector(willRotateToInterfaceOrientation:)])
[self willRotateToInterfaceOrientation:toInterfaceOrientation];
}
- (void)addControllerViewToWindow {
UIWindow *window = UIApplication.sharedApplication.delegate.window;
UIView *view = self.alertController.view;
[window addSubview:view];
view.frame = window.bounds;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.frame = self.superview.bounds;
[super layoutSubviews];
}
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if (self.traitCollection.userInterfaceStyle != previousTraitCollection.userInterfaceStyle) {
[self updateViewStyle:self];
}
}
- (void)updateViewStyle:(UIView *)view {
if (!view)
return;
for (UIView *subview in view.subviews)
[self updateViewStyle:subview];
[view applyTheme];
}
@end

View file

@ -0,0 +1,151 @@
@objc(MWMBCCreateCategoryAlert)
final class BCCreateCategoryAlert: MWMAlert {
private enum State {
case valid
case tooFewSymbols
case tooManySymbols
case nameAlreadyExists
}
@IBOutlet private(set) weak var textField: UITextField!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var textFieldContainer: UIView!
@IBOutlet private weak var centerHorizontaly: NSLayoutConstraint!
@IBOutlet private weak var errorLabel: UILabel!
@IBOutlet private weak var charactersCountLabel: UILabel!
@IBOutlet private weak var rightButton: UIButton!
private var maxCharactersNum: UInt?
private var minCharactersNum: UInt?
private var callback: MWMCheckStringBlock?
@objc static func alert(maxCharachersNum: UInt,
minCharactersNum: UInt,
callback: @escaping MWMCheckStringBlock) -> BCCreateCategoryAlert? {
guard let alert = Bundle.main.loadNibNamed(className(), owner: nil, options: nil)?.first
as? BCCreateCategoryAlert else {
assertionFailure()
return nil
}
alert.titleLabel.text = L("bookmarks_create_new_group")
let text = L("create").capitalized
for s in [.normal, .highlighted, .disabled] as [UIControl.State] {
alert.rightButton.setTitle(text, for: s)
}
alert.maxCharactersNum = maxCharachersNum
alert.minCharactersNum = minCharactersNum
alert.callback = callback
alert.process(state: .tooFewSymbols)
alert.formatCharactersCountText()
MWMKeyboard.add(alert)
return alert
}
@IBAction private func leftButtonTap() {
MWMKeyboard.remove(self)
close(nil)
}
@IBAction private func rightButtonTap() {
guard let callback = callback, let text = textField.text else {
assertionFailure()
return
}
if callback(text) {
MWMKeyboard.remove(self)
close(nil)
} else {
process(state: .nameAlreadyExists)
}
}
@IBAction private func editingChanged(sender: UITextField) {
formatCharactersCountText()
process(state: checkState())
}
private func checkState() -> State {
let count = textField.text!.count
if count <= minCharactersNum! {
return .tooFewSymbols
}
if count > maxCharactersNum! {
return .tooManySymbols
}
return .valid
}
private func process(state: State) {
let style: TextColorStyleSheet
switch state {
case .valid:
style = .blackHint
rightButton.isEnabled = true
errorLabel.isHidden = true
case .tooFewSymbols:
style = .blackHint
errorLabel.isHidden = true
rightButton.isEnabled = false
case .tooManySymbols:
style = .buttonRed
errorLabel.isHidden = false
errorLabel.text = L("bookmarks_error_title_list_name_too_long")
rightButton.isEnabled = false
case .nameAlreadyExists:
style = .buttonRed
errorLabel.isHidden = false
errorLabel.text = L("bookmarks_error_title_list_name_already_taken")
rightButton.isEnabled = false
}
charactersCountLabel.setFontStyleAndApply(style)
textFieldContainer.layer.borderColor = charactersCountLabel.textColor.cgColor
}
private func formatCharactersCountText() {
let count = textField.text!.count
charactersCountLabel.text = String(count) + " / " + String(maxCharactersNum!)
}
}
extension BCCreateCategoryAlert: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if checkState() == .valid {
rightButtonTap()
}
return true
}
func textField(_ textField: UITextField,
shouldChangeCharactersIn range: NSRange,
replacementString string: String) -> Bool {
let str = textField.text as NSString?
let newStr = str?.replacingCharacters(in: range, with: string)
guard let count = newStr?.count else {
return true
}
if count > maxCharactersNum! + 1 {
return false
}
return true
}
}
extension BCCreateCategoryAlert: MWMKeyboardObserver {
func onKeyboardAnimation() {
centerHorizontaly.constant = -MWMKeyboard.keyboardHeight() / 2
layoutIfNeeded()
}
func onKeyboardWillAnimate() {
setNeedsLayout()
}
}

View file

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="QQB-Ml-wwB" customClass="MWMBCCreateCategoryAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QG2-Qb-EKf" userLabel="ContainerView">
<rect key="frame" x="47.5" y="248" width="280" height="171.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4T3-au-6h5" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="21.5"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="4gN-jJ-fkn"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="dpW-YS-s4x"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmarks_create_new_group"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="otE-Ct-TPM">
<rect key="frame" x="16" y="61.5" width="248" height="28"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xlp-ke-FxI">
<rect key="frame" x="4" y="0.0" width="240" height="28"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="T3H-0E-q2e"/>
</constraints>
<edgeInsets key="layoutMargins" top="4" left="4" bottom="4" right="4"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences" autocorrectionType="no" returnKeyType="done" textContentType="name"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background:regular14:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedPlaceholder" value="bookmark_set_name"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="editingChangedWithSender:" destination="QQB-Ml-wwB" eventType="editingChanged" id="Rab-rj-UaD"/>
<outlet property="delegate" destination="QQB-Ml-wwB" id="7Hk-7k-Biw"/>
</connections>
</textField>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="497-yd-ibe"/>
<constraint firstItem="xlp-ke-FxI" firstAttribute="centerY" secondItem="otE-Ct-TPM" secondAttribute="centerY" id="LK1-93-zgY"/>
<constraint firstAttribute="width" constant="248" id="hLe-SE-FJ2"/>
<constraint firstItem="xlp-ke-FxI" firstAttribute="centerX" secondItem="otE-Ct-TPM" secondAttribute="centerX" id="sOC-II-DCo"/>
<constraint firstItem="xlp-ke-FxI" firstAttribute="height" secondItem="otE-Ct-TPM" secondAttribute="height" id="tj3-TS-dmp"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertViewTextFieldContainer"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uxx-Di-f1Q" userLabel="hDivider">
<rect key="frame" x="0.0" y="127.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="9Ur-cw-cWk"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wxi-5V-caq" userLabel="left">
<rect key="frame" x="0.0" y="127.5" width="140" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="PcO-3k-jAQ"/>
<constraint firstAttribute="height" constant="44" id="sIn-W3-LqB"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cancel"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="leftButtonTap" destination="QQB-Ml-wwB" eventType="touchUpInside" id="q1X-dI-dSs"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eg6-8K-8yh" userLabel="right">
<rect key="frame" x="140" y="127.5" width="140" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="Pk8-S5-m8D"/>
<constraint firstAttribute="width" constant="140" id="m9E-k8-sQh"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="create"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalTransButton:medium17"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="rightButtonTap" destination="QQB-Ml-wwB" eventType="touchUpInside" id="HT2-dB-W2f"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QQD-2O-DHw" userLabel="vDivider">
<rect key="frame" x="139.5" y="127.5" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="Lhw-ff-5Vq"/>
<constraint firstAttribute="height" constant="44" id="eaZ-L1-nnD"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This name is too long" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dX9-2y-ZEd" userLabel="Error label">
<rect key="frame" x="16" y="95.5" width="112" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="W4K-74-Pug"/>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="198" id="uYL-oU-tYf"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular11:buttonRedText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" verticalHuggingPriority="251" text="69 / 60" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WKj-KX-xnU" userLabel="Count label">
<rect key="frame" x="225.5" y="95.5" width="38.5" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="aJd-wn-gwl"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular11:buttonRedText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="4T3-au-6h5" firstAttribute="top" secondItem="QG2-Qb-EKf" secondAttribute="top" constant="20" id="2l5-Sp-9hA"/>
<constraint firstItem="dX9-2y-ZEd" firstAttribute="top" secondItem="otE-Ct-TPM" secondAttribute="bottom" constant="6" id="3N9-5v-z4Y"/>
<constraint firstAttribute="bottom" secondItem="Wxi-5V-caq" secondAttribute="bottom" id="3Ze-v3-100"/>
<constraint firstAttribute="trailing" secondItem="eg6-8K-8yh" secondAttribute="trailing" id="6oa-ch-DMu"/>
<constraint firstItem="Wxi-5V-caq" firstAttribute="leading" secondItem="QG2-Qb-EKf" secondAttribute="leading" id="6v3-kv-oqt"/>
<constraint firstItem="uxx-Di-f1Q" firstAttribute="top" secondItem="dX9-2y-ZEd" secondAttribute="bottom" constant="12" id="7Bf-UJ-7mU"/>
<constraint firstItem="uxx-Di-f1Q" firstAttribute="centerX" secondItem="QG2-Qb-EKf" secondAttribute="centerX" id="CSk-xb-Fd3"/>
<constraint firstAttribute="width" constant="280" id="CwP-uI-Ukp"/>
<constraint firstItem="uxx-Di-f1Q" firstAttribute="width" secondItem="QG2-Qb-EKf" secondAttribute="width" id="Fcb-Hq-n6a"/>
<constraint firstItem="otE-Ct-TPM" firstAttribute="top" secondItem="4T3-au-6h5" secondAttribute="bottom" constant="20" id="NAI-NR-TFE"/>
<constraint firstItem="otE-Ct-TPM" firstAttribute="centerX" secondItem="QG2-Qb-EKf" secondAttribute="centerX" id="Y2k-u1-PgF"/>
<constraint firstItem="Wxi-5V-caq" firstAttribute="top" secondItem="uxx-Di-f1Q" secondAttribute="bottom" constant="-1" id="Yo8-tt-8Q6"/>
<constraint firstAttribute="trailing" secondItem="WKj-KX-xnU" secondAttribute="trailing" constant="16" id="aRt-r1-EwI"/>
<constraint firstItem="4T3-au-6h5" firstAttribute="centerX" secondItem="QG2-Qb-EKf" secondAttribute="centerX" id="cTf-xg-SpW"/>
<constraint firstItem="dX9-2y-ZEd" firstAttribute="leading" secondItem="QG2-Qb-EKf" secondAttribute="leading" constant="16" id="gyf-Hq-FLl"/>
<constraint firstItem="QQD-2O-DHw" firstAttribute="centerX" secondItem="QG2-Qb-EKf" secondAttribute="centerX" id="sUU-uz-fhn"/>
<constraint firstAttribute="bottom" secondItem="QQD-2O-DHw" secondAttribute="bottom" id="vgE-JK-Ong"/>
<constraint firstAttribute="bottom" secondItem="eg6-8K-8yh" secondAttribute="bottom" id="vzg-UL-heQ"/>
<constraint firstItem="WKj-KX-xnU" firstAttribute="top" secondItem="otE-Ct-TPM" secondAttribute="bottom" constant="6" id="zK8-7y-xuI"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="QG2-Qb-EKf" firstAttribute="centerY" secondItem="QQB-Ml-wwB" secondAttribute="centerY" id="od7-2i-rqy"/>
<constraint firstItem="QG2-Qb-EKf" firstAttribute="centerX" secondItem="QQB-Ml-wwB" secondAttribute="centerX" id="zjO-HS-7Up"/>
</constraints>
<viewLayoutGuide key="safeArea" id="oQA-N9-AkF"/>
<connections>
<outlet property="centerHorizontaly" destination="od7-2i-rqy" id="lVF-DA-PUg"/>
<outlet property="charactersCountLabel" destination="WKj-KX-xnU" id="X0L-zL-ZcF"/>
<outlet property="errorLabel" destination="dX9-2y-ZEd" id="XLx-WJ-h4h"/>
<outlet property="rightButton" destination="eg6-8K-8yh" id="YGF-Zh-u1y"/>
<outlet property="textField" destination="xlp-ke-FxI" id="pBV-Ne-ekt"/>
<outlet property="textFieldContainer" destination="otE-Ct-TPM" id="Nf8-ly-qdn"/>
<outlet property="titleLabel" destination="4T3-au-6h5" id="ye3-HE-xqN"/>
</connections>
<point key="canvasLocation" x="304.5" y="171.5"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,45 @@
#import "MWMAlert.h"
@interface MWMDefaultAlert : MWMAlert
+ (instancetype)routeNotFoundAlert;
+ (instancetype)routeNotFoundNoPublicTransportAlert;
+ (instancetype)routeNotFoundTooLongPedestrianAlert;
+ (instancetype)routeFileNotExistAlert;
+ (instancetype)endPointNotFoundAlert;
+ (instancetype)startPointNotFoundAlert;
+ (instancetype)intermediatePointNotFoundAlert;
+ (instancetype)internalRoutingErrorAlert;
+ (instancetype)incorrectFeaturePositionAlert;
+ (instancetype)notEnoughSpaceAlert;
+ (instancetype)invalidUserNameOrPasswordAlert;
+ (instancetype)noCurrentPositionAlert;
+ (instancetype)pointsInDifferentMWMAlert;
+ (instancetype)disabledLocationAlert;
+ (instancetype)noWiFiAlertWithOkBlock:(MWMVoidBlock)okBlock andCancelBlock:(MWMVoidBlock)cancelBlock;
+ (instancetype)noConnectionAlert;
+ (instancetype)deleteMapProhibitedAlert;
+ (instancetype)unsavedEditsAlertWithOkBlock:(MWMVoidBlock)okBlock;
+ (instancetype)locationServiceNotSupportedAlert;
+ (instancetype)point2PointAlertWithOkBlock:(MWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild;
+ (instancetype)downloaderNoConnectionAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock;
+ (instancetype)downloaderNotEnoughSpaceAlert;
+ (instancetype)downloaderInternalErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock;
+ (instancetype)resetChangesAlertWithBlock:(MWMVoidBlock)block;
+ (instancetype)deleteFeatureAlertWithBlock:(MWMVoidBlock)block;
+ (instancetype)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block;
+ (instancetype)trackWarningAlertWithCancelBlock:(MWMVoidBlock)block;
+ (instancetype)infoAlert:(NSString *)title text:(NSString *)text;
+ (instancetype)convertBookmarksWithCount:(NSUInteger)count okBlock:(MWMVoidBlock)okBlock;
+ (instancetype)bookmarkConversionErrorAlert;
+ (instancetype)tagsLoadingErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock;
+ (instancetype)bugReportAlertWithTitle:(NSString *)title;
+ (instancetype)defaultAlertWithTitle:(NSString *)title
message:(NSString *)message
rightButtonTitle:(NSString *)rightButtonTitle
leftButtonTitle:(NSString *)leftButtonTitle
rightButtonAction:(MWMVoidBlock)action
log:(NSString *)log;
@end

View file

@ -0,0 +1,404 @@
#import "MWMDefaultAlert.h"
#import "SwiftBridge.h"
#include <CoreApi/Framework.h>
static CGFloat const kDividerTopConstant = -8.;
@interface MWMDefaultAlert ()
@property(weak, nonatomic) IBOutlet UILabel *messageLabel;
@property(weak, nonatomic) IBOutlet UIButton *rightButton;
@property(weak, nonatomic) IBOutlet UIButton *leftButton;
@property(weak, nonatomic) IBOutlet UILabel *titleLabel;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *rightButtonWidth;
@property(copy, nonatomic) MWMVoidBlock leftButtonAction;
@property(copy, nonatomic, readwrite) MWMVoidBlock rightButtonAction;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *dividerTop;
@property(weak, nonatomic) IBOutlet UIView *vDivider;
@end
static NSString *const kDefaultAlertNibName = @"MWMDefaultAlert";
@implementation MWMDefaultAlert
+ (instancetype)routeFileNotExistAlert {
return [self defaultAlertWithTitle:L(@"dialog_routing_download_files")
message:L(@"dialog_routing_download_and_update_all")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Route File Not Exist Alert"];
}
+ (instancetype)routeNotFoundAlert {
return [self defaultAlertWithTitle:L(@"dialog_routing_unable_locate_route")
message:L(@"dialog_routing_change_start_or_end")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Route File Not Exist Alert"];
}
+ (instancetype)routeNotFoundNoPublicTransportAlert {
return [self defaultAlertWithTitle:L(@"transit_not_found")
message:nil
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"transit_not_found"];
}
+ (instancetype)routeNotFoundTooLongPedestrianAlert {
return [self defaultAlertWithTitle:L(@"dialog_pedestrian_route_is_long_header")
message:L(@"dialog_pedestrian_route_is_long_message")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Long Pedestrian Route Alert"];
}
+ (instancetype)locationServiceNotSupportedAlert {
return [self defaultAlertWithTitle:L(@"current_location_unknown_error_title")
message:L(@"current_location_unknown_error_message")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Location Service Not Supported Alert"];
}
+ (instancetype)noConnectionAlert {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"common_check_internet_connection_dialog")
message:nil
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"No Connection Alert"];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)deleteMapProhibitedAlert {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"downloader_delete_map")
message:L(@"downloader_delete_map_while_routing_dialog")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Delete Map Prohibited Alert"];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)unsavedEditsAlertWithOkBlock:(MWMVoidBlock)okBlock {
return [self defaultAlertWithTitle:L(@"please_note")
message:L(@"downloader_delete_map_dialog")
rightButtonTitle:L(@"delete")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:@"Editor unsaved changes on delete"];
}
+ (instancetype)noWiFiAlertWithOkBlock:(MWMVoidBlock)okBlock andCancelBlock:(MWMVoidBlock)cancelBlock {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"download_over_mobile_header")
message:L(@"download_over_mobile_message")
rightButtonTitle:L(@"use_cellular_data")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:@"No WiFi Alert"];
alert.leftButtonAction = cancelBlock;
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)endPointNotFoundAlert {
NSString *message = [NSString
stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_end_not_determined"), L(@"dialog_routing_select_closer_end")];
return [self defaultAlertWithTitle:L(@"dialog_routing_change_end")
message:message
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"End Point Not Found Alert"];
}
+ (instancetype)startPointNotFoundAlert {
NSString *message = [NSString
stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_start_not_determined"), L(@"dialog_routing_select_closer_start")];
return [self defaultAlertWithTitle:L(@"dialog_routing_change_start")
message:message
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Start Point Not Found Alert"];
}
+ (instancetype)intermediatePointNotFoundAlert {
return [self defaultAlertWithTitle:L(@"dialog_routing_change_intermediate")
message:L(@"dialog_routing_intermediate_not_determined")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Intermediate Point Not Found Alert"];
}
+ (instancetype)internalRoutingErrorAlert {
NSString *message =
[NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_application_error"), L(@"dialog_routing_try_again")];
return [self defaultAlertWithTitle:L(@"dialog_routing_system_error")
message:message
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Internal Routing Error Alert"];
}
+ (instancetype)incorrectFeaturePositionAlert {
return [self defaultAlertWithTitle:L(@"dialog_incorrect_feature_position")
message:L(@"message_invalid_feature_position")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Incorrect Feature Possition Alert"];
}
+ (instancetype)notEnoughSpaceAlert {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"downloader_no_space_title")
message:L(@"migration_no_space_message")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Not Enough Space Alert"];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)invalidUserNameOrPasswordAlert {
return [self defaultAlertWithTitle:L(@"invalid_username_or_password")
message:nil
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Invalid User Name or Password Alert"];
}
+ (instancetype)noCurrentPositionAlert {
NSString *message = [NSString stringWithFormat:@"%@\n\n%@", L(@"dialog_routing_error_location_not_found"),
L(@"dialog_routing_location_turn_wifi")];
return [self defaultAlertWithTitle:L(@"dialog_routing_check_gps")
message:message
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"No Current Position Alert"];
}
+ (instancetype)disabledLocationAlert {
MWMVoidBlock action = ^{
GetFramework().SwitchMyPositionNextMode();
};
return [self defaultAlertWithTitle:L(@"dialog_routing_location_turn_on")
message:L(@"dialog_routing_location_unknown_turn_on")
rightButtonTitle:L(@"turn_on")
leftButtonTitle:L(@"later")
rightButtonAction:action
log:@"Disabled Location Alert"];
}
+ (instancetype)pointsInDifferentMWMAlert {
return [self defaultAlertWithTitle:L(@"routing_failed_cross_mwm_building")
message:nil
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Points In Different MWM Alert"];
}
+ (instancetype)point2PointAlertWithOkBlock:(MWMVoidBlock)okBlock needToRebuild:(BOOL)needToRebuild {
if (needToRebuild) {
return [self defaultAlertWithTitle:L(@"p2p_only_from_current")
message:L(@"p2p_reroute_from_current")
rightButtonTitle:L(@"ok")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:@"Default Alert"];
} else {
return [self defaultAlertWithTitle:L(@"p2p_only_from_current")
message:nil
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Default Alert"];
}
}
+ (instancetype)downloaderNoConnectionAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"downloader_status_failed")
message:L(@"common_check_internet_connection_dialog")
rightButtonTitle:L(@"downloader_retry")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:@"Downloader No Connection Alert"];
alert.leftButtonAction = cancelBlock;
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)downloaderNotEnoughSpaceAlert {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"downloader_no_space_title")
message:L(@"downloader_no_space_message")
rightButtonTitle:L(@"close")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Downloader Not Enough Space Alert"];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)downloaderInternalErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"migration_download_error_dialog")
message:nil
rightButtonTitle:L(@"downloader_retry")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:@"Downloader Internal Error Alert"];
alert.leftButtonAction = cancelBlock;
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)resetChangesAlertWithBlock:(MWMVoidBlock)block {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"editor_reset_edits_message")
message:nil
rightButtonTitle:L(@"editor_reset_edits_button")
leftButtonTitle:L(@"cancel")
rightButtonAction:block
log:@"Reset changes alert"];
return alert;
}
+ (instancetype)deleteFeatureAlertWithBlock:(MWMVoidBlock)block {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"editor_remove_place_message")
message:nil
rightButtonTitle:L(@"editor_remove_place_button")
leftButtonTitle:L(@"cancel")
rightButtonAction:block
log:@"Delete feature alert"];
return alert;
}
+ (instancetype)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block {
NSString *message = [NSString
stringWithFormat:@"%@\n%@", L(@"editor_share_to_all_dialog_message_1"), L(@"editor_share_to_all_dialog_message_2")];
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"editor_share_to_all_dialog_title")
message:message
rightButtonTitle:L(@"editor_report_problem_send_button")
leftButtonTitle:L(@"cancel")
rightButtonAction:block
log:@"Personal info warning alert"];
return alert;
}
+ (instancetype)trackWarningAlertWithCancelBlock:(MWMVoidBlock)block {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"recent_track_background_dialog_title")
message:L(@"recent_track_background_dialog_message")
rightButtonTitle:L(@"off_recent_track_background_button")
leftButtonTitle:L(@"continue_button")
rightButtonAction:block
log:@"Track warning alert"];
return alert;
}
+ (instancetype)infoAlert:(NSString *)title text:(NSString *)text {
return [self defaultAlertWithTitle:title
message:text
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:@"Info Alert"];
}
+ (instancetype)convertBookmarksWithCount:(NSUInteger)count okBlock:(MWMVoidBlock)okBlock {
return [self defaultAlertWithTitle:L(@"bookmarks_detect_title")
message:[NSString stringWithFormat:L(@"bookmarks_detect_message"), count]
rightButtonTitle:L(@"button_convert")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:nil];
}
+ (instancetype)bookmarkConversionErrorAlert {
return [self defaultAlertWithTitle:L(@"bookmarks_convert_error_title")
message:L(@"bookmarks_convert_error_message")
rightButtonTitle:L(@"ok")
leftButtonTitle:nil
rightButtonAction:nil
log:nil];
}
+ (instancetype)tagsLoadingErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:L(@"title_error_downloading_bookmarks")
message:L(@"tags_loading_error_subtitle")
rightButtonTitle:L(@"downloader_retry")
leftButtonTitle:L(@"cancel")
rightButtonAction:okBlock
log:nil];
alert.leftButtonAction = cancelBlock;
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)bugReportAlertWithTitle:(NSString *)title {
MWMDefaultAlert *alert = [self defaultAlertWithTitle:title
message:L(@"bugreport_alert_message")
rightButtonTitle:L(@"report_a_bug")
leftButtonTitle:L(@"cancel")
rightButtonAction:^{ [MailComposer sendBugReportWithTitle:title]; }
log:nil];
[alert setNeedsCloseAlertAfterEnterBackground];
return alert;
}
+ (instancetype)defaultAlertWithTitle:(NSString *)title
message:(NSString *)message
rightButtonTitle:(NSString *)rightButtonTitle
leftButtonTitle:(NSString *)leftButtonTitle
rightButtonAction:(MWMVoidBlock)action
log:(NSString *)log {
if (log) {
LOG(LINFO, ([log UTF8String]));
}
MWMDefaultAlert *alert = [NSBundle.mainBundle loadNibNamed:kDefaultAlertNibName owner:self options:nil].firstObject;
alert.titleLabel.text = title;
alert.messageLabel.text = message;
if (!message) {
alert.dividerTop.constant = kDividerTopConstant;
[alert layoutIfNeeded];
}
[alert.rightButton setTitle:rightButtonTitle forState:UIControlStateNormal];
[alert.rightButton setTitle:rightButtonTitle forState:UIControlStateDisabled];
alert.rightButtonAction = action;
if (leftButtonTitle) {
[alert.leftButton setTitle:leftButtonTitle forState:UIControlStateNormal];
[alert.leftButton setTitle:leftButtonTitle forState:UIControlStateDisabled];
} else {
alert.vDivider.hidden = YES;
alert.leftButton.hidden = YES;
alert.rightButtonWidth.constant = [alert.subviews.firstObject width];
}
return alert;
}
#pragma mark - Actions
- (IBAction)rightButtonTap {
[self close:self.rightButtonAction];
}
- (IBAction)leftButtonTap {
[self close:self.leftButtonAction];
}
@end

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMDefaultAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zso-DD-6SG" userLabel="ContainerView">
<rect key="frame" x="47.5" y="264.5" width="280" height="138.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Grl-z5-2cE" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="21.5"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="0SG-Lk-wkv"/>
<constraint firstAttribute="width" constant="240" id="9rm-Av-9eY"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0D6-oV-Lio" userLabel="Message">
<rect key="frame" x="20" y="53.5" width="240" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="dG8-qs-ZWQ"/>
<constraint firstAttribute="width" constant="240" id="wbf-hD-V6a"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="f8D-qe-39W" userLabel="hDivider">
<rect key="frame" x="0.0" y="93.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="HTM-C2-dMq"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jAg-cp-4Ms" userLabel="left">
<rect key="frame" x="0.0" y="94.5" width="140" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="cancelButton"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="4bW-b0-naB"/>
<constraint firstAttribute="height" constant="44" id="RRQ-jI-El3"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="ok"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="leftButtonTap" destination="iN0-l3-epB" eventType="touchUpInside" id="xE7-aE-OzM"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5H4-oD-Dex" userLabel="vDivider">
<rect key="frame" x="139" y="94" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="8r3-72-asP"/>
<constraint firstAttribute="width" constant="1" id="ORs-aP-K10"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RSB-i6-pEP" userLabel="right">
<rect key="frame" x="140" y="94.5" width="140" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="OKButton"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="C3i-gd-pxv"/>
<constraint firstAttribute="height" constant="44" id="dta-cI-rDi"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="ok"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="rightButtonTap" destination="iN0-l3-epB" eventType="touchUpInside" id="UO8-7c-q1i"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Grl-z5-2cE" firstAttribute="top" secondItem="zso-DD-6SG" secondAttribute="top" constant="20" id="5iy-IL-Non"/>
<constraint firstAttribute="bottom" secondItem="RSB-i6-pEP" secondAttribute="bottom" id="7PX-qC-iuH"/>
<constraint firstItem="jAg-cp-4Ms" firstAttribute="top" secondItem="f8D-qe-39W" secondAttribute="bottom" id="BZX-XF-Cwq"/>
<constraint firstItem="RSB-i6-pEP" firstAttribute="top" secondItem="f8D-qe-39W" secondAttribute="bottom" id="FV6-rs-AaS"/>
<constraint firstAttribute="width" constant="280" id="H9k-u4-6Xx"/>
<constraint firstAttribute="centerX" secondItem="0D6-oV-Lio" secondAttribute="centerX" id="HOk-vG-jd5"/>
<constraint firstItem="0D6-oV-Lio" firstAttribute="top" secondItem="Grl-z5-2cE" secondAttribute="bottom" constant="12" id="QBn-bf-ANB"/>
<constraint firstAttribute="bottom" secondItem="jAg-cp-4Ms" secondAttribute="bottom" id="QhB-d8-4KJ"/>
<constraint firstItem="RSB-i6-pEP" firstAttribute="leading" secondItem="5H4-oD-Dex" secondAttribute="trailing" id="SbQ-E0-P7N"/>
<constraint firstAttribute="centerX" secondItem="f8D-qe-39W" secondAttribute="centerX" id="TuK-ia-Gl9"/>
<constraint firstItem="f8D-qe-39W" firstAttribute="top" secondItem="0D6-oV-Lio" secondAttribute="bottom" constant="20" id="XWN-lh-LsI"/>
<constraint firstAttribute="bottom" secondItem="5H4-oD-Dex" secondAttribute="bottom" constant="0.5" id="el1-Te-FrO"/>
<constraint firstAttribute="width" secondItem="f8D-qe-39W" secondAttribute="width" id="rtN-ma-JgY"/>
<constraint firstItem="jAg-cp-4Ms" firstAttribute="leading" secondItem="zso-DD-6SG" secondAttribute="leading" id="x4L-bc-J3N"/>
<constraint firstAttribute="trailing" secondItem="RSB-i6-pEP" secondAttribute="trailing" id="zAm-vx-0g5"/>
<constraint firstAttribute="centerX" secondItem="Grl-z5-2cE" secondAttribute="centerX" id="zap-Oc-W3i"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="zso-DD-6SG" secondAttribute="centerY" id="2Yk-mx-NtS"/>
<constraint firstAttribute="centerX" secondItem="zso-DD-6SG" secondAttribute="centerX" id="rvU-lH-fCc"/>
</constraints>
<viewLayoutGuide key="safeArea" id="4wG-7A-b6h"/>
<connections>
<outlet property="dividerTop" destination="XWN-lh-LsI" id="Ken-WZ-bMm"/>
<outlet property="leftButton" destination="jAg-cp-4Ms" id="UpD-3H-PmN"/>
<outlet property="messageLabel" destination="0D6-oV-Lio" id="1pY-jt-AFL"/>
<outlet property="rightButton" destination="RSB-i6-pEP" id="DC9-9z-U2K"/>
<outlet property="rightButtonWidth" destination="C3i-gd-pxv" id="YMb-U5-4iJ"/>
<outlet property="titleLabel" destination="Grl-z5-2cE" id="p6A-DJ-xjR"/>
<outlet property="vDivider" destination="5H4-oD-Dex" id="7xY-ln-bYK"/>
</connections>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,14 @@
#import "MWMDefaultAlert.h"
@interface MWMDefaultAlert (Protected)
+ (nonnull instancetype)defaultAlertWithTitle:(nonnull NSString *)title
message:(nullable NSString *)message
rightButtonTitle:(nonnull NSString *)rightButtonTitle
leftButtonTitle:(nullable NSString *)leftButtonTitle
rightButtonAction:(nullable MWMVoidBlock)action
log:(nullable NSString *)log;
@property(copy, nonatomic, readonly, nullable) MWMVoidBlock rightButtonAction;
@end

View file

@ -0,0 +1,16 @@
#import "MWMAlert+CPP.h"
#include "routing/routing_callbacks.hpp"
#include "storage/storage_defines.hpp"
@interface MWMDownloadTransitMapAlert : MWMAlert
+ (instancetype)downloaderAlertWithMaps:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(MWMVoidBlock)cancelBlock
downloadBlock:(MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(MWMVoidBlock)downloadCompleteBlock;
- (void)showDownloadDetail:(UIButton *)sender;
@end

View file

@ -0,0 +1,352 @@
#import "MWMDownloadTransitMapAlert.h"
#import "MWMCircularProgress.h"
#import "MWMDownloaderDialogCell.h"
#import "MWMDownloaderDialogHeader.h"
#import "MWMStorage+UI.h"
#import "SwiftBridge.h"
#include <CoreApi/Framework.h>
#include "platform/downloader_defines.hpp"
namespace
{
NSString * const kDownloadTransitMapAlertNibName = @"MWMDownloadTransitMapAlert";
CGFloat const kCellHeight = 32.;
CGFloat const kHeaderHeight = 44.;
CGFloat const kMinimumOffset = 20.;
CGFloat const kAnimationDuration = .05;
} // namespace
@interface MWMDownloadTransitMapAlert () <UITableViewDataSource, UITableViewDelegate, MWMStorageObserver, MWMCircularProgressProtocol>
@property(copy, nonatomic) MWMVoidBlock cancelBlock;
@property(copy, nonatomic) MWMDownloadBlock downloadBlock;
@property(copy, nonatomic) MWMVoidBlock downloadCompleteBlock;
@property (nonatomic) MWMCircularProgress * progress;
@property (weak, nonatomic) IBOutlet UIView * containerView;
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
@property (weak, nonatomic) IBOutlet UILabel * messageLabel;
@property (weak, nonatomic) IBOutlet UITableView * dialogsTableView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * tableViewHeight;
@property (nonatomic) MWMDownloaderDialogHeader * listHeader;
@property (nonatomic) BOOL listExpanded;
@property (weak, nonatomic) IBOutlet UIView * progressWrapper;
@property (weak, nonatomic) IBOutlet UIView * hDivider;
@property (weak, nonatomic) IBOutlet UIView * vDivider;
@property (weak, nonatomic) IBOutlet UIButton * leftButton;
@property (weak, nonatomic) IBOutlet UIButton * rightButton;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * dialogsBottomOffset;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * progressWrapperBottomOffset;
@property (copy, nonatomic) NSArray<NSString *> * countriesNames;
@property (copy, nonatomic) NSString * countriesSize;
@end
@implementation MWMDownloadTransitMapAlert
{
storage::CountriesVec m_countries;
}
+ (instancetype)downloaderAlertWithMaps:(storage::CountriesSet const &)countries
code:(routing::RouterResultCode)code
cancelBlock:(MWMVoidBlock)cancelBlock
downloadBlock:(MWMDownloadBlock)downloadBlock
downloadCompleteBlock:(MWMVoidBlock)downloadCompleteBlock
{
MWMDownloadTransitMapAlert * alert = [self alertWithCountries:countries];
switch (code)
{
case routing::RouterResultCode::InconsistentMWMandRoute:
case routing::RouterResultCode::RouteNotFound:
case routing::RouterResultCode::RouteFileNotExist:
alert.titleLabel.text = L(@"dialog_routing_download_files");
alert.messageLabel.text = L(@"dialog_routing_download_and_update_all");
break;
case routing::RouterResultCode::FileTooOld:
alert.titleLabel.text = L(@"dialog_routing_download_files");
alert.messageLabel.text = L(@"dialog_routing_download_and_update_maps");
break;
case routing::RouterResultCode::NeedMoreMaps:
alert.titleLabel.text = L(@"dialog_routing_download_and_build_cross_route");
alert.messageLabel.text = L(@"dialog_routing_download_cross_route");
break;
default:
NSAssert(false, @"Incorrect code!");
break;
}
alert.cancelBlock = cancelBlock;
alert.downloadBlock = downloadBlock;
alert.downloadCompleteBlock = downloadCompleteBlock;
return alert;
}
+ (instancetype)alertWithCountries:(storage::CountriesSet const &)countries
{
NSAssert(!countries.empty(), @"countries can not be empty.");
MWMDownloadTransitMapAlert * alert =
[NSBundle.mainBundle loadNibNamed:kDownloadTransitMapAlertNibName owner:nil options:nil]
.firstObject;
alert->m_countries = storage::CountriesVec(countries.begin(), countries.end());
[alert configure];
[alert updateCountriesList];
[[MWMStorage sharedStorage] addObserver:alert];
return alert;
}
- (void)configure
{
[self.dialogsTableView registerNibWithCellClass:[MWMDownloaderDialogCell class]];
self.listExpanded = NO;
CALayer * containerViewLayer = self.containerView.layer;
containerViewLayer.shouldRasterize = YES;
containerViewLayer.rasterizationScale = [[UIScreen mainScreen] scale];
[self.dialogsTableView reloadData];
}
- (void)updateCountriesList
{
auto const & s = GetFramework().GetStorage();
m_countries.erase(
remove_if(m_countries.begin(), m_countries.end(),
[&s](storage::CountryId const & countryId) { return s.HasLatestVersion(countryId); }),
m_countries.end());
NSMutableArray<NSString *> * titles = [@[] mutableCopy];
MwmSize totalSize = 0;
for (auto const & countryId : m_countries)
{
storage::NodeAttrs attrs;
s.GetNodeAttrs(countryId, attrs);
[titles addObject:@(attrs.m_nodeLocalName.c_str())];
totalSize += attrs.m_mwmSize;
}
self.countriesNames = titles;
self.countriesSize = formattedSize(totalSize);
}
#pragma mark - MWMCircularProgressProtocol
- (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress
{
for (auto const & countryId : m_countries)
[[MWMStorage sharedStorage] cancelDownloadNode:@(countryId.c_str())];
[self cancelButtonTap];
}
#pragma mark - MWMStorageObserver
- (void)processCountryEvent:(NSString *)countryId
{
if (find(m_countries.begin(), m_countries.end(), countryId.UTF8String) == m_countries.end())
return;
if (self.rightButton.hidden)
{
auto const & s = GetFramework().GetStorage();
auto const & p = GetFramework().GetDownloadingPolicy();
if (s.CheckFailedCountries(m_countries))
{
if (p.IsAutoRetryDownloadFailed())
[self close:nil];
return;
}
auto const overallProgress = s.GetOverallProgress(m_countries);
// Test if downloading has finished by comparing downloaded and total sizes.
if (overallProgress.m_bytesDownloaded == overallProgress.m_bytesTotal)
[self close:self.downloadCompleteBlock];
}
else
{
[self updateCountriesList];
[self.dialogsTableView reloadSections:[NSIndexSet indexSetWithIndex:0]
withRowAnimation:UITableViewRowAnimationAutomatic];
if (m_countries.empty())
[self close:self.downloadCompleteBlock];
}
}
- (void)processCountry:(NSString *)countryId
downloadedBytes:(uint64_t)downloadedBytes
totalBytes:(uint64_t)totalBytes
{
if (!self.rightButton.hidden ||
find(m_countries.begin(), m_countries.end(), countryId.UTF8String) == m_countries.end())
return;
auto const overallProgress = GetFramework().GetStorage().GetOverallProgress(m_countries);
CGFloat const progressValue =
static_cast<CGFloat>(overallProgress.m_bytesDownloaded) / overallProgress.m_bytesTotal;
self.progress.progress = progressValue;
self.titleLabel.text = [NSString stringWithFormat:@"%@%@%%", L(@"downloading"), @(floor(progressValue * 100))];
}
#pragma mark - Actions
- (IBAction)cancelButtonTap
{
[self close:self.cancelBlock];
}
- (IBAction)downloadButtonTap
{
[self updateCountriesList];
if (m_countries.empty())
{
[self close:self.downloadCompleteBlock];
return;
}
self.downloadBlock(m_countries, ^{
self.titleLabel.text = L(@"downloading");
self.messageLabel.hidden = YES;
self.progressWrapper.hidden = NO;
self.progress.state = MWMCircularProgressStateSpinner;
self.hDivider.hidden = YES;
self.vDivider.hidden = YES;
self.leftButton.hidden = YES;
self.rightButton.hidden = YES;
self.dialogsBottomOffset.priority = UILayoutPriorityDefaultHigh;
self.progressWrapperBottomOffset.priority = UILayoutPriorityDefaultHigh;
[UIView animateWithDuration:kAnimationDuration
animations:^{
[self layoutSubviews];
}];
});
}
- (void)showDownloadDetail:(UIButton *)sender
{
self.listExpanded = sender.selected;
}
- (void)setListExpanded:(BOOL)listExpanded
{
_listExpanded = listExpanded;
[self layoutIfNeeded];
auto const updateCells = ^(BOOL show)
{
for (MWMDownloaderDialogCell * cell in self.dialogsTableView.visibleCells)
{
cell.titleLabel.alpha = show ? 1. : 0.;
}
[self.dialogsTableView refresh];
};
if (listExpanded)
{
CGFloat const actualHeight = kCellHeight * m_countries.size() + kHeaderHeight;
CGFloat const height = [self bounded:actualHeight withHeight:self.superview.height];
self.tableViewHeight.constant = height;
self.dialogsTableView.scrollEnabled = actualHeight > self.tableViewHeight.constant;
[UIView animateWithDuration:kAnimationDuration animations:^{ [self layoutSubviews]; }
completion:^(BOOL finished)
{
[UIView animateWithDuration:kDefaultAnimationDuration animations:^{ updateCells(YES); }];
}];
}
else
{
self.tableViewHeight.constant = kHeaderHeight;
self.dialogsTableView.scrollEnabled = NO;
updateCells(NO);
[UIView animateWithDuration:kAnimationDuration animations:^{ [self layoutSubviews]; }];
}
}
- (CGFloat)bounded:(CGFloat)f withHeight:(CGFloat)h
{
CGFloat const currentHeight = [self.subviews.firstObject height];
CGFloat const maximumHeight = h - 2. * kMinimumOffset;
CGFloat const availableHeight = maximumHeight - currentHeight;
return MIN(f, availableHeight + self.tableViewHeight.constant);
}
- (void)invalidateTableConstraintWithHeight:(CGFloat)height
{
if (self.listExpanded)
{
CGFloat const actualHeight = kCellHeight * m_countries.size() + kHeaderHeight;
self.tableViewHeight.constant = [self bounded:actualHeight withHeight:height];
self.dialogsTableView.scrollEnabled = actualHeight > self.tableViewHeight.constant;
}
else
{
self.tableViewHeight.constant = kHeaderHeight;
}
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
CGFloat const height = UIInterfaceOrientationIsLandscape(orientation) ? MIN(self.superview.width, self.superview.height) : MAX(self.superview.width, self.superview.height);
[self invalidateTableConstraintWithHeight:height];
}
- (void)close:(MWMVoidBlock)completion
{
[[MWMStorage sharedStorage] removeObserver:self];
[super close:completion];
}
#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return m_countries.size();
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return kHeaderHeight;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return kCellHeight;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
return self.listHeader;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView * view = [[UIView alloc] init];
view.styleName = @"BlackOpaqueBackground";
return view;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Class cls = [MWMDownloaderDialogCell class];
auto cell = static_cast<MWMDownloaderDialogCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
cell.titleLabel.text = self.countriesNames[indexPath.row];
return cell;
}
#pragma mark - Properties
- (MWMDownloaderDialogHeader *)listHeader
{
if (!_listHeader)
_listHeader = [MWMDownloaderDialogHeader headerForOwnerAlert:self];
[_listHeader setTitle:[NSString stringWithFormat:@"%@ (%@)", L(@"downloader_status_maps"), @(m_countries.size())]
size:self.countriesSize];
return _listHeader;
}
- (MWMCircularProgress *)progress
{
if (!_progress)
{
_progress = [MWMCircularProgress downloaderProgressForParentView:self.progressWrapper];
_progress.delegate = self;
}
return _progress;
}
@end

View file

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="jqI-GQ-yDh" customClass="MWMDownloadTransitMapAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hay-Qx-kVw" userLabel="ContainerView">
<rect key="frame" x="47.5" y="218.5" width="280" height="230"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MvX-7q-CIH" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="29"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="29" id="018-Nz-384"/>
<constraint firstAttribute="width" constant="240" id="cHd-lJ-pXe"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<size key="shadowOffset" width="0.0" height="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_download_maps_along"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bco-zh-ekL">
<rect key="frame" x="122" y="65" width="36" height="36"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="36" id="0Pg-8w-QZa"/>
<constraint firstAttribute="width" constant="36" id="cjU-dH-SAG"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q3X-9G-3PT">
<rect key="frame" x="23" y="61" width="234" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="234" id="YLG-PG-WHS"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="17" id="iOI-5t-pEY"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_requires_all_map"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="1000" alwaysBounceVertical="YES" scrollEnabled="NO" style="grouped" separatorStyle="none" rowHeight="32" sectionHeaderHeight="44" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="1lL-cj-2oS">
<rect key="frame" x="0.0" y="98" width="280" height="88"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="88" id="92H-Th-Xgt"/>
</constraints>
<color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexBackgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexTrackingBackgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="jqI-GQ-yDh" id="8mP-kY-rEz"/>
<outlet property="delegate" destination="jqI-GQ-yDh" id="9Fy-MW-IYa"/>
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2nQ-k3-Rx3" userLabel="hDivider">
<rect key="frame" x="0.0" y="186" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="YGc-0s-8yD"/>
<constraint firstAttribute="height" constant="1" id="l1s-jg-dng"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q87-qQ-0rn">
<rect key="frame" x="140" y="186" width="140" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="downloadNowButton"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="1Io-1t-Odn"/>
<constraint firstAttribute="height" constant="44" id="CeP-fJ-qZs"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="download"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="downloadButtonTap" destination="jqI-GQ-yDh" eventType="touchUpInside" id="wBd-0C-U51"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dhS-fg-rNl">
<rect key="frame" x="0.0" y="186" width="140" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="notNowButton"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="7gw-Uu-UEK"/>
<constraint firstAttribute="width" constant="140" id="EMA-LM-Zje"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="later"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="cancelButtonTap" destination="jqI-GQ-yDh" eventType="touchUpInside" id="xii-qA-4BV"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jjh-VP-emP" userLabel="vDivider">
<rect key="frame" x="139" y="186" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="8kQ-Yd-0D3"/>
<constraint firstAttribute="height" constant="44" id="vYd-td-NOl"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="dhS-fg-rNl" firstAttribute="top" secondItem="1lL-cj-2oS" secondAttribute="bottom" priority="500" id="2aT-au-ilL"/>
<constraint firstAttribute="bottom" secondItem="dhS-fg-rNl" secondAttribute="bottom" id="2bS-ac-iDr"/>
<constraint firstItem="bco-zh-ekL" firstAttribute="centerX" secondItem="Hay-Qx-kVw" secondAttribute="centerX" id="3xy-PQ-9lP"/>
<constraint firstAttribute="bottom" secondItem="q87-qQ-0rn" secondAttribute="bottom" id="3yg-r8-Lm3"/>
<constraint firstAttribute="bottom" secondItem="1lL-cj-2oS" secondAttribute="bottom" priority="250" id="58e-JY-U6g"/>
<constraint firstAttribute="centerX" secondItem="2nQ-k3-Rx3" secondAttribute="centerX" id="5S3-Lh-pMR"/>
<constraint firstAttribute="trailing" secondItem="q87-qQ-0rn" secondAttribute="trailing" id="Bud-qr-UTy"/>
<constraint firstItem="bco-zh-ekL" firstAttribute="top" secondItem="MvX-7q-CIH" secondAttribute="bottom" constant="16" id="D9b-za-yb8"/>
<constraint firstItem="q87-qQ-0rn" firstAttribute="top" secondItem="1lL-cj-2oS" secondAttribute="bottom" priority="500" id="Lpk-cS-FHG"/>
<constraint firstItem="Q3X-9G-3PT" firstAttribute="top" secondItem="MvX-7q-CIH" secondAttribute="bottom" constant="12" id="PN3-Vl-yKe"/>
<constraint firstAttribute="width" constant="280" id="PoR-0E-Yd5"/>
<constraint firstItem="1lL-cj-2oS" firstAttribute="top" secondItem="bco-zh-ekL" secondAttribute="bottom" priority="250" constant="20" id="QQh-zT-bWE"/>
<constraint firstAttribute="centerX" secondItem="1lL-cj-2oS" secondAttribute="centerX" id="Td0-Pa-b2s"/>
<constraint firstAttribute="centerX" secondItem="MvX-7q-CIH" secondAttribute="centerX" id="Uwa-a8-9bd"/>
<constraint firstAttribute="bottom" secondItem="Jjh-VP-emP" secondAttribute="bottom" id="YL8-fj-ENd"/>
<constraint firstAttribute="bottom" secondItem="2nQ-k3-Rx3" secondAttribute="bottom" constant="43" id="YPn-NL-TPQ"/>
<constraint firstItem="q87-qQ-0rn" firstAttribute="leading" secondItem="Jjh-VP-emP" secondAttribute="trailing" id="hwW-Pw-fPz"/>
<constraint firstItem="dhS-fg-rNl" firstAttribute="leading" secondItem="Hay-Qx-kVw" secondAttribute="leading" id="hzI-MA-Jal"/>
<constraint firstItem="1lL-cj-2oS" firstAttribute="width" secondItem="Hay-Qx-kVw" secondAttribute="width" id="i3L-zR-0ay"/>
<constraint firstAttribute="centerX" secondItem="Q3X-9G-3PT" secondAttribute="centerX" id="l5p-jN-Vvq"/>
<constraint firstItem="MvX-7q-CIH" firstAttribute="top" secondItem="Hay-Qx-kVw" secondAttribute="top" constant="20" id="xBi-k5-Mze"/>
<constraint firstItem="1lL-cj-2oS" firstAttribute="top" secondItem="Q3X-9G-3PT" secondAttribute="bottom" priority="500" constant="20" id="xQk-cL-cLn"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="Hay-Qx-kVw" secondAttribute="centerY" id="5Z9-NF-BEW"/>
<constraint firstAttribute="centerX" secondItem="Hay-Qx-kVw" secondAttribute="centerX" id="e0c-Aj-Anh"/>
</constraints>
<viewLayoutGuide key="safeArea" id="ZL2-Bv-eBx"/>
<connections>
<outlet property="containerView" destination="Hay-Qx-kVw" id="YBK-zz-Ejj"/>
<outlet property="dialogsBottomOffset" destination="58e-JY-U6g" id="D2s-m8-XQl"/>
<outlet property="dialogsTableView" destination="1lL-cj-2oS" id="QPh-bX-GfH"/>
<outlet property="hDivider" destination="2nQ-k3-Rx3" id="5BD-2K-Qcc"/>
<outlet property="leftButton" destination="dhS-fg-rNl" id="t6u-5i-zwZ"/>
<outlet property="messageLabel" destination="Q3X-9G-3PT" id="AUA-bn-mAy"/>
<outlet property="progressWrapper" destination="bco-zh-ekL" id="AB4-SS-xCc"/>
<outlet property="progressWrapperBottomOffset" destination="QQh-zT-bWE" id="vBy-LT-WOC"/>
<outlet property="rightButton" destination="q87-qQ-0rn" id="91J-mu-sXT"/>
<outlet property="tableViewHeight" destination="92H-Th-Xgt" id="qnm-KF-Hb7"/>
<outlet property="titleLabel" destination="MvX-7q-CIH" id="hej-5l-48z"/>
<outlet property="vDivider" destination="Jjh-VP-emP" id="bNj-9y-l3s"/>
</connections>
<point key="canvasLocation" x="295" y="401"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,7 @@
#import "MWMTableViewCell.h"
@interface MWMDownloaderDialogCell : MWMTableViewCell
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
@end

View file

@ -0,0 +1,5 @@
#import "MWMDownloaderDialogCell.h"
@implementation MWMDownloaderDialogCell
@end

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MWMDownloaderDialogCell" rowHeight="33" id="LWd-Zy-XGd" customClass="MWMDownloaderDialogCell" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="280" height="33"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LWd-Zy-XGd" id="gf8-bS-tvq">
<rect key="frame" x="0.0" y="0.0" width="280" height="33"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1B4-T1-g4X">
<rect key="frame" x="20" y="8" width="240" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="u5A-6l-INO"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="0.90196078431372551" green="0.90196078431372551" blue="0.90196078431372551" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="1B4-T1-g4X" secondAttribute="centerX" id="2AW-qe-sgg"/>
<constraint firstAttribute="centerY" secondItem="1B4-T1-g4X" secondAttribute="centerY" id="TD9-6y-WM8"/>
<constraint firstAttribute="trailing" secondItem="1B4-T1-g4X" secondAttribute="trailing" constant="20" id="ruG-JF-m2y"/>
<constraint firstItem="1B4-T1-g4X" firstAttribute="leading" secondItem="gf8-bS-tvq" secondAttribute="leading" constant="20" id="sZo-pt-LJL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="PressBackground"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<color key="backgroundColor" red="0.90196078431372551" green="0.90196078431372551" blue="0.90196078431372551" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="hHf-it-4Q9"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="PressBackground"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="titleLabel" destination="1B4-T1-g4X" id="m4n-H9-1Ta"/>
</connections>
<point key="canvasLocation" x="235" y="180"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,14 @@
#import <UIKit/UIKit.h>
@class MWMDownloadTransitMapAlert;
@interface MWMDownloaderDialogHeader : UIView
@property (weak, nonatomic) IBOutlet UIButton * headerButton;
@property (weak, nonatomic) IBOutlet UIImageView * expandImage;
+ (instancetype)headerForOwnerAlert:(MWMDownloadTransitMapAlert *)alert;
- (void)layoutSizeLabel;
- (void)setTitle:(NSString *)title size:(NSString *)size;
@end

View file

@ -0,0 +1,53 @@
#import "MWMDownloaderDialogHeader.h"
#import "MWMDownloadTransitMapAlert.h"
static NSString * const kDownloaderDialogHeaderNibName = @"MWMDownloaderDialogHeader";
@interface MWMDownloaderDialogHeader ()
@property (weak, nonatomic) IBOutlet UILabel * title;
@property (weak, nonatomic) IBOutlet UILabel * size;
@property (weak, nonatomic) IBOutlet UIView * dividerView;
@property (weak, nonatomic) MWMDownloadTransitMapAlert * ownerAlert;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * sizeTrailing;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * titleLeading;
@end
@implementation MWMDownloaderDialogHeader
+ (instancetype)headerForOwnerAlert:(MWMDownloadTransitMapAlert *)alert
{
MWMDownloaderDialogHeader * header =
[NSBundle.mainBundle loadNibNamed:kDownloaderDialogHeaderNibName owner:nil options:nil]
.firstObject;
header.ownerAlert = alert;
return header;
}
- (IBAction)headerButtonTap:(UIButton *)sender
{
BOOL const currentState = sender.selected;
sender.selected = !currentState;
self.dividerView.hidden = currentState;
[UIView animateWithDuration:kDefaultAnimationDuration animations:^
{
self.expandImage.transform = sender.selected ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformIdentity;
}];
[self.ownerAlert showDownloadDetail:sender];
}
- (void)layoutSizeLabel
{
if (self.expandImage.hidden)
self.sizeTrailing.constant = self.titleLeading.constant;
[self layoutIfNeeded];
}
- (void)setTitle:(NSString *)title size:(NSString *)size
{
self.title.text = title;
self.size.text = size;
}
@end

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MWMDownloaderDialogHeader" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="280" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hh9-2l-gu2">
<rect key="frame" x="20" y="14" width="160" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="160" id="4WE-p5-RdF"/>
<constraint firstAttribute="height" constant="16" id="FQE-Zk-gXr"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0977349653840065" green="0.0977320596575737" blue="0.09773370623588562" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_gray_down" translatesAutoresizingMaskIntoConstraints="NO" id="eqn-NQ-zOk">
<rect key="frame" x="248" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="CkX-aX-oaf"/>
<constraint firstAttribute="height" constant="28" id="mLX-ow-5er"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMGray"/>
</userDefinedRuntimeAttributes>
</imageView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tqG-fM-g6J">
<rect key="frame" x="0.0" y="43" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Vc3-uM-vHv"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="size" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m8f-ps-pFV">
<rect key="frame" x="180" y="14" width="64" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="7Hg-8z-e56"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="64" id="hct-Jz-zGl"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0977349653840065" green="0.0977320596575737" blue="0.09773370623588562" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eIt-Yb-1Yl">
<rect key="frame" x="0.0" y="0.0" width="280" height="44"/>
<state key="normal">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<connections>
<action selector="headerButtonTap:" destination="iN0-l3-epB" eventType="touchUpInside" id="SW0-Mx-TVi"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.059999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="eIt-Yb-1Yl" secondAttribute="bottom" id="61x-d3-FtO"/>
<constraint firstAttribute="trailing" secondItem="eqn-NQ-zOk" secondAttribute="trailing" constant="4" id="8Xd-cJ-b0r"/>
<constraint firstAttribute="trailing" secondItem="tqG-fM-g6J" secondAttribute="trailing" id="9Xc-Au-fuY"/>
<constraint firstItem="eqn-NQ-zOk" firstAttribute="centerY" secondItem="m8f-ps-pFV" secondAttribute="centerY" id="DOo-JP-5fj"/>
<constraint firstAttribute="centerY" secondItem="m8f-ps-pFV" secondAttribute="centerY" id="F82-yF-6kJ"/>
<constraint firstAttribute="centerY" secondItem="hh9-2l-gu2" secondAttribute="centerY" id="GYb-1Q-mMG"/>
<constraint firstItem="eIt-Yb-1Yl" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Jdx-uy-XaA"/>
<constraint firstAttribute="trailing" secondItem="eIt-Yb-1Yl" secondAttribute="trailing" id="MSS-uK-Dby"/>
<constraint firstItem="eIt-Yb-1Yl" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Xxs-g9-ygX"/>
<constraint firstItem="hh9-2l-gu2" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" id="ZfI-xz-HEx"/>
<constraint firstAttribute="trailing" secondItem="m8f-ps-pFV" secondAttribute="trailing" constant="36" id="kwN-VG-nEr"/>
<constraint firstItem="tqG-fM-g6J" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="rDI-mo-gnf"/>
<constraint firstItem="tqG-fM-g6J" firstAttribute="top" secondItem="m8f-ps-pFV" secondAttribute="bottom" constant="13" id="v0U-Qb-rW1"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="gAS-Hf-5F8"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="BlackOpaqueBackground"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="dividerView" destination="tqG-fM-g6J" id="eOr-3y-kbn"/>
<outlet property="expandImage" destination="eqn-NQ-zOk" id="fGc-MN-ss7"/>
<outlet property="headerButton" destination="eIt-Yb-1Yl" id="f0E-0A-6UG"/>
<outlet property="size" destination="m8f-ps-pFV" id="5ax-Hb-xEm"/>
<outlet property="sizeTrailing" destination="kwN-VG-nEr" id="K52-ZK-LuH"/>
<outlet property="title" destination="hh9-2l-gu2" id="JNQ-ls-kgI"/>
<outlet property="titleLeading" destination="ZfI-xz-HEx" id="Vzg-Cd-ztu"/>
</connections>
<point key="canvasLocation" x="202" y="259"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
<image name="ic_arrow_gray_down" width="28" height="28"/>
</resources>
</document>

View file

@ -0,0 +1,18 @@
import UIKit
final class LocationServicesDisabledAlert: MWMAlert {
@objc
class func alert() -> LocationServicesDisabledAlert? {
guard let alert = Bundle.main.loadNibNamed("LocationServicesDisabledAlert", owner: nil)?.first as? LocationServicesDisabledAlert else {
assertionFailure("Error: LocationServicesDisabledAlert failed lo load from nib.")
return nil
}
alert.setNeedsCloseAfterEnterBackground()
return alert
}
@IBAction func okButtonDidTap(_ sender: Any) {
close(nil)
}
}

View file

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="WR7-Hs-CVJ" customClass="LocationServicesDisabledAlert" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="539" height="770"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="W9l-ze-azg" userLabel="ContainerView">
<rect key="frame" x="30" y="255" width="479" height="285"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lMb-vR-q3Y" userLabel="Title">
<rect key="frame" x="20" y="15" width="439" height="22"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="22" id="MGn-Ke-8G8"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_header"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fz4-9d-5tq" userLabel="Message">
<rect key="frame" x="20" y="47" width="439" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="jCV-Ko-ByO"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_message"/>
</userDefinedRuntimeAttributes>
</label>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" axis="vertical" distribution="equalSpacing" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="PjR-yG-eRZ">
<rect key="frame" x="20" y="77" width="439" height="127"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="vWN-wX-veH" userLabel="OpenSettings">
<rect key="frame" x="0.0" y="0.0" width="439" height="28"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_settings" translatesAutoresizingMaskIntoConstraints="NO" id="Ya1-ek-kDX" userLabel="settings">
<rect key="frame" x="0.0" y="0.0" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="LKZ-GV-grJ"/>
<constraint firstAttribute="width" constant="28" id="t73-v6-puf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1. Open Settings" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PBp-x6-g2s" userLabel="openSettings">
<rect key="frame" x="38" y="5.6666666666666856" width="401" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_1"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="q6r-CN-tgz" userLabel="SelectPrivacy">
<rect key="frame" x="0.0" y="33" width="439" height="28"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_privacy" translatesAutoresizingMaskIntoConstraints="NO" id="7fg-Gm-P0f" userLabel="settings">
<rect key="frame" x="0.0" y="0.0" width="28" height="28"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" systemColor="systemBlueColor"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="guV-Tr-7TT"/>
<constraint firstAttribute="height" constant="28" id="srW-6x-82R"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2. Select Privacy" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="973-fi-RfE" userLabel="openSettings">
<rect key="frame" x="38" y="5.6666666666666856" width="401" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_on_device_2"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="W0F-rf-Edh" userLabel="SelectLocationServices">
<rect key="frame" x="0.0" y="66" width="439" height="28"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_geoposition" translatesAutoresizingMaskIntoConstraints="NO" id="jzE-sK-mEB" userLabel="geoposition">
<rect key="frame" x="0.0" y="0.0" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="HQ9-9t-v50"/>
<constraint firstAttribute="height" constant="28" id="dY9-Jf-hIB"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3. Select Location Services" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hhw-jx-9Fe" userLabel="geoposition">
<rect key="frame" x="38" y="5.6666666666666856" width="401" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_on_device_3"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="pf7-7u-B0E" userLabel="TurnOnLocationServices">
<rect key="frame" x="0.0" y="99" width="439" height="28"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_swither" translatesAutoresizingMaskIntoConstraints="NO" id="UcF-g2-Faq" userLabel="turnon">
<rect key="frame" x="0.0" y="0.0" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="GKu-yv-3JW"/>
<constraint firstAttribute="height" constant="28" id="lNW-jN-VJf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="4. Turn On Location Services" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q1u-dB-Esr" userLabel="select &quot;Always&quot;">
<rect key="frame" x="38" y="5.6666666666666856" width="401" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_on_device_4"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
</stackView>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Additional message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fc4-12-xx4" userLabel="Additional message">
<rect key="frame" x="20" y="214" width="439" height="17"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_on_device_additional_message"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3eJ-wI-Y11" userLabel="hDivider">
<rect key="frame" x="0.0" y="241" width="479" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="wiR-YE-iVH"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WVU-qc-efT" userLabel="okButton">
<rect key="frame" x="0.0" y="241" width="479" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="0vj-j6-oga"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="ok">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="ok"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="okButtonDidTap:" destination="WR7-Hs-CVJ" eventType="touchUpInside" id="2Th-Md-oau"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="450" id="2jy-XF-Yc6"/>
<constraint firstItem="PjR-yG-eRZ" firstAttribute="bottom" secondItem="fc4-12-xx4" secondAttribute="top" constant="-10" id="Bda-Vu-S3B"/>
<constraint firstItem="3eJ-wI-Y11" firstAttribute="top" secondItem="WVU-qc-efT" secondAttribute="top" id="DWH-KY-Gih"/>
<constraint firstAttribute="width" secondItem="3eJ-wI-Y11" secondAttribute="width" id="Dqh-aw-vv1"/>
<constraint firstAttribute="bottom" secondItem="WVU-qc-efT" secondAttribute="bottom" id="Hbe-e3-xsI"/>
<constraint firstItem="lMb-vR-q3Y" firstAttribute="leading" secondItem="W9l-ze-azg" secondAttribute="leading" constant="20" id="KLk-P2-6HX"/>
<constraint firstItem="fc4-12-xx4" firstAttribute="bottom" secondItem="WVU-qc-efT" secondAttribute="top" constant="-10" id="MTa-xK-xfb"/>
<constraint firstItem="lMb-vR-q3Y" firstAttribute="top" secondItem="W9l-ze-azg" secondAttribute="top" constant="15" id="NWh-CB-SSg"/>
<constraint firstAttribute="trailing" secondItem="fc4-12-xx4" secondAttribute="trailing" constant="20" id="Noy-do-AD5"/>
<constraint firstItem="WVU-qc-efT" firstAttribute="leading" secondItem="W9l-ze-azg" secondAttribute="leading" id="P4b-ex-cIo"/>
<constraint firstItem="fc4-12-xx4" firstAttribute="leading" secondItem="W9l-ze-azg" secondAttribute="leading" constant="20" id="UWg-4r-gTh"/>
<constraint firstItem="PjR-yG-eRZ" firstAttribute="leading" secondItem="W9l-ze-azg" secondAttribute="leading" constant="20" id="Xig-e5-dMF"/>
<constraint firstAttribute="trailing" secondItem="lMb-vR-q3Y" secondAttribute="trailing" constant="20" id="ZjY-OS-5Ar"/>
<constraint firstItem="fz4-9d-5tq" firstAttribute="top" secondItem="lMb-vR-q3Y" secondAttribute="bottom" constant="10" id="alo-B9-UKo"/>
<constraint firstItem="PjR-yG-eRZ" firstAttribute="top" secondItem="fz4-9d-5tq" secondAttribute="bottom" constant="10" id="ceU-Nn-UvW"/>
<constraint firstAttribute="trailing" secondItem="PjR-yG-eRZ" secondAttribute="trailing" constant="20" id="rb5-li-7z9"/>
<constraint firstAttribute="centerX" secondItem="fz4-9d-5tq" secondAttribute="centerX" id="t2L-hx-Wvu"/>
<constraint firstAttribute="trailing" secondItem="WVU-qc-efT" secondAttribute="trailing" id="uf8-cg-WgD"/>
<constraint firstItem="fz4-9d-5tq" firstAttribute="leading" secondItem="W9l-ze-azg" secondAttribute="leading" constant="20" id="v2M-33-BDA"/>
<constraint firstAttribute="centerX" secondItem="3eJ-wI-Y11" secondAttribute="centerX" id="wRK-vV-cs9"/>
<constraint firstAttribute="trailing" secondItem="fz4-9d-5tq" secondAttribute="trailing" constant="20" id="wz1-Ok-gIi"/>
<constraint firstAttribute="centerX" secondItem="lMb-vR-q3Y" secondAttribute="centerX" id="yjM-dk-hoP"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
<exclude reference="2jy-XF-Yc6"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=regular">
<mask key="constraints">
<include reference="2jy-XF-Yc6"/>
</mask>
</variation>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="nuQ-1f-mMT"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="W9l-ze-azg" firstAttribute="centerY" secondItem="nuQ-1f-mMT" secondAttribute="centerY" id="1Le-Bj-m03"/>
<constraint firstItem="nuQ-1f-mMT" firstAttribute="trailing" secondItem="W9l-ze-azg" secondAttribute="trailing" constant="30" id="1wd-E9-kcQ"/>
<constraint firstItem="nuQ-1f-mMT" firstAttribute="bottom" relation="lessThanOrEqual" secondItem="W9l-ze-azg" secondAttribute="bottom" constant="30" id="9vB-UV-vTP"/>
<constraint firstItem="W9l-ze-azg" firstAttribute="leading" secondItem="nuQ-1f-mMT" secondAttribute="leading" constant="30" id="Bvm-sK-Baz"/>
<constraint firstItem="W9l-ze-azg" firstAttribute="top" relation="greaterThanOrEqual" secondItem="nuQ-1f-mMT" secondAttribute="top" constant="30" id="Eg7-7g-IAE"/>
<constraint firstItem="nuQ-1f-mMT" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="W9l-ze-azg" secondAttribute="bottom" constant="30" id="qIv-d3-sJM"/>
<constraint firstItem="W9l-ze-azg" firstAttribute="top" relation="lessThanOrEqual" secondItem="nuQ-1f-mMT" secondAttribute="top" constant="30" id="zs3-3Q-gZU"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="1wd-E9-kcQ"/>
<exclude reference="9vB-UV-vTP"/>
<exclude reference="Bvm-sK-Baz"/>
<exclude reference="zs3-3Q-gZU"/>
</mask>
</variation>
<variation key="widthClass=compact">
<mask key="constraints">
<include reference="1wd-E9-kcQ"/>
<include reference="Bvm-sK-Baz"/>
</mask>
</variation>
<variation key="widthClass=regular">
<mask key="constraints">
<include reference="9vB-UV-vTP"/>
<include reference="zs3-3Q-gZU"/>
</mask>
</variation>
<point key="canvasLocation" x="115.26717557251908" y="-30.281690140845072"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
<image name="ic_geoposition" width="28" height="28"/>
<image name="ic_privacy" width="17" height="17"/>
<image name="ic_settings" width="28" height="28"/>
<image name="ic_swither" width="30" height="29"/>
<systemColor name="systemBlueColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>

View file

@ -0,0 +1,7 @@
#import "MWMAlert.h"
@interface MWMLocationAlert : MWMAlert
+ (instancetype)alertWithCancelBlock:(MWMVoidBlock)cancelBlock;
@end

View file

@ -0,0 +1,39 @@
#import "MWMLocationAlert.h"
#import "MWMAlertViewController.h"
static NSString * const kLocationAlertNibName = @"MWMLocationAlert";
@interface MWMLocationAlert ()
@property (weak, nonatomic) IBOutlet UIButton * rightButton;
@property (nullable, nonatomic) MWMVoidBlock cancelBlock;
@end
@implementation MWMLocationAlert
+ (instancetype)alertWithCancelBlock:(MWMVoidBlock)cancelBlock
{
MWMLocationAlert * alert =
[NSBundle.mainBundle loadNibNamed:kLocationAlertNibName owner:nil options:nil].firstObject;
[alert setNeedsCloseAlertAfterEnterBackground];
alert.cancelBlock = cancelBlock;
return alert;
}
- (IBAction)settingsTap
{
[self close:^{
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
UIApplication * a = UIApplication.sharedApplication;
if ([a canOpenURL:url])
[a openURL:url options:@{} completionHandler:nil];
}];
}
- (IBAction)closeTap
{
[self close:self.cancelBlock];
}
@end

View file

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="mnY-7K-ids" customClass="MWMLocationAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8dg-2G-Gkm" userLabel="ContainerView">
<rect key="frame" x="47.5" y="198.5" width="280" height="291.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D5k-he-a1F" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="gGL-U8-TMu"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="22" id="h5g-o2-ynw"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_header"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0fV-Pc-ec6" userLabel="Message">
<rect key="frame" x="20" y="53.5" width="240" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="bjX-A8-pbd"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="kX0-pg-KbR"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_message"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oy8-sO-eim" userLabel="hDivider">
<rect key="frame" x="0.0" y="247.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="v6N-0M-ODb"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="opl-lk-5kD" userLabel="left">
<rect key="frame" x="0.0" y="247.5" width="140" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="Ant-We-sLi"/>
<constraint firstAttribute="height" constant="44" id="eOg-pv-nif"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cancel"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="closeTap" destination="mnY-7K-ids" eventType="touchUpInside" id="X82-1U-rec"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Ho-Pk-bDe" userLabel="right">
<rect key="frame" x="140" y="247.5" width="140" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="140" id="5wg-5d-hPp"/>
<constraint firstAttribute="height" constant="44" id="Mdl-Ix-DGD"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="settings"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="settingsTap" destination="mnY-7K-ids" eventType="touchUpInside" id="y48-t3-n6f"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oO4-NM-mFk" userLabel="vDivider">
<rect key="frame" x="140" y="247.5" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="mcR-0M-Ul0"/>
<constraint firstAttribute="height" constant="44" id="zL6-eK-WfS"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_settings" translatesAutoresizingMaskIntoConstraints="NO" id="icc-OP-m6N" userLabel="settings">
<rect key="frame" x="20" y="101.5" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="Ush-HH-2TA"/>
<constraint firstAttribute="width" constant="28" id="r2M-fp-8z4"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_geoposition" translatesAutoresizingMaskIntoConstraints="NO" id="S4o-n9-iX5" userLabel="geoposition">
<rect key="frame" x="20" y="145.5" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="Gdg-65-WkZ"/>
<constraint firstAttribute="width" constant="28" id="Wf3-ar-r44"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_select" translatesAutoresizingMaskIntoConstraints="NO" id="4hl-PR-x4M" userLabel="turnon">
<rect key="frame" x="20" y="189.5" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="A5h-wL-BHj"/>
<constraint firstAttribute="width" constant="28" id="mOL-nA-Afc"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1. Откройте Настройки" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EHh-Zz-Us5" userLabel="openSettings">
<rect key="frame" x="56" y="105.5" width="204" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="204" id="4JO-6s-aaI"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="jD6-K3-YYh"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_1"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2. Нажмите Геопозиция" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="stQ-KI-WeP" userLabel="openSettings">
<rect key="frame" x="56" y="149.5" width="204" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="AAw-Ri-mbT"/>
<constraint firstAttribute="width" constant="204" id="cNm-sH-jni"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_2"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3. Выберите &quot;Всегда&quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eiz-Ie-23H" userLabel="select &quot;Always&quot;">
<rect key="frame" x="56" y="193.5" width="204" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="bIH-9x-S0s"/>
<constraint firstAttribute="width" constant="204" id="qBs-0m-j1B"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="location_services_disabled_3"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="opl-lk-5kD" secondAttribute="bottom" id="0Mz-4Z-230"/>
<constraint firstAttribute="width" secondItem="oy8-sO-eim" secondAttribute="width" id="3MR-Nx-zJb"/>
<constraint firstItem="EHh-Zz-Us5" firstAttribute="centerY" secondItem="icc-OP-m6N" secondAttribute="centerY" id="3SF-wh-w9N"/>
<constraint firstItem="eiz-Ie-23H" firstAttribute="leading" secondItem="4hl-PR-x4M" secondAttribute="trailing" constant="8" id="4DN-XY-UYe"/>
<constraint firstItem="EHh-Zz-Us5" firstAttribute="leading" secondItem="icc-OP-m6N" secondAttribute="trailing" constant="8" id="4EP-kd-cxV"/>
<constraint firstItem="opl-lk-5kD" firstAttribute="top" secondItem="eiz-Ie-23H" secondAttribute="bottom" constant="34" id="6RO-Fl-s2K"/>
<constraint firstItem="stQ-KI-WeP" firstAttribute="centerY" secondItem="S4o-n9-iX5" secondAttribute="centerY" id="9bR-F2-lU7"/>
<constraint firstItem="icc-OP-m6N" firstAttribute="top" secondItem="0fV-Pc-ec6" secondAttribute="bottom" constant="28" id="C8m-mW-KEF"/>
<constraint firstAttribute="trailing" secondItem="1Ho-Pk-bDe" secondAttribute="trailing" id="CTo-Fd-m0E"/>
<constraint firstAttribute="width" constant="280" id="Fif-Pa-YZH"/>
<constraint firstAttribute="centerX" secondItem="oy8-sO-eim" secondAttribute="centerX" id="Gbp-Y5-rsD"/>
<constraint firstItem="oy8-sO-eim" firstAttribute="top" secondItem="eiz-Ie-23H" secondAttribute="bottom" constant="34" id="JJw-71-2in"/>
<constraint firstItem="0fV-Pc-ec6" firstAttribute="top" secondItem="D5k-he-a1F" secondAttribute="bottom" constant="11.5" id="Jth-x6-IhP"/>
<constraint firstItem="1Ho-Pk-bDe" firstAttribute="top" secondItem="eiz-Ie-23H" secondAttribute="bottom" constant="34" id="LUY-3a-Inq"/>
<constraint firstAttribute="bottom" secondItem="1Ho-Pk-bDe" secondAttribute="bottom" id="NE1-oz-CLF"/>
<constraint firstItem="4hl-PR-x4M" firstAttribute="leading" secondItem="8dg-2G-Gkm" secondAttribute="leading" constant="20" id="Q7v-Re-gje"/>
<constraint firstAttribute="centerX" secondItem="D5k-he-a1F" secondAttribute="centerX" id="XX2-IK-R6K"/>
<constraint firstItem="D5k-he-a1F" firstAttribute="top" secondItem="8dg-2G-Gkm" secondAttribute="top" constant="20" id="Z54-gN-f1U"/>
<constraint firstAttribute="bottom" secondItem="oO4-NM-mFk" secondAttribute="bottom" id="aNg-ua-Xvg"/>
<constraint firstItem="icc-OP-m6N" firstAttribute="leading" secondItem="8dg-2G-Gkm" secondAttribute="leading" constant="20" id="cIX-d5-lZJ"/>
<constraint firstAttribute="centerX" secondItem="0fV-Pc-ec6" secondAttribute="centerX" id="lTc-yR-XqA"/>
<constraint firstItem="eiz-Ie-23H" firstAttribute="centerY" secondItem="4hl-PR-x4M" secondAttribute="centerY" id="n0S-Sb-bFh"/>
<constraint firstItem="4hl-PR-x4M" firstAttribute="top" secondItem="stQ-KI-WeP" secondAttribute="bottom" constant="20" id="nov-7z-XFm"/>
<constraint firstItem="S4o-n9-iX5" firstAttribute="top" secondItem="EHh-Zz-Us5" secondAttribute="bottom" constant="20" id="qqy-xa-ojy"/>
<constraint firstItem="S4o-n9-iX5" firstAttribute="leading" secondItem="8dg-2G-Gkm" secondAttribute="leading" constant="20" id="stf-om-BNZ"/>
<constraint firstItem="stQ-KI-WeP" firstAttribute="leading" secondItem="S4o-n9-iX5" secondAttribute="trailing" constant="8" id="uyt-fW-FYM"/>
<constraint firstItem="oO4-NM-mFk" firstAttribute="leading" secondItem="opl-lk-5kD" secondAttribute="trailing" id="z1h-Dd-0AD"/>
<constraint firstItem="opl-lk-5kD" firstAttribute="leading" secondItem="8dg-2G-Gkm" secondAttribute="leading" id="z9J-7w-u9C"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="8dg-2G-Gkm" secondAttribute="centerY" constant="-10.5" id="W3z-HA-6ee"/>
<constraint firstAttribute="centerX" secondItem="8dg-2G-Gkm" secondAttribute="centerX" id="t4o-pT-rEC"/>
</constraints>
<viewLayoutGuide key="safeArea" id="k9W-qh-TkJ"/>
<connections>
<outlet property="rightButton" destination="1Ho-Pk-bDe" id="xO5-oe-a3h"/>
</connections>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
<image name="ic_geoposition" width="28" height="28"/>
<image name="ic_select" width="28" height="28"/>
<image name="ic_settings" width="28" height="28"/>
</resources>
</document>

View file

@ -0,0 +1,7 @@
#import "MWMAlert.h"
@interface MWMPlaceDoesntExistAlert : MWMAlert
+ (instancetype)alertWithBlock:(MWMStringBlock)block;
@end

View file

@ -0,0 +1,46 @@
#import "MWMPlaceDoesntExistAlert.h"
#import "MWMKeyboard.h"
@interface MWMPlaceDoesntExistAlert ()<MWMKeyboardObserver>
@property(weak, nonatomic) IBOutlet UITextField * textField;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * centerHorizontaly;
@property(copy, nonatomic) MWMStringBlock block;
@end
@implementation MWMPlaceDoesntExistAlert
+ (instancetype)alertWithBlock:(MWMStringBlock)block
{
MWMPlaceDoesntExistAlert * alert =
[NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
alert.block = block;
[MWMKeyboard addObserver:alert];
return alert;
}
- (IBAction)rightButtonTap
{
[self.textField resignFirstResponder];
[self close:^{
self.block(self.textField.text);
}];
}
- (IBAction)leftButtonTap
{
[self.textField resignFirstResponder];
[self close:nil];
}
#pragma mark - MWMKeyboard
- (void)onKeyboardAnimation
{
self.centerHorizontaly.constant = -[MWMKeyboard keyboardHeight] / 2;
[self layoutIfNeeded];
}
- (void)onKeyboardWillAnimate { [self setNeedsLayout]; }
@end

View file

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="bh1-8l-voy" customClass="MWMPlaceDoesntExistAlert">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XjH-qf-m6h" userLabel="ContainerView">
<rect key="frame" x="47.5" y="250.5" width="280" height="166"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NwN-e5-YQR" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="Bz8-HZ-yfK"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="22" id="JWn-Ze-jrX"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_place_doesnt_exist"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VvH-Bb-fV9" userLabel="Message">
<rect key="frame" x="20" y="54" width="240" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="Gau-b5-VxP"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="VWx-20-JCg"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_place_doesnt_exist_description"/>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="npf-dH-f50">
<rect key="frame" x="16" y="86" width="248" height="24"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="0f8-vD-nJT">
<rect key="frame" x="4" y="0.0" width="240" height="24"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="uql-Jo-4VK"/>
</constraints>
<edgeInsets key="layoutMargins" top="4" left="4" bottom="4" right="4"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertViewTextField"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedPlaceholder" value="editor_comment_hint"/>
</userDefinedRuntimeAttributes>
</textField>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="0f8-vD-nJT" firstAttribute="centerX" secondItem="npf-dH-f50" secondAttribute="centerX" id="Pm7-RK-HAq"/>
<constraint firstItem="0f8-vD-nJT" firstAttribute="centerY" secondItem="npf-dH-f50" secondAttribute="centerY" id="T6e-qA-hJ1"/>
<constraint firstAttribute="height" constant="24" id="ZAd-qX-QyG"/>
<constraint firstAttribute="width" constant="248" id="x63-Bq-F0w"/>
<constraint firstItem="0f8-vD-nJT" firstAttribute="height" secondItem="npf-dH-f50" secondAttribute="height" id="zHi-xB-aCQ"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertViewTextFieldContainer"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kEx-DM-ynC" userLabel="hDivider">
<rect key="frame" x="0.0" y="122" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="JKX-3f-YE4"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zaM-0A-71d" userLabel="left">
<rect key="frame" x="0.0" y="122" width="140" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="JRt-9h-Ljb"/>
<constraint firstAttribute="width" constant="140" id="y86-N4-bGg"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cancel"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="leftButtonTap" destination="bh1-8l-voy" eventType="touchUpInside" id="Ge7-Dx-Pf3"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MkK-sG-n6m" userLabel="right">
<rect key="frame" x="140" y="122" width="140" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="2ra-bP-J3a"/>
<constraint firstAttribute="width" constant="140" id="pNb-5U-J8Z"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_report_problem_send_button"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="rightButtonTap" destination="bh1-8l-voy" eventType="touchUpInside" id="4FZ-zi-TAB"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tyn-yU-dk3" userLabel="vDivider">
<rect key="frame" x="139.5" y="122" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="Bva-2f-zNE"/>
<constraint firstAttribute="height" constant="44" id="jEO-cN-3PZ"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="MkK-sG-n6m" secondAttribute="trailing" id="21Y-zv-8JR"/>
<constraint firstItem="NwN-e5-YQR" firstAttribute="top" secondItem="XjH-qf-m6h" secondAttribute="top" constant="20" id="6pQ-wv-c4Z"/>
<constraint firstItem="VvH-Bb-fV9" firstAttribute="top" secondItem="NwN-e5-YQR" secondAttribute="bottom" constant="12" id="EAW-Ft-SfJ"/>
<constraint firstAttribute="bottom" secondItem="MkK-sG-n6m" secondAttribute="bottom" id="K0E-y1-z0P"/>
<constraint firstAttribute="bottom" secondItem="zaM-0A-71d" secondAttribute="bottom" id="KzG-74-cDe"/>
<constraint firstItem="kEx-DM-ynC" firstAttribute="width" secondItem="XjH-qf-m6h" secondAttribute="width" id="Ldw-GJ-Ulm"/>
<constraint firstAttribute="bottom" secondItem="Tyn-yU-dk3" secondAttribute="bottom" id="Mb3-VE-bBR"/>
<constraint firstItem="Tyn-yU-dk3" firstAttribute="centerX" secondItem="XjH-qf-m6h" secondAttribute="centerX" id="PkD-5c-ltY"/>
<constraint firstItem="zaM-0A-71d" firstAttribute="leading" secondItem="XjH-qf-m6h" secondAttribute="leading" id="RCZ-fs-HwM"/>
<constraint firstItem="kEx-DM-ynC" firstAttribute="top" secondItem="npf-dH-f50" secondAttribute="bottom" constant="12" id="TD5-DZ-mt2"/>
<constraint firstItem="NwN-e5-YQR" firstAttribute="centerX" secondItem="XjH-qf-m6h" secondAttribute="centerX" id="ZbO-Kn-lsV"/>
<constraint firstItem="npf-dH-f50" firstAttribute="top" secondItem="VvH-Bb-fV9" secondAttribute="bottom" constant="12" id="apH-SR-1Ir"/>
<constraint firstItem="zaM-0A-71d" firstAttribute="top" secondItem="kEx-DM-ynC" secondAttribute="bottom" constant="-1" id="cPx-SM-J1B"/>
<constraint firstItem="VvH-Bb-fV9" firstAttribute="centerX" secondItem="XjH-qf-m6h" secondAttribute="centerX" id="mPb-7n-Ns1"/>
<constraint firstItem="npf-dH-f50" firstAttribute="centerX" secondItem="XjH-qf-m6h" secondAttribute="centerX" id="nfD-rk-FZo"/>
<constraint firstAttribute="width" constant="280" id="uve-xM-xfj"/>
<constraint firstItem="kEx-DM-ynC" firstAttribute="centerX" secondItem="XjH-qf-m6h" secondAttribute="centerX" id="vop-cl-2u7"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="XjH-qf-m6h" firstAttribute="centerX" secondItem="bh1-8l-voy" secondAttribute="centerX" id="Ez4-IC-X2C"/>
<constraint firstItem="XjH-qf-m6h" firstAttribute="centerY" secondItem="bh1-8l-voy" secondAttribute="centerY" id="ihl-fu-ac9"/>
</constraints>
<viewLayoutGuide key="safeArea" id="4Cb-Xf-v8p"/>
<connections>
<outlet property="centerHorizontaly" destination="ihl-fu-ac9" id="f11-9c-PMh"/>
<outlet property="textField" destination="0f8-vD-nJT" id="tm8-Pb-b1x"/>
</connections>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,19 @@
#import "MWMAlert.h"
typedef NS_ENUM(NSInteger, MWMMobileInternetAlertResult) {
MWMMobileInternetAlertResultAlways,
MWMMobileInternetAlertResultToday,
MWMMobileInternetAlertResultNotToday
};
NS_ASSUME_NONNULL_BEGIN
typedef void(^MWMMobileInternetAlertCompletionBlock)(MWMMobileInternetAlertResult result);
@interface MWMMobileInternetAlert : MWMAlert
+ (instancetype)alertWithBlock:(MWMMobileInternetAlertCompletionBlock)block;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,40 @@
#import "MWMMobileInternetAlert.h"
@interface MWMMobileInternetAlert ()
@property(copy, nonatomic) MWMMobileInternetAlertCompletionBlock completionBlock;
@end
@implementation MWMMobileInternetAlert
+ (instancetype)alertWithBlock:(MWMMobileInternetAlertCompletionBlock)block;
{
MWMMobileInternetAlert * alert =
[NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
alert.completionBlock = block;
return alert;
}
- (IBAction)alwaysTap
{
[self close:^{
self.completionBlock(MWMMobileInternetAlertResultAlways);
}];
}
- (IBAction)askTap
{
[self close:^{
self.completionBlock(MWMMobileInternetAlertResultToday);
}];
}
- (IBAction)neverTap
{
[self close:^{
self.completionBlock(MWMMobileInternetAlertResultNotToday);
}];
}
@end

View file

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="Tlh-TS-tkk" customClass="MWMMobileInternetAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tx8-cY-Dyg" userLabel="ContainerView">
<rect key="frame" x="47.5" y="219.5" width="280" height="228.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="REz-A0-Vg9" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="21.5"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="QEO-gJ-c3y"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="RsI-at-W6p"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="mobile_data"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fGq-0K-ugB" userLabel="Message">
<rect key="frame" x="20" y="53.5" width="240" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="F3h-lQ-gSS"/>
<constraint firstAttribute="width" constant="240" id="XgA-ox-stk"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="mobile_data_dialog"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0vG-Ty-4hj" userLabel="button1">
<rect key="frame" x="0.0" y="94.5" width="280" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="RyA-xn-gAo"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Использовать всегда">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="mobile_data_option_always"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="bold17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="alwaysTap" destination="Tlh-TS-tkk" eventType="touchUpInside" id="fuJ-lY-I2V"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="d5L-hE-z56" userLabel="button2">
<rect key="frame" x="0.0" y="139.5" width="280" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Спрашивать">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="mobile_data_option_today"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="askTap" destination="Tlh-TS-tkk" eventType="touchUpInside" id="brA-aR-BSr"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xff-AT-bjO" userLabel="button3">
<rect key="frame" x="0.0" y="184.5" width="280" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Никогда не использовать">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="mobile_data_option_not_today"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="neverTap" destination="Tlh-TS-tkk" eventType="touchUpInside" id="wMh-1n-svo"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VZe-Gu-rIx" userLabel="hDivider1">
<rect key="frame" x="0.0" y="93.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="J0l-nh-ng5"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pNk-h2-LSK" userLabel="hDivider2">
<rect key="frame" x="0.0" y="138.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZZ7-CE-a8J" userLabel="hDivider3">
<rect key="frame" x="0.0" y="183.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="d5L-hE-z56" firstAttribute="leading" secondItem="0vG-Ty-4hj" secondAttribute="leading" id="0nb-Mk-riG"/>
<constraint firstAttribute="centerX" secondItem="REz-A0-Vg9" secondAttribute="centerX" id="1H6-10-IWz"/>
<constraint firstItem="VZe-Gu-rIx" firstAttribute="top" secondItem="fGq-0K-ugB" secondAttribute="bottom" constant="20" id="7Sc-TP-Opl"/>
<constraint firstItem="0vG-Ty-4hj" firstAttribute="top" secondItem="VZe-Gu-rIx" secondAttribute="bottom" id="8lH-Op-m0b"/>
<constraint firstItem="d5L-hE-z56" firstAttribute="trailing" secondItem="0vG-Ty-4hj" secondAttribute="trailing" id="9RH-ob-nxK"/>
<constraint firstAttribute="width" secondItem="VZe-Gu-rIx" secondAttribute="width" id="CF8-wO-Qmv"/>
<constraint firstItem="ZZ7-CE-a8J" firstAttribute="top" secondItem="d5L-hE-z56" secondAttribute="bottom" priority="500" id="Ccg-Zb-Jdz"/>
<constraint firstItem="Xff-AT-bjO" firstAttribute="leading" secondItem="0vG-Ty-4hj" secondAttribute="leading" id="FF7-dF-mRZ"/>
<constraint firstItem="REz-A0-Vg9" firstAttribute="top" secondItem="Tx8-cY-Dyg" secondAttribute="top" constant="20" id="FgB-En-Kgp"/>
<constraint firstItem="0vG-Ty-4hj" firstAttribute="trailing" secondItem="VZe-Gu-rIx" secondAttribute="trailing" id="INy-WF-7W6"/>
<constraint firstAttribute="centerX" secondItem="VZe-Gu-rIx" secondAttribute="centerX" id="KrD-nj-Oh6"/>
<constraint firstItem="Xff-AT-bjO" firstAttribute="top" secondItem="ZZ7-CE-a8J" secondAttribute="bottom" id="NXi-bS-mbk"/>
<constraint firstItem="0vG-Ty-4hj" firstAttribute="leading" secondItem="VZe-Gu-rIx" secondAttribute="leading" id="O7A-Ma-3gA"/>
<constraint firstItem="pNk-h2-LSK" firstAttribute="top" secondItem="0vG-Ty-4hj" secondAttribute="bottom" id="OS9-H6-KDF"/>
<constraint firstItem="pNk-h2-LSK" firstAttribute="height" secondItem="VZe-Gu-rIx" secondAttribute="height" id="Z3c-z0-QUD"/>
<constraint firstItem="ZZ7-CE-a8J" firstAttribute="leading" secondItem="VZe-Gu-rIx" secondAttribute="leading" id="apm-L8-gZW"/>
<constraint firstItem="ZZ7-CE-a8J" firstAttribute="trailing" secondItem="VZe-Gu-rIx" secondAttribute="trailing" id="bXV-jy-LQ5"/>
<constraint firstItem="d5L-hE-z56" firstAttribute="height" secondItem="0vG-Ty-4hj" secondAttribute="height" id="d0s-RF-Hth"/>
<constraint firstItem="pNk-h2-LSK" firstAttribute="trailing" secondItem="VZe-Gu-rIx" secondAttribute="trailing" id="dKB-th-WyI"/>
<constraint firstAttribute="centerX" secondItem="fGq-0K-ugB" secondAttribute="centerX" id="hum-18-a8G"/>
<constraint firstItem="Xff-AT-bjO" firstAttribute="trailing" secondItem="0vG-Ty-4hj" secondAttribute="trailing" id="ibO-5L-PH1"/>
<constraint firstAttribute="bottom" secondItem="Xff-AT-bjO" secondAttribute="bottom" id="kZ3-1x-e5J"/>
<constraint firstItem="pNk-h2-LSK" firstAttribute="leading" secondItem="VZe-Gu-rIx" secondAttribute="leading" id="kv8-5K-4MW"/>
<constraint firstItem="Xff-AT-bjO" firstAttribute="height" secondItem="0vG-Ty-4hj" secondAttribute="height" id="net-N9-aSB"/>
<constraint firstAttribute="width" constant="280" id="oBl-6m-Exe"/>
<constraint firstItem="d5L-hE-z56" firstAttribute="top" secondItem="pNk-h2-LSK" secondAttribute="bottom" id="psC-4J-kSw"/>
<constraint firstItem="ZZ7-CE-a8J" firstAttribute="height" secondItem="VZe-Gu-rIx" secondAttribute="height" id="wqS-Qh-ept"/>
<constraint firstItem="fGq-0K-ugB" firstAttribute="top" secondItem="REz-A0-Vg9" secondAttribute="bottom" constant="12" id="xjY-UE-eIh"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="Tx8-cY-Dyg" secondAttribute="centerY" id="Zpv-vh-Jxs"/>
<constraint firstAttribute="centerX" secondItem="Tx8-cY-Dyg" secondAttribute="centerX" id="oWX-V9-KBj"/>
</constraints>
<viewLayoutGuide key="safeArea" id="y7G-G6-vSl"/>
<point key="canvasLocation" x="304.5" y="171.5"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,7 @@
#import "MWMAlert.h"
@interface MWMRoutingDisclaimerAlert : MWMAlert
+ (instancetype)alertWithOkBlock:(MWMVoidBlock)block;
@end

View file

@ -0,0 +1,74 @@
#import "MWMRoutingDisclaimerAlert.h"
#import "MWMAlertViewController.h"
static CGFloat const kMinimumOffset = 20.;
@interface MWMRoutingDisclaimerAlert ()
@property(weak, nonatomic) IBOutlet UITextView * textView;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * textViewHeight;
@property(copy, nonatomic) MWMVoidBlock okBlock;
@end
@implementation MWMRoutingDisclaimerAlert
+ (instancetype)alertWithOkBlock:(MWMVoidBlock)block
{
MWMRoutingDisclaimerAlert * alert =
[NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
NSString * message = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@\n\n%@",
L(@"dialog_routing_disclaimer_priority"),
L(@"dialog_routing_disclaimer_precision"),
L(@"dialog_routing_disclaimer_recommendations"),
L(@"dialog_routing_disclaimer_borders"),
L(@"dialog_routing_disclaimer_beware")];
alert.textView.attributedText =
[[NSAttributedString alloc] initWithString:message
attributes:@{
NSFontAttributeName : UIFont.regular14,
NSForegroundColorAttributeName : UIColor.blackSecondaryText
}];
[alert.textView sizeToFit];
UIWindow * window = UIApplication.sharedApplication.keyWindow;
[alert invalidateTextViewHeight:alert.textView.height withHeight:window.height];
alert.okBlock = block;
return alert;
}
- (IBAction)okTap
{
[self close:self.okBlock];
}
- (IBAction)cancelTap
{
[self close:nil];
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
UIView * superview = self.superview ?: UIApplication.sharedApplication.keyWindow;
CGFloat const height = UIInterfaceOrientationIsLandscape(orientation)
? MIN(superview.width, superview.height)
: MAX(superview.width, superview.height);
[self invalidateTextViewHeight:self.textView.contentSize.height withHeight:height];
}
- (void)invalidateTextViewHeight:(CGFloat)textViewHeight withHeight:(CGFloat)height
{
self.textViewHeight.constant = [self bounded:textViewHeight withHeight:height];
self.textView.scrollEnabled = textViewHeight > self.textViewHeight.constant;
[self layoutIfNeeded];
}
- (CGFloat)bounded:(CGFloat)f withHeight:(CGFloat)h
{
CGFloat const currentHeight = [self.subviews.firstObject height];
CGFloat const maximumHeight = h - 2. * kMinimumOffset;
CGFloat const availableHeight = maximumHeight - currentHeight;
return MIN(f, availableHeight + self.textViewHeight.constant);
}
@end

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="Ie9-JJ-hnZ" customClass="MWMRoutingDisclaimerAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ogu-AE-Ohh" userLabel="ContainerView">
<rect key="frame" x="47.5" y="265" width="280" height="137.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S3s-j7-v6E" userLabel="Title">
<rect key="frame" x="20" y="20" width="240" height="21.5"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="uht-Xi-vWk"/>
<constraint firstAttribute="width" constant="240" id="wsn-Cq-kJT"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="dialog_routing_disclaimer_title"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lbr-Xd-hLF">
<rect key="frame" x="20" y="52.5" width="240" height="20"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="GeJ-mk-jko"/>
<constraint firstAttribute="height" constant="20" id="XLp-um-S4A"/>
</constraints>
<attributedString key="attributedText">
<fragment content="Message">
<attributes>
<color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="14" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences" autocorrectionType="no" spellCheckingType="no"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</textView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XIL-q9-MMp" userLabel="hDivider">
<rect key="frame" x="0.0" y="92.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="g4E-tB-Y4R"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aCY-1G-NL5" userLabel="right">
<rect key="frame" x="140.5" y="93.5" width="139.5" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="acceptButton"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="AAv-pX-uuc"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="right">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="accept"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="okTap" destination="Ie9-JJ-hnZ" eventType="touchUpInside" id="vfz-Rd-Kh6"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JfV-qu-qmI" userLabel="left">
<rect key="frame" x="0.0" y="93.5" width="139.5" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="cancelButton"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<state key="normal" title="left">
<color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="decline"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="cancelTap" destination="Ie9-JJ-hnZ" eventType="touchUpInside" id="KWl-Dn-BpU"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="930-J1-9o0" userLabel="vDivider">
<rect key="frame" x="139.5" y="93.5" width="1" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="mf2-e7-Qg6"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="lbr-Xd-hLF" firstAttribute="top" secondItem="S3s-j7-v6E" secondAttribute="bottom" constant="11" id="20T-2E-mmf"/>
<constraint firstAttribute="width" secondItem="XIL-q9-MMp" secondAttribute="width" id="3m7-Ha-HlN"/>
<constraint firstItem="XIL-q9-MMp" firstAttribute="top" secondItem="lbr-Xd-hLF" secondAttribute="bottom" constant="20" id="4k1-g8-WZV"/>
<constraint firstAttribute="trailing" secondItem="aCY-1G-NL5" secondAttribute="trailing" id="BcN-zR-SdX"/>
<constraint firstItem="930-J1-9o0" firstAttribute="bottom" secondItem="aCY-1G-NL5" secondAttribute="bottom" id="F4d-Td-XJg"/>
<constraint firstItem="JfV-qu-qmI" firstAttribute="width" secondItem="aCY-1G-NL5" secondAttribute="width" id="KAH-qc-1f1"/>
<constraint firstAttribute="width" constant="280" id="KpN-ir-OWh"/>
<constraint firstAttribute="centerX" secondItem="lbr-Xd-hLF" secondAttribute="centerX" id="KuP-DA-FWV"/>
<constraint firstItem="JfV-qu-qmI" firstAttribute="bottom" secondItem="aCY-1G-NL5" secondAttribute="bottom" id="MPL-wr-BbK"/>
<constraint firstItem="aCY-1G-NL5" firstAttribute="leading" secondItem="930-J1-9o0" secondAttribute="trailing" id="N4p-JX-gzl"/>
<constraint firstAttribute="centerX" secondItem="S3s-j7-v6E" secondAttribute="centerX" id="Oag-6s-ais"/>
<constraint firstItem="S3s-j7-v6E" firstAttribute="top" secondItem="Ogu-AE-Ohh" secondAttribute="top" constant="20" id="OoP-Qp-YIb"/>
<constraint firstItem="JfV-qu-qmI" firstAttribute="leading" secondItem="Ogu-AE-Ohh" secondAttribute="leading" id="VYG-iz-HL8"/>
<constraint firstAttribute="bottom" secondItem="aCY-1G-NL5" secondAttribute="bottom" id="WB8-od-eAG"/>
<constraint firstItem="930-J1-9o0" firstAttribute="top" secondItem="aCY-1G-NL5" secondAttribute="top" id="aP7-3d-zW1"/>
<constraint firstItem="JfV-qu-qmI" firstAttribute="top" secondItem="aCY-1G-NL5" secondAttribute="top" id="b8D-tm-ZFK"/>
<constraint firstAttribute="centerX" secondItem="XIL-q9-MMp" secondAttribute="centerX" id="bas-rx-OTg"/>
<constraint firstItem="930-J1-9o0" firstAttribute="leading" secondItem="JfV-qu-qmI" secondAttribute="trailing" id="gTM-qA-I1T"/>
<constraint firstItem="aCY-1G-NL5" firstAttribute="top" secondItem="XIL-q9-MMp" secondAttribute="bottom" id="swb-Yx-lVo"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="Ogu-AE-Ohh" secondAttribute="centerY" id="Kg9-hX-fvu"/>
<constraint firstAttribute="centerX" secondItem="Ogu-AE-Ohh" secondAttribute="centerX" id="dkW-i0-CZ2"/>
</constraints>
<viewLayoutGuide key="safeArea" id="n9h-Fb-ugd"/>
<connections>
<outlet property="textView" destination="lbr-Xd-hLF" id="ru3-Uu-UKw"/>
<outlet property="textViewHeight" destination="XLp-um-S4A" id="GmU-gr-jlY"/>
</connections>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="zbk-bu-cTT" customClass="MWMSpinnerAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZW-Y8-F8A" userLabel="ContainerView">
<rect key="frame" x="47.5" y="264.5" width="280" height="138.5"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6Ik-Gs-Yc7" userLabel="button1">
<rect key="frame" x="0.0" y="94.5" width="280" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="ejP-Qr-J5O"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="cancel">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="dialog_btn_press"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cancel"/>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="bold17:linkBlueText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="tap" destination="zbk-bu-cTT" eventType="touchUpInside" id="a2c-ED-0jy"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lX1-uE-UHN" userLabel="hDivider1">
<rect key="frame" x="0.0" y="93.5" width="280" height="1"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="f9v-KZ-u2L"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kq1-MC-Bth">
<rect key="frame" x="124" y="16" width="32" height="32"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="BsB-R0-OVr"/>
<constraint firstAttribute="width" constant="32" id="ElH-YQ-cGZ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JHp-iN-vQc" userLabel="Title">
<rect key="frame" x="20" y="56" width="240" height="21.5"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="57O-O2-CsM"/>
<constraint firstAttribute="width" constant="240" id="M8o-cf-xqy"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium18:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.88" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="6Ik-Gs-Yc7" firstAttribute="top" secondItem="lX1-uE-UHN" secondAttribute="bottom" id="04f-3J-sOv"/>
<constraint firstItem="kq1-MC-Bth" firstAttribute="centerX" secondItem="fZW-Y8-F8A" secondAttribute="centerX" id="1bI-tg-lK9"/>
<constraint firstAttribute="width" constant="280" id="7A5-aI-a0x"/>
<constraint firstAttribute="centerX" secondItem="lX1-uE-UHN" secondAttribute="centerX" id="DKt-je-czo"/>
<constraint firstItem="kq1-MC-Bth" firstAttribute="top" secondItem="fZW-Y8-F8A" secondAttribute="top" constant="16" id="Ft7-Dd-lYK"/>
<constraint firstAttribute="width" secondItem="lX1-uE-UHN" secondAttribute="width" id="Qpr-nH-Na5"/>
<constraint firstAttribute="bottom" secondItem="6Ik-Gs-Yc7" secondAttribute="bottom" id="Tqv-1O-YVs"/>
<constraint firstItem="lX1-uE-UHN" firstAttribute="top" secondItem="JHp-iN-vQc" secondAttribute="bottom" constant="16" id="b0T-2G-xsF"/>
<constraint firstItem="6Ik-Gs-Yc7" firstAttribute="trailing" secondItem="lX1-uE-UHN" secondAttribute="trailing" id="tYJ-fJ-ov9"/>
<constraint firstItem="6Ik-Gs-Yc7" firstAttribute="leading" secondItem="lX1-uE-UHN" secondAttribute="leading" id="vDN-x9-Sw8"/>
<constraint firstAttribute="centerX" secondItem="JHp-iN-vQc" secondAttribute="centerX" id="wwC-8B-KBV"/>
<constraint firstItem="JHp-iN-vQc" firstAttribute="top" secondItem="kq1-MC-Bth" secondAttribute="bottom" constant="8" id="yW9-DY-uxC"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="fZW-Y8-F8A" secondAttribute="centerX" id="Ll6-go-lGy"/>
<constraint firstAttribute="centerY" secondItem="fZW-Y8-F8A" secondAttribute="centerY" id="Sz5-hL-nLu"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fPw-k5-Wbc"/>
<connections>
<outlet property="cancelButton" destination="6Ik-Gs-Yc7" id="PcZ-Qo-ycv"/>
<outlet property="cancelHeight" destination="ejP-Qr-J5O" id="sxx-S8-gDN"/>
<outlet property="divider" destination="lX1-uE-UHN" id="BGf-W6-2UF"/>
<outlet property="progressView" destination="kq1-MC-Bth" id="FK3-oI-lWX"/>
<outlet property="title" destination="JHp-iN-vQc" id="6lQ-ps-HJD"/>
</connections>
<point key="canvasLocation" x="304.5" y="171.5"/>
</view>
</objects>
<resources>
<image name="dialog_btn_press" width="280" height="44"/>
</resources>
</document>

View file

@ -0,0 +1,43 @@
@objc(MWMSpinnerAlert)
final class SpinnerAlert: MWMAlert {
@IBOutlet private weak var progressView: UIView!
@IBOutlet private weak var title: UILabel!
@IBOutlet private weak var cancelHeight: NSLayoutConstraint!
@IBOutlet private weak var cancelButton: UIButton!
@IBOutlet private weak var divider: UIView!
private var cancel: MWMVoidBlock?
private lazy var progress: MWMCircularProgress = {
var p = MWMCircularProgress.downloaderProgress(forParentView: progressView)
return p
}()
@objc static func alert(title: String, cancel: MWMVoidBlock?) -> SpinnerAlert? {
guard let alert = Bundle.main.loadNibNamed(className(), owner: nil, options: nil)?.first
as? SpinnerAlert else {
assertionFailure()
return nil
}
alert.title.text = title
alert.progress.state = .spinner
alert.progress.setCancelButtonHidden()
if let cancel = cancel {
alert.cancel = cancel
} else {
alert.cancelHeight.constant = 0
alert.cancelButton.isHidden = true
alert.divider.isHidden = true
alert.setNeedsLayout()
}
return alert
}
@IBAction private func tap() {
close(cancel)
}
}

View file

@ -0,0 +1,122 @@
@objc
final class Toast: NSObject {
@objc
enum Alignment: Int {
case bottom
case top
}
private enum Constants {
static let presentationDuration: TimeInterval = 3
static let animationDuration: TimeInterval = kDefaultAnimationDuration
static let bottomOffset: CGFloat = 63
static let topOffset: CGFloat = 50
static let horizontalOffset: CGFloat = 16
static let labelOffsets = UIEdgeInsets(top: 10, left: 14, bottom: -10, right: -14)
static let maxWidth: CGFloat = 400
}
private static var toasts: [Toast] = []
private var blurView: UIVisualEffectView
private init(_ text: String) {
blurView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
blurView.setStyle(.toastBackground)
blurView.isUserInteractionEnabled = false
blurView.alpha = 0
blurView.translatesAutoresizingMaskIntoConstraints = false
let label = UILabel()
label.text = text
label.setStyle(.toastLabel)
label.numberOfLines = 0
label.translatesAutoresizingMaskIntoConstraints = false
label.setContentHuggingPriority(.defaultLow, for: .horizontal)
blurView.contentView.addSubview(label)
NSLayoutConstraint.activate([
label.leadingAnchor.constraint(equalTo: blurView.contentView.leadingAnchor, constant: Constants.labelOffsets.left),
label.trailingAnchor.constraint(equalTo: blurView.contentView.trailingAnchor, constant: Constants.labelOffsets.right),
label.topAnchor.constraint(equalTo: blurView.contentView.topAnchor, constant: Constants.labelOffsets.top),
label.bottomAnchor.constraint(equalTo: blurView.contentView.bottomAnchor, constant: Constants.labelOffsets.bottom)
])
}
// MARK: - Public methods
@objc
static func show(withText text: String) {
show(withText: text, alignment: .bottom)
}
@objc
static func show(withText text: String, alignment: Alignment) {
show(withText: text, alignment: alignment, pinToSafeArea: true)
}
@objc
static func show(withText text: String, alignment: Alignment, pinToSafeArea: Bool) {
let toast = Toast(text)
toasts.append(toast)
toast.show(withAlignment: alignment, pinToSafeArea: pinToSafeArea)
}
@objc
static func hideAll() {
toasts.forEach { $0.hide() }
}
// MARK: - Private methods
private func show(withAlignment alignment: Alignment, pinToSafeArea: Bool) {
Self.hideAll()
guard let view = (UIApplication.shared.connectedScenes.filter { $0.activationState == .foregroundActive }.first(where: { $0 is UIWindowScene }) as? UIWindowScene)?.keyWindow else { return }
view.addSubview(blurView)
let leadingConstraint = blurView.leadingAnchor.constraint(greaterThanOrEqualTo: view.leadingAnchor, constant: Constants.horizontalOffset)
let trailingConstraint = blurView.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor, constant: -Constants.horizontalOffset)
let maxWidthConstraint = blurView.widthAnchor.constraint(equalToConstant: Constants.maxWidth).withPriority(.defaultLow)
let verticalConstraint: NSLayoutConstraint
switch alignment {
case .bottom:
verticalConstraint = blurView.bottomAnchor.constraint(equalTo: pinToSafeArea ? view.safeAreaLayoutGuide.bottomAnchor : view.bottomAnchor,
constant: -Constants.bottomOffset)
case .top:
verticalConstraint = blurView.topAnchor.constraint(equalTo: pinToSafeArea ? view.safeAreaLayoutGuide.topAnchor : view.topAnchor,
constant: Constants.topOffset)
}
NSLayoutConstraint.activate([
leadingConstraint,
trailingConstraint,
maxWidthConstraint,
verticalConstraint,
blurView.centerXAnchor.constraint(equalTo: pinToSafeArea ? view.safeAreaLayoutGuide.centerXAnchor : view.centerXAnchor)
])
UIView.animate(withDuration: Constants.animationDuration, animations: {
self.blurView.alpha = 1
} , completion: { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.presentationDuration) {
self.hide()
}
})
}
private func hide() {
if self.blurView.superview != nil {
UIView.animate(withDuration: Constants.animationDuration,
animations: { self.blurView.alpha = 0 }) { [self] _ in
self.blurView.removeFromSuperview()
Self.toasts.removeAll(where: { $0 === self }) }
}
}
}
extension NSLayoutConstraint {
func withPriority(_ priority: UILayoutPriority) -> NSLayoutConstraint {
self.priority = priority
return self
}
}

View file

@ -0,0 +1,7 @@
extension UIAlertController {
static func unknownCurrentPosition() -> UIAlertController {
let alert = UIAlertController(title: L("unknown_current_position"), message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: L("ok"), style: .default, handler: nil))
return alert
}
}