diff options
author | Aleksey Belouosv <aleksey@maps.me> | 2019-04-04 17:52:33 +0300 |
---|---|---|
committer | Zoia <niakris90@gmail.com> | 2019-04-04 18:01:39 +0300 |
commit | 92174525bf45a6517a8c87a64668c4a79729f119 (patch) | |
tree | 0e2b4a2675d82b91e0267d6c4d9d1fdbdff9c52c /iphone | |
parent | d6498ffef128053f16994b1156fa02d2770ec6d5 (diff) |
[iOS] add options to avoid some road types when routing
Diffstat (limited to 'iphone')
42 files changed, 806 insertions, 120 deletions
diff --git a/iphone/Maps/Bridging-Header.h b/iphone/Maps/Bridging-Header.h index 999cfa9f0e..749e6d5f3c 100644 --- a/iphone/Maps/Bridging-Header.h +++ b/iphone/Maps/Bridging-Header.h @@ -58,6 +58,7 @@ #import "MWMRoutePreviewTaxiCellType.h" #import "MWMRouter.h" #import "MWMRouterTransitStepInfo.h" +#import "MWMRoutingOptions.h" #import "MWMSearchItemType.h" #import "MWMSearchNoResults.h" #import "MWMSearchFrameworkHelper.h" diff --git a/iphone/Maps/Categories/UIColor+MapsMeColor.h b/iphone/Maps/Categories/UIColor+MapsMeColor.h index 3db34ff5a1..c95ee9366b 100644 --- a/iphone/Maps/Categories/UIColor+MapsMeColor.h +++ b/iphone/Maps/Categories/UIColor+MapsMeColor.h @@ -4,6 +4,7 @@ + (UIColor *)primaryDark; + (UIColor *)primary; ++ (UIColor *)secondary; + (UIColor *)primaryLight; + (UIColor *)fadeBackground; + (UIColor *)menuBackground; diff --git a/iphone/Maps/Categories/UIColor+MapsMeColor.mm b/iphone/Maps/Categories/UIColor+MapsMeColor.mm index 2f7dffc20a..db8868fd8f 100644 --- a/iphone/Maps/Categories/UIColor+MapsMeColor.mm +++ b/iphone/Maps/Categories/UIColor+MapsMeColor.mm @@ -9,6 +9,7 @@ NSDictionary<NSString *, UIColor *> * night = @{ @"primaryDark": [UIColor colorWithRed:scaled(25.) green:scaled(30) blue:scaled(35.) alpha:alpha100], @"primary": [UIColor colorWithRed:scaled(45.) green:scaled(50.) blue:scaled(55.) alpha:alpha100], + @"secondary": [UIColor colorWithRed:scaled(0x25) green:scaled(0x28) blue:scaled(0x2b) alpha:alpha100], // Light green color @"primaryLight": [UIColor colorWithRed:scaled(65.) green:scaled(70.) blue:scaled(75.) alpha:alpha100], @@ -59,6 +60,7 @@ NSDictionary<NSString *, UIColor *> * day = @{ [UIColor colorWithRed:scaled(24.) green:scaled(128) blue:scaled(68.) alpha:alpha100], @"primary" : [UIColor colorWithRed:scaled(32.) green:scaled(152.) blue:scaled(82.) alpha:alpha100], + @"secondary" : [UIColor colorWithRed:scaled(45) green:scaled(137) blue:scaled(83) alpha:alpha100], // Light green color @"primaryLight" : [UIColor colorWithRed:scaled(36.) green:scaled(180.) blue:scaled(98.) alpha:alpha100], @@ -140,6 +142,11 @@ UIColor * color(SEL cmd) return color(_cmd); } ++ (UIColor *)secondary +{ + return color(_cmd); +} + // Light green color + (UIColor *)primaryLight { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h index 86d67218fc..45b2434ad2 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h @@ -51,7 +51,7 @@ class Info; - (void)onRoutePrepare; - (void)onRouteRebuild; -- (void)onRouteReady; +- (void)onRouteReady:(BOOL)hasWarnings; - (void)onRouteStart; - (void)onRouteStop; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 91d1306931..230024cffb 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -258,10 +258,10 @@ extern NSString * const kAlohalyticsTapEventKey; [self.navigationManager onRoutePlanning]; } -- (void)onRouteReady +- (void)onRouteReady:(BOOL)hasWarnings { self.searchManager.state = MWMSearchManagerStateHidden; - [self.navigationManager onRouteReady]; + [self.navigationManager onRouteReady:hasWarnings]; } - (void)onRouteStart diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h index 6a31a4cee2..2c20d5376e 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h @@ -28,7 +28,7 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) { - (void)onRoutePrepare; - (void)onRoutePlanning; - (void)onRouteError:(NSString *)error; -- (void)onRouteReady; +- (void)onRouteReady:(BOOL)hasWarnings; - (void)onRouteStart; - (void)onRouteStop; - (void)onRoutePointsUpdated; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm index 3055611f0b..2d635c8186 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm @@ -5,12 +5,8 @@ #import "MWMSearch.h" #import "MapViewController.h" -#import <AudioToolbox/AudioServices.h> -#import <Crashlytics/Crashlytics.h> #import "SwiftBridge.h" -#include "platform/platform.hpp" - extern NSString * const kAlohalyticsTapEventKey; namespace @@ -30,7 +26,7 @@ using Observers = NSHashTable<Observer>; @end -@interface MWMNavigationDashboardManager ()<MWMSearchManagerObserver> +@interface MWMNavigationDashboardManager ()<MWMSearchManagerObserver, MWMRoutePreviewDelegate> @property(copy, nonatomic) NSDictionary * etaAttributes; @property(copy, nonatomic) NSDictionary * etaSecondaryAttributes; @@ -128,18 +124,33 @@ using Observers = NSHashTable<Observer>; #pragma mark - On route updates -- (void)onRoutePrepare { self.state = MWMNavigationDashboardStatePrepare; } -- (void)onRoutePlanning { self.state = MWMNavigationDashboardStatePlanning; } +- (void)onRoutePrepare { + self.state = MWMNavigationDashboardStatePrepare; + self.routePreview.drivingOptionsState = MWMDrivingOptionsStateNone; +} + +- (void)onRoutePlanning { + self.state = MWMNavigationDashboardStatePlanning; + self.routePreview.drivingOptionsState = MWMDrivingOptionsStateNone; +} + - (void)onRouteError:(NSString *)error { self.errorMessage = error; self.state = MWMNavigationDashboardStateError; + self.routePreview.drivingOptionsState = [MWMRouter hasActiveDrivingOptions] ? + MWMDrivingOptionsStateChange : MWMDrivingOptionsStateNone; } -- (void)onRouteReady +- (void)onRouteReady:(BOOL)hasWarnings { if (self.state != MWMNavigationDashboardStateNavigation && ![MWMRouter isTaxi]) self.state = MWMNavigationDashboardStateReady; + if ([MWMRouter hasActiveDrivingOptions]) { + self.routePreview.drivingOptionsState = MWMDrivingOptionsStateChange; + } else { + self.routePreview.drivingOptionsState = hasWarnings ? MWMDrivingOptionsStateDefine : MWMDrivingOptionsStateNone; + } } - (void)onRoutePointsUpdated @@ -412,6 +423,7 @@ using Observers = NSHashTable<Observer>; return; [_routePreview remove]; _routePreview = routePreview; + _routePreview.delegate = self; } - (MWMBaseRoutePreviewStatus *)baseRoutePreviewStatus @@ -461,4 +473,10 @@ using Observers = NSHashTable<Observer>; [_navigationInfoView setMapSearch]; } +#pragma mark - MWMRoutePreviewDelegate + +- (void)routePreviewDidPressDrivingOptions:(MWMRoutePreview *)routePreview { + [[MapViewController sharedController] openDrivingOptions]; +} + @end diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.h index 5ab706ce71..507c3ba149 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.h @@ -1,12 +1,28 @@ #import "MWMCircularProgressState.h" #import "MWMRouterType.h" +typedef NS_ENUM(NSInteger, MWMDrivingOptionsState) { + MWMDrivingOptionsStateNone, + MWMDrivingOptionsStateDefine, + MWMDrivingOptionsStateChange +}; + @class MWMNavigationDashboardEntity; @class MWMNavigationDashboardManager; @class MWMTaxiCollectionView; +@class MWMRoutePreview; + +@protocol MWMRoutePreviewDelegate + +- (void)routePreviewDidPressDrivingOptions:(MWMRoutePreview *)routePreview; + +@end @interface MWMRoutePreview : UIView +@property(nonatomic) MWMDrivingOptionsState drivingOptionsState; +@property(weak, nonatomic) id<MWMRoutePreviewDelegate> delegate; + - (void)addToView:(UIView *)superview; - (void)remove; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm index bb7a93f567..455acf93bb 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm @@ -13,6 +13,8 @@ #include "platform/platform.hpp" +static CGFloat const kDrivingOptionsHeight = 48; + @interface MWMRoutePreview ()<MWMCircularProgressProtocol> @property(nonatomic) BOOL isVisible; @@ -23,6 +25,8 @@ @property(weak, nonatomic) IBOutlet UIView * publicTransport; @property(weak, nonatomic) IBOutlet UIView * taxi; @property(weak, nonatomic) IBOutlet UIView * vehicle; +@property(strong, nonatomic) IBOutlet NSLayoutConstraint * drivingOptionHeightConstraint; +@property(strong, nonatomic) IBOutlet UIButton * drivingOptionsButton; @end @@ -37,6 +41,7 @@ self.translatesAutoresizingMaskIntoConstraints = NO; [self setupProgresses]; [self.backButton matchInterfaceOrientation]; + self.drivingOptionHeightConstraint.constant = -kDrivingOptionsHeight; } - (void)setupProgresses @@ -101,6 +106,10 @@ m_progresses[routerType].progress = progress; } +- (IBAction)onDrivingOptions:(UIButton *)sender { + [self.delegate routePreviewDidPressDrivingOptions:self]; +} + #pragma mark - MWMCircularProgressProtocol - (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress @@ -155,6 +164,24 @@ [self.vehicle setNeedsLayout]; } +- (void)setDrivingOptionsState:(MWMDrivingOptionsState)state { + _drivingOptionsState = state; + [self layoutIfNeeded]; + self.drivingOptionHeightConstraint.constant = + (state == MWMDrivingOptionsStateNone) ? -kDrivingOptionsHeight : 0; + [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ + [self layoutIfNeeded]; + }]; + + if (state == MWMDrivingOptionsStateDefine) { + [self.drivingOptionsButton setTitle:L(@"define_to_avoid_btn").uppercaseString + forState:UIControlStateNormal]; + } else if (state == MWMDrivingOptionsStateChange) { + [self.drivingOptionsButton setTitle:L(@"change_driving_options_btn").uppercaseString + forState:UIControlStateNormal]; + } +} + #pragma mark - Properties - (void)setIsVisible:(BOOL)isVisible diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiCollectionLayout.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiCollectionLayout.m index d6ae6b2552..4c5c383043 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiCollectionLayout.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMTaxiCollectionLayout.m @@ -9,7 +9,7 @@ - (UICollectionViewScrollDirection)scrollDirection { return UICollectionViewScrollDirectionHorizontal; } - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { - auto const size = self.collectionView.bounds.size; + CGSize size = self.collectionView.bounds.size; if (newBounds.size.height == 0) return NO; @@ -17,8 +17,8 @@ { dispatch_async(dispatch_get_main_queue(), ^{ [self invalidateLayout]; - auto cv = static_cast<MWMTaxiCollectionView *>(self.collectionView); - cv.contentOffset = {}; + MWMTaxiCollectionView * cv = (MWMTaxiCollectionView *)self.collectionView; + self.collectionView.contentOffset = CGPointZero; cv.currentPage = 0; }); } diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.m index 20386a7167..cb2ff5d2b8 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.m @@ -1,6 +1,6 @@ #import "MWMiPadRoutePreview.h" #import "MWMRouter.h" -#import "SwiftBridge.h" +#import "MWMAvailableAreaAffectDirection.h" @interface MWMRoutePreview () @@ -16,7 +16,8 @@ - (void)setupConstraints { - if (auto sv = self.superview) + UIView * sv = self.superview; + if (sv) { [self.topAnchor constraintEqualToAnchor:sv.topAnchor].active = YES; [self.bottomAnchor constraintEqualToAnchor:sv.bottomAnchor].active = YES; @@ -28,7 +29,8 @@ - (void)setIsVisible:(BOOL)isVisible { self.horizontalConstraint.active = NO; - if (auto sv = self.superview) + UIView * sv = self.superview; + if (sv) { NSLayoutXAxisAnchor * selfAnchor = isVisible ? self.leadingAnchor : self.trailingAnchor; self.horizontalConstraint = [selfAnchor constraintEqualToAnchor:sv.leadingAnchor]; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib index 65cdca2340..84ecdf7808 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPadRoutePreview.xib @@ -1,21 +1,14 @@ <?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"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" 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="Aspect ratio constraints" minToolsVersion="5.1"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> - <customFonts key="customFonts"> - <array key="HelveticaNeue.ttc"> - <string>HelveticaNeue</string> - <string>HelveticaNeue-Medium</string> - </array> - </customFonts> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMNavigationDashboardManager"> <connections> @@ -29,7 +22,7 @@ </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="u2u-Vb-2eH" customClass="MWMiPadRoutePreview" propertyAccessControl="all"> + <view contentMode="scaleToFill" id="u2u-Vb-2eH" customClass="MWMiPadRoutePreview"> <rect key="frame" x="0.0" y="0.0" width="320" height="667"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> <subviews> @@ -43,6 +36,30 @@ <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="primary"/> </userDefinedRuntimeAttributes> </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l7E-Ns-2Nn" userLabel="Options View"> + <rect key="frame" x="0.0" y="68" width="320" height="48"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Opi-yT-xIZ"> + <rect key="frame" x="54.5" y="7" width="211" height="34"/> + <state key="normal" title="DEFINE ROADS TO AVOID"/> + <connections> + <action selector="onDrivingOptions:" destination="u2u-Vb-2eH" eventType="touchUpInside" id="x2p-AW-91V"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" red="0.1215686275" green="0.59999999999999998" blue="0.32156862749999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="Opi-yT-xIZ" firstAttribute="centerX" secondItem="l7E-Ns-2Nn" secondAttribute="centerX" id="5DK-9d-8qb"/> + <constraint firstItem="Opi-yT-xIZ" firstAttribute="centerY" secondItem="l7E-Ns-2Nn" secondAttribute="centerY" id="JFn-Vg-Wby"/> + <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Opi-yT-xIZ" secondAttribute="trailing" constant="16" id="aCy-jn-U2B"/> + <constraint firstAttribute="height" constant="48" id="mCi-1V-xX4"/> + <constraint firstItem="Opi-yT-xIZ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="l7E-Ns-2Nn" secondAttribute="leading" constant="16" id="vdk-Ef-Kk1"/> + </constraints> + <viewLayoutGuide key="safeArea" id="THL-V3-3xS"/> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="secondary"/> + </userDefinedRuntimeAttributes> + </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3s2-BV-X5i" customClass="SolidTouchView"> <rect key="frame" x="0.0" y="20" width="320" height="48"/> <subviews> @@ -141,7 +158,7 @@ </userDefinedRuntimeAttributes> </view> <view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="87p-Qg-8f3" customClass="MWMBaseRoutePreviewStatus"> - <rect key="frame" x="0.0" y="104" width="320" height="180"/> + <rect key="frame" x="0.0" y="152" width="320" height="180"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QEP-6s-YTM" userLabel="Error Box"> <rect key="frame" x="0.0" y="0.0" width="320" height="64"/> @@ -203,7 +220,7 @@ <rect key="frame" x="0.0" y="64" width="320" height="68"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rXP-rM-9cx"> - <rect key="frame" x="268" y="-48" width="36" height="17"/> + <rect key="frame" x="268" y="-48.5" width="36" height="17"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="260" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JtS-om-arD"> <rect key="frame" x="0.0" y="0.0" width="36" height="17"/> @@ -368,7 +385,7 @@ </connections> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FXb-tH-ZTF" customClass="MWMTransportRoutePreviewStatus"> - <rect key="frame" x="0.0" y="104" width="320" height="80"/> + <rect key="frame" x="0.0" y="152" width="320" height="80"/> <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="tuZ-25-ltG"> <rect key="frame" x="16" y="12" width="42" height="20"/> @@ -457,12 +474,15 @@ <constraint firstItem="gcR-zj-b7P" firstAttribute="leading" secondItem="u2u-Vb-2eH" secondAttribute="leading" id="1RD-kG-W2O"/> <constraint firstAttribute="trailing" secondItem="87p-Qg-8f3" secondAttribute="trailing" id="5wh-lx-rUz"/> <constraint firstItem="3s2-BV-X5i" firstAttribute="top" secondItem="3zr-me-gbI" secondAttribute="bottom" id="6c0-tH-qlJ"/> - <constraint firstItem="87p-Qg-8f3" firstAttribute="top" secondItem="3s2-BV-X5i" secondAttribute="bottom" constant="36" id="8nt-tf-wyq"/> - <constraint firstItem="FXb-tH-ZTF" firstAttribute="top" secondItem="3s2-BV-X5i" secondAttribute="bottom" constant="36" id="9Bz-NL-px6"/> + <constraint firstItem="87p-Qg-8f3" firstAttribute="top" secondItem="l7E-Ns-2Nn" secondAttribute="bottom" constant="36" id="8nt-tf-wyq"/> + <constraint firstItem="FXb-tH-ZTF" firstAttribute="top" secondItem="l7E-Ns-2Nn" secondAttribute="bottom" constant="36" id="9Bz-NL-px6"/> <constraint firstItem="87p-Qg-8f3" firstAttribute="leading" secondItem="u2u-Vb-2eH" secondAttribute="leading" id="9bA-9R-pwq"/> + <constraint firstItem="l7E-Ns-2Nn" firstAttribute="leading" secondItem="3s2-BV-X5i" secondAttribute="leading" id="By5-zt-x6R"/> + <constraint firstItem="l7E-Ns-2Nn" firstAttribute="top" secondItem="3s2-BV-X5i" secondAttribute="bottom" id="Cgo-cU-dTy"/> <constraint firstItem="FXb-tH-ZTF" firstAttribute="leading" secondItem="u2u-Vb-2eH" secondAttribute="leading" id="Mmr-RH-iDm"/> <constraint firstAttribute="trailing" secondItem="3zr-me-gbI" secondAttribute="trailing" id="OZ2-dP-mna"/> <constraint firstAttribute="bottom" secondItem="gcR-zj-b7P" secondAttribute="bottom" id="QYs-r4-Jyl"/> + <constraint firstItem="l7E-Ns-2Nn" firstAttribute="trailing" secondItem="3s2-BV-X5i" secondAttribute="trailing" id="YI5-Hs-HZl"/> <constraint firstItem="3s2-BV-X5i" firstAttribute="leading" secondItem="u2u-Vb-2eH" secondAttribute="leading" id="e90-R4-YQR"/> <constraint firstItem="3zr-me-gbI" firstAttribute="top" secondItem="u2u-Vb-2eH" secondAttribute="top" id="hE5-50-mMA"/> <constraint firstAttribute="trailing" secondItem="3s2-BV-X5i" secondAttribute="trailing" id="lnu-7l-aPG"/> @@ -491,12 +511,14 @@ <outlet property="backButton" destination="a4n-5I-PN3" id="42W-5B-Z8i"/> <outlet property="bicycle" destination="yiM-fM-sSS" id="pMf-6J-9Gd"/> <outlet property="contentView" destination="3s2-BV-X5i" id="mp7-Qq-drU"/> + <outlet property="drivingOptionHeightConstraint" destination="Cgo-cU-dTy" id="GVj-A8-kR1"/> + <outlet property="drivingOptionsButton" destination="Opi-yT-xIZ" id="tMG-Af-HEo"/> <outlet property="pedestrian" destination="VhE-hA-Leo" id="R3O-th-Jw0"/> <outlet property="publicTransport" destination="Eu3-bT-Dom" id="XNh-uW-Kog"/> <outlet property="taxi" destination="f6i-lw-K3R" id="s0G-le-Kbz"/> <outlet property="vehicle" destination="jDl-pu-eov" id="awM-KI-2xO"/> </connections> - <point key="canvasLocation" x="448" y="574"/> + <point key="canvasLocation" x="448" y="573.46326836581716"/> </view> </objects> <resources> diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.m index 4bdb9eeb0a..7f5710fc5d 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.m @@ -1,6 +1,6 @@ #import "MWMiPhoneRoutePreview.h" +#import "MWMAvailableAreaAffectDirection.h" #import "MWMCommon.h" -#import "SwiftBridge.h" @interface MWMRoutePreview () @@ -17,7 +17,7 @@ - (void)setupConstraints { - auto sv = self.superview; + UIView * sv = self.superview; [self.leadingAnchor constraintEqualToAnchor:sv.leadingAnchor].active = YES; [self.trailingAnchor constraintEqualToAnchor:sv.trailingAnchor].active = YES; self.verticalConstraint = [self.bottomAnchor constraintEqualToAnchor:sv.topAnchor]; @@ -33,7 +33,7 @@ - (void)setIsVisible:(BOOL)isVisible { - auto sv = self.superview; + UIView * sv = self.superview; if (!sv) return; self.verticalConstraint.active = NO; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.xib b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.xib index 7f1ad6c19e..5277673c05 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.xib +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMiPhoneRoutePreview.xib @@ -1,20 +1,14 @@ <?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"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" 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="Aspect ratio constraints" minToolsVersion="5.1"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> - <customFonts key="customFonts"> - <array key="HelveticaNeue.ttc"> - <string>HelveticaNeue</string> - </array> - </customFonts> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMNavigationDashboardManager"> <connections> @@ -27,8 +21,8 @@ </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="aNH-vh-DPz" customClass="MWMiPhoneRoutePreview" propertyAccessControl="all"> - <rect key="frame" x="0.0" y="0.0" width="320" height="48"/> + <view contentMode="scaleToFill" id="aNH-vh-DPz" customClass="MWMiPhoneRoutePreview"> + <rect key="frame" x="0.0" y="0.0" width="320" height="96"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tRj-9k-ciR"> @@ -41,6 +35,29 @@ <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="primary"/> </userDefinedRuntimeAttributes> </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ib5-qh-Cmo"> + <rect key="frame" x="0.0" y="48" width="320" height="48"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZXA-Og-q2I"> + <rect key="frame" x="54.5" y="7" width="211" height="34"/> + <state key="normal" title="DEFINE ROADS TO AVOID"/> + <connections> + <action selector="onDrivingOptions:" destination="aNH-vh-DPz" eventType="touchUpInside" id="jR1-dk-nNj"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" red="0.12156862745098039" green="0.59999999999999998" blue="0.32156862745098036" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ZXA-Og-q2I" secondAttribute="trailing" constant="16" id="9bx-3j-h0U"/> + <constraint firstItem="ZXA-Og-q2I" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Ib5-qh-Cmo" secondAttribute="leading" constant="16" id="IYq-Pa-Tai"/> + <constraint firstItem="ZXA-Og-q2I" firstAttribute="centerX" secondItem="Ib5-qh-Cmo" secondAttribute="centerX" id="Uq2-QA-bWZ"/> + <constraint firstItem="ZXA-Og-q2I" firstAttribute="centerY" secondItem="Ib5-qh-Cmo" secondAttribute="centerY" id="l5z-Dg-joz"/> + <constraint firstAttribute="height" constant="48" id="l8l-Ii-g5U"/> + </constraints> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="secondary"/> + </userDefinedRuntimeAttributes> + </view> <view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WqK-Yb-PmP" customClass="SolidTouchView"> <rect key="frame" x="0.0" y="0.0" width="320" height="48"/> <subviews> @@ -154,12 +171,15 @@ </subviews> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstItem="h9I-OO-tom" firstAttribute="bottom" secondItem="WqK-Yb-PmP" secondAttribute="bottom" id="3ce-Ld-CWk"/> <constraint firstAttribute="trailing" secondItem="tRj-9k-ciR" secondAttribute="trailing" id="7jY-DP-PkA"/> + <constraint firstItem="h9I-OO-tom" firstAttribute="trailing" secondItem="Ib5-qh-Cmo" secondAttribute="trailing" id="BQK-qP-OHs"/> <constraint firstItem="WqK-Yb-PmP" firstAttribute="top" secondItem="h9I-OO-tom" secondAttribute="top" id="DDa-WE-Bpd"/> + <constraint firstItem="Ib5-qh-Cmo" firstAttribute="top" secondItem="WqK-Yb-PmP" secondAttribute="bottom" id="Oxx-fO-ZLa"/> + <constraint firstItem="Ib5-qh-Cmo" firstAttribute="leading" secondItem="h9I-OO-tom" secondAttribute="leading" id="UJ9-p8-11L"/> <constraint firstItem="tRj-9k-ciR" firstAttribute="leading" secondItem="aNH-vh-DPz" secondAttribute="leading" id="gxu-Mc-DSI"/> <constraint firstAttribute="trailing" secondItem="WqK-Yb-PmP" secondAttribute="trailing" id="hui-oa-rbV"/> <constraint firstItem="WqK-Yb-PmP" firstAttribute="leading" secondItem="aNH-vh-DPz" secondAttribute="leading" id="rQB-KG-9Kg"/> + <constraint firstItem="h9I-OO-tom" firstAttribute="bottom" secondItem="Ib5-qh-Cmo" secondAttribute="bottom" id="wQH-cW-zFs"/> <constraint firstItem="WqK-Yb-PmP" firstAttribute="top" secondItem="tRj-9k-ciR" secondAttribute="bottom" id="zoU-RG-pIh"/> </constraints> <nil key="simulatedStatusBarMetrics"/> @@ -169,14 +189,16 @@ <outlet property="backButton" destination="wpf-tw-Coz" id="33r-Ij-AuQ"/> <outlet property="bicycle" destination="FuO-c6-y9C" id="UR2-pF-Amb"/> <outlet property="contentView" destination="WqK-Yb-PmP" id="4ph-Dm-EFr"/> + <outlet property="drivingOptionHeightConstraint" destination="Oxx-fO-ZLa" id="JOa-ih-oHZ"/> + <outlet property="drivingOptionsButton" destination="ZXA-Og-q2I" id="IZf-0l-IIV"/> <outlet property="pedestrian" destination="6D3-QF-6wm" id="bdh-zx-9LW"/> <outlet property="publicTransport" destination="yIt-eq-pV5" id="yIX-eM-Hrs"/> <outlet property="taxi" destination="15Q-ZN-NzE" id="RaD-7N-ZE2"/> <outlet property="vehicle" destination="cZF-Ha-2tB" id="QP3-tU-nfO"/> </connections> - <point key="canvasLocation" x="448" y="341"/> + <point key="canvasLocation" x="448" y="364.7676161919041"/> </view> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hIE-BJ-nFm" customClass="MWMBaseRoutePreviewStatus" propertyAccessControl="all"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hIE-BJ-nFm" customClass="MWMBaseRoutePreviewStatus"> <rect key="frame" x="0.0" y="0.0" width="320" height="152"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="o7e-Ce-Flg"> @@ -441,7 +463,7 @@ </connections> <point key="canvasLocation" x="448" y="521"/> </view> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iWi-pM-AJF" customClass="MWMTransportRoutePreviewStatus" propertyAccessControl="all"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iWi-pM-AJF" customClass="MWMTransportRoutePreviewStatus"> <rect key="frame" x="0.0" y="0.0" width="320" height="80"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uA3-5h-DWb"> diff --git a/iphone/Maps/Classes/MWMSegue.mm b/iphone/Maps/Classes/MWMSegue.m index 6e08bea8a8..6e08bea8a8 100644 --- a/iphone/Maps/Classes/MWMSegue.mm +++ b/iphone/Maps/Classes/MWMSegue.m diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 4dcf5be546..0bbabab6f3 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -30,6 +30,7 @@ - (void)openCatalogAnimated:(BOOL)animated; - (void)openCatalogDeeplink:(NSURL * _Nullable)deeplinkUrl animated:(BOOL)animated; - (void)searchText:(NSString *)text; +- (void)openDrivingOptions; - (void)showRemoveAds; - (void)setPlacePageTopBound:(CGFloat)bound; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 9cccc16a3d..df30ed0f9e 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -253,6 +253,7 @@ BOOL gIsFirstMyPositionMode = YES; GetFramework().InvalidateRendering(); [self showViralAlertIfNeeded]; [self checkAuthorization]; + [MWMRouter updateRoute]; } - (void)viewDidLoad @@ -509,6 +510,13 @@ BOOL gIsFirstMyPositionMode = YES; [self.controlsManager searchText:text forInputLocale:[[AppInfo sharedInfo] languageId]]; } +- (void)openDrivingOptions +{ + UIStoryboard *sb = [UIStoryboard instance:MWMStoryboardDrivingOptions];// [UIStoryboard storyboardWithName:@"DrivingOptions" bundle:nil]; + UIViewController * vc = [sb instantiateInitialViewController]; + [self.navigationController pushViewController:vc animated:YES]; +} + - (void)showRemoveAds { auto removeAds = [[RemoveAdsViewController alloc] init]; diff --git a/iphone/Maps/Core/Routing/MWMRouter.h b/iphone/Maps/Core/Routing/MWMRouter.h index 793a05e3f8..4684f778b3 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.h +++ b/iphone/Maps/Core/Routing/MWMRouter.h @@ -1,6 +1,13 @@ #import "MWMRoutePoint.h" #import "MWMRouterType.h" +typedef NS_ENUM(NSInteger, MWMRoadType) { + MWMRoadTypeToll, + MWMRoadTypeDirty, + MWMRoadTypeFerry, + MWMRoadTypeMotorway +}; + typedef void (^MWMImageHeightBlock)(UIImage *, NSString *); @interface MWMRouter : NSObject @@ -54,6 +61,10 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *); + (void)restoreRouteIfNeeded; + (BOOL)hasSavedRoute; ++ (void)updateRoute; ++ (BOOL)hasActiveDrivingOptions; ++ (void)avoidRoadTypeAndRebuild:(MWMRoadType)type; + @end @interface MWMRouter (RouteManager) diff --git a/iphone/Maps/Core/Routing/MWMRouter.mm b/iphone/Maps/Core/Routing/MWMRouter.mm index 362d0dff1e..afa950b45a 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.mm +++ b/iphone/Maps/Core/Routing/MWMRouter.mm @@ -38,6 +38,7 @@ using namespace routing; @property(nonatomic) uint32_t routeManagerTransactionId; @property(nonatomic) BOOL canAutoAddLastLocation; @property(nonatomic) BOOL isAPICall; +@property(strong, nonatomic) MWMRoutingOptions * routingOptions; + (MWMRouter *)router; @@ -172,6 +173,7 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) + (BOOL)isRouteFinished { return GetFramework().GetRoutingManager().IsRouteFinished(); } + (BOOL)isRouteRebuildingOnly { return GetFramework().GetRoutingManager().IsRouteRebuildingOnly(); } + (BOOL)isOnRoute { return GetFramework().GetRoutingManager().IsRoutingFollowing(); } ++ (BOOL)IsRouteValid { return GetFramework().GetRoutingManager().IsRouteValid(); } + (NSArray<MWMRoutePoint *> *)points { NSMutableArray<MWMRoutePoint *> * points = [@[] mutableCopy]; @@ -227,6 +229,7 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) [MWMLocationManager addObserver:self]; [MWMFrameworkListener addObserver:self]; _canAutoAddLastLocation = YES; + _routingOptions = [MWMRoutingOptions new]; } return self; } @@ -620,6 +623,23 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) #pragma mark - MWMFrameworkRouteBuilderObserver +- (void)onRouteReady:(BOOL)hasWarnings +{ + self.routingOptions = [MWMRoutingOptions new]; + GetFramework().DeactivateMapSelection(true); + + auto startPoint = [MWMRouter startPoint]; + if (!startPoint || !startPoint.isMyPosition) + { + dispatch_async(dispatch_get_main_queue(), ^{ + [MWMRouter disableFollowMode]; + }); + } + + [[MWMMapViewControlsManager manager] onRouteReady:hasWarnings]; + [self updateFollowingInfo]; +} + - (void)processRouteBuilderEvent:(routing::RouterResultCode)code countries:(storage::CountriesVec const &)absentCountries { @@ -627,22 +647,11 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) switch (code) { case routing::RouterResultCode::NoError: + [self onRouteReady:NO]; + break; case routing::RouterResultCode::HasWarnings: - { - GetFramework().DeactivateMapSelection(true); - - auto startPoint = [MWMRouter startPoint]; - if (!startPoint || !startPoint.isMyPosition) - { - dispatch_async(dispatch_get_main_queue(), ^{ - [MWMRouter disableFollowMode]; - }); - } - - [mapViewControlsManager onRouteReady]; - [self updateFollowingInfo]; + [self onRouteReady:YES]; break; - } case routing::RouterResultCode::RouteFileNotExist: case routing::RouterResultCode::InconsistentMWMandRoute: case routing::RouterResultCode::NeedMoreMaps: @@ -650,6 +659,7 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) case routing::RouterResultCode::RouteNotFound: if ([MWMRouter isTaxi]) return; + self.routingOptions = [MWMRoutingOptions new]; [self presentDownloaderAlert:code countries:absentCountries]; [[MWMNavigationDashboardManager manager] onRouteError:L(@"routing_planning_error")]; break; @@ -721,6 +731,16 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) [MWMRouter rebuildWithBestRouter:NO]; }]; } + else if ([MWMRouter hasActiveDrivingOptions]) + { + [activeAlertController presentDefaultAlertWithTitle:L(@"unable_to_calc_alert_title") + message:L(@"unable_to_calc_alert_subtitle") + rightButtonTitle:L(@"settings") + leftButtonTitle:L(@"cancel") + rightButtonAction:^{ + [[MapViewController sharedController] openDrivingOptions]; + }]; + } else { [activeAlertController presentAlert:code]; @@ -763,4 +783,36 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) return GetFramework().GetRoutingManager().HasSavedRoutePoints(); } ++ (void)updateRoute { + MWMRoutingOptions *newOptions = [MWMRoutingOptions new]; + if ((self.isRouteBuilt || !self.IsRouteValid) + && ![newOptions isEqual:[self router].routingOptions]) { + [self rebuildWithBestRouter:YES]; + } +} + ++ (BOOL)hasActiveDrivingOptions { + return [MWMRoutingOptions new].hasOptions; +} + ++ (void)avoidRoadTypeAndRebuild:(MWMRoadType)type { + MWMRoutingOptions *options = [MWMRoutingOptions new]; + switch(type) { + case MWMRoadTypeToll: + options.avoidToll = YES; + break; + case MWMRoadTypeDirty: + options.avoidDirty = YES; + break; + case MWMRoadTypeFerry: + options.avoidFerry = YES; + break; + case MWMRoadTypeMotorway: + options.avoidMotorway = YES; + break; + } + [options save]; + [self rebuildWithBestRouter:YES]; +} + @end diff --git a/iphone/Maps/Core/Settings/MWMRoutingOptions.h b/iphone/Maps/Core/Settings/MWMRoutingOptions.h new file mode 100644 index 0000000000..664ff976ef --- /dev/null +++ b/iphone/Maps/Core/Settings/MWMRoutingOptions.h @@ -0,0 +1,17 @@ +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface MWMRoutingOptions : NSObject + +@property(nonatomic) BOOL avoidToll; +@property(nonatomic) BOOL avoidDirty; +@property(nonatomic) BOOL avoidFerry; +@property(nonatomic) BOOL avoidMotorway; +@property(nonatomic, readonly) BOOL hasOptions; + +- (void)save; + +@end + +NS_ASSUME_NONNULL_END diff --git a/iphone/Maps/Core/Settings/MWMRoutingOptions.mm b/iphone/Maps/Core/Settings/MWMRoutingOptions.mm new file mode 100644 index 0000000000..2906b6cb01 --- /dev/null +++ b/iphone/Maps/Core/Settings/MWMRoutingOptions.mm @@ -0,0 +1,79 @@ +#import "MWMRoutingOptions.h" + +#include "routing/routing_options.hpp" + +@interface MWMRoutingOptions() { + routing::RoutingOptions _options; +} + +@end + +@implementation MWMRoutingOptions + +- (instancetype)init { + self = [super init]; + if (self) { + _options = routing::RoutingOptions::LoadCarOptionsFromSettings(); + } + + return self; +} + +- (BOOL)avoidToll { + return _options.Has(routing::RoutingOptions::Road::Toll); +} + +- (void)setAvoidToll:(BOOL)avoid { + [self setOption:(routing::RoutingOptions::Road::Toll) enabled:avoid]; +} + +- (BOOL)avoidDirty { + return _options.Has(routing::RoutingOptions::Road::Dirty); +} + +- (void)setAvoidDirty:(BOOL)avoid { + [self setOption:(routing::RoutingOptions::Road::Dirty) enabled:avoid]; +} + +- (BOOL)avoidFerry { + return _options.Has(routing::RoutingOptions::Road::Ferry); +} + +- (void)setAvoidFerry:(BOOL)avoid { + [self setOption:(routing::RoutingOptions::Road::Ferry) enabled:avoid]; +} + +- (BOOL)avoidMotorway { + return _options.Has(routing::RoutingOptions::Road::Motorway); +} + +- (void)setAvoidMotorway:(BOOL)avoid { + [self setOption:(routing::RoutingOptions::Road::Motorway) enabled:avoid]; +} + +- (BOOL)hasOptions { + return self.avoidToll || self.avoidDirty || self.avoidFerry || self.avoidMotorway; +} + +- (void)save { + routing::RoutingOptions::SaveCarOptionsToSettings(_options); +} + +- (void)setOption:(routing::RoutingOptions::Road)option enabled:(BOOL)enabled { + if (enabled) { + _options.Add(option); + } else { + _options.Remove(option); + } +} + +- (BOOL)isEqual:(id)object { + if (![object isMemberOfClass:self.class]) { + return NO; + } + MWMRoutingOptions *another = (MWMRoutingOptions *)object; + return another.avoidToll == self.avoidToll && another.avoidDirty == self.avoidDirty && + another.avoidFerry == self.avoidFerry && another.avoidMotorway == self.avoidMotorway; +} + +@end diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/Contents.json new file mode 100644 index 0000000000..6012d12116 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icAvoidTolls.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +}
\ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/icAvoidTolls.pdf b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/icAvoidTolls.pdf Binary files differnew file mode 100644 index 0000000000..40229ca90b --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_dirty.imageset/icAvoidTolls.pdf diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/Contents.json new file mode 100644 index 0000000000..b0055dab1f --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icAvoidTolls-2.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +}
\ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/icAvoidTolls-2.pdf b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/icAvoidTolls-2.pdf Binary files differnew file mode 100644 index 0000000000..538ad769aa --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_ferry.imageset/icAvoidTolls-2.pdf diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/Contents.json b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/Contents.json new file mode 100644 index 0000000000..cb8547141e --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icAvoidTolls-3.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +}
\ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/icAvoidTolls-3.pdf b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/icAvoidTolls-3.pdf Binary files differnew file mode 100644 index 0000000000..9f3684f453 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Place Page/ic_avoid_tolls.imageset/icAvoidTolls-3.pdf diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 7ad52ded72..c0c1e3896a 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -216,8 +216,8 @@ 34AB660E1FC5AA320078E451 /* NavigationControlView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34AB65CD1FC5AA320078E451 /* NavigationControlView.xib */; }; 34AB66111FC5AA320078E451 /* NavigationTurnsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65CE1FC5AA320078E451 /* NavigationTurnsView.swift */; }; 34AB66141FC5AA320078E451 /* MWMNavigationInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34AB65D01FC5AA320078E451 /* MWMNavigationInfoView.xib */; }; - 34AB66171FC5AA320078E451 /* MWMiPhoneRoutePreview.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.mm */; }; - 34AB661A1FC5AA330078E451 /* MWMTaxiCollectionLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.mm */; }; + 34AB66171FC5AA320078E451 /* MWMiPhoneRoutePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.m */; }; + 34AB661A1FC5AA330078E451 /* MWMTaxiCollectionLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.m */; }; 34AB661D1FC5AA330078E451 /* MWMTaxiPreviewDataSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D41FC5AA320078E451 /* MWMTaxiPreviewDataSource.mm */; }; 34AB66201FC5AA330078E451 /* RouteStartButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65D51FC5AA320078E451 /* RouteStartButton.swift */; }; 34AB66231FC5AA330078E451 /* MWMiPadRoutePreview.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34AB65D61FC5AA320078E451 /* MWMiPadRoutePreview.xib */; }; @@ -236,7 +236,7 @@ 34AB664A1FC5AA330078E451 /* RouteManageriPadPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65E51FC5AA320078E451 /* RouteManageriPadPresentationController.swift */; }; 34AB664D1FC5AA330078E451 /* RouteManagerFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65E61FC5AA320078E451 /* RouteManagerFooterView.swift */; }; 34AB66501FC5AA330078E451 /* RoutePreviewTaxiCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65E81FC5AA320078E451 /* RoutePreviewTaxiCell.swift */; }; - 34AB66531FC5AA330078E451 /* MWMiPadRoutePreview.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.mm */; }; + 34AB66531FC5AA330078E451 /* MWMiPadRoutePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.m */; }; 34AB66561FC5AA330078E451 /* TransportTransitPedestrian.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65EE1FC5AA320078E451 /* TransportTransitPedestrian.swift */; }; 34AB66591FC5AA330078E451 /* TransportTransitFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AB65EF1FC5AA320078E451 /* TransportTransitFlowLayout.swift */; }; 34AB665C1FC5AA330078E451 /* TransportTransitIntermediatePoint.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34AB65F01FC5AA320078E451 /* TransportTransitIntermediatePoint.xib */; }; @@ -322,7 +322,7 @@ 34E776141F14B17F003040B3 /* AvailableArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776121F14B17F003040B3 /* AvailableArea.swift */; }; 34E7761F1F14DB48003040B3 /* PlacePageArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E7761D1F14DB48003040B3 /* PlacePageArea.swift */; }; 34E776331F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */; }; - 34EF94291C05A6F30050B714 /* MWMSegue.mm in Sources */ = {isa = PBXBuildFile; fileRef = F607C18D1C047FDC00B53A87 /* MWMSegue.mm */; }; + 34EF94291C05A6F30050B714 /* MWMSegue.m in Sources */ = {isa = PBXBuildFile; fileRef = F607C18D1C047FDC00B53A87 /* MWMSegue.m */; }; 34F1ADD31F6BC09E001CE79D /* PPPReview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F1ADD11F6BC09E001CE79D /* PPPReview.swift */; }; 34F4072C1E9E1AFF00E57AC0 /* Banner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F4071D1E9E1AFF00E57AC0 /* Banner.swift */; }; 34F4072F1E9E1AFF00E57AC0 /* BannersCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F4071E1E9E1AFF00E57AC0 /* BannersCache.swift */; }; @@ -391,6 +391,7 @@ 4767CDC120B477BA00BD8166 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4767CDC020B477BA00BD8166 /* WelcomeViewController.swift */; }; 47699A0821F08E37009E6585 /* NSDate+TimeDistance.m in Sources */ = {isa = PBXBuildFile; fileRef = 47699A0721F08E37009E6585 /* NSDate+TimeDistance.m */; }; 47699A0A21F0C4C8009E6585 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47699A0921F0C4C8009E6585 /* NotificationManager.swift */; }; + 477219052243E79500E5B227 /* DrivingOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477219042243E79500E5B227 /* DrivingOptionsViewController.swift */; }; 477D7AC7218F1515007EE2CB /* IPaidRoutePurchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477D7AC6218F1515007EE2CB /* IPaidRoutePurchase.swift */; }; 47800D1D20BEEE2E00072F42 /* TermsOfUseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47800D1C20BEEE2E00072F42 /* TermsOfUseController.swift */; }; 47800D2520C05E3200072F42 /* libFlurry_8.6.1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 47800D2420C05E3200072F42 /* libFlurry_8.6.1.a */; }; @@ -414,6 +415,8 @@ 47C7F9732191E15A00C2760C /* InAppBilling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C7F9722191E15A00C2760C /* InAppBilling.swift */; }; 47C7F97521930F5300C2760C /* IInAppBilling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C7F97421930F5300C2760C /* IInAppBilling.swift */; }; 47D0026721999DA900F651A2 /* PendingTransactionsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47D0026621999DA900F651A2 /* PendingTransactionsHandler.swift */; }; + 47DF72B922520CE20004AB10 /* MWMRoutingOptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 474902D9224A54EC008D71E0 /* MWMRoutingOptions.mm */; }; + 47DF72BB225356BF0004AB10 /* DrivingOptions.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 47DF72BA225356BF0004AB10 /* DrivingOptions.storyboard */; }; 47E3C72121108E9F008B3B27 /* BookmarksLoadedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C71F21108E9F008B3B27 /* BookmarksLoadedViewController.swift */; }; 47E3C72221108E9F008B3B27 /* BookmarksLoadedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 47E3C72021108E9F008B3B27 /* BookmarksLoadedViewController.xib */; }; 47E3C7252111E41B008B3B27 /* DimmedModalPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7242111E41B008B3B27 /* DimmedModalPresentationController.swift */; }; @@ -1126,8 +1129,8 @@ 34AB65CE1FC5AA320078E451 /* NavigationTurnsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationTurnsView.swift; sourceTree = "<group>"; }; 34AB65CF1FC5AA320078E451 /* MWMNavigationInfoView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMNavigationInfoView.h; sourceTree = "<group>"; }; 34AB65D01FC5AA320078E451 /* MWMNavigationInfoView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMNavigationInfoView.xib; sourceTree = "<group>"; }; - 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMiPhoneRoutePreview.mm; sourceTree = "<group>"; }; - 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMTaxiCollectionLayout.mm; sourceTree = "<group>"; }; + 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMiPhoneRoutePreview.m; sourceTree = "<group>"; }; + 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMTaxiCollectionLayout.m; sourceTree = "<group>"; }; 34AB65D41FC5AA320078E451 /* MWMTaxiPreviewDataSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMTaxiPreviewDataSource.mm; sourceTree = "<group>"; }; 34AB65D51FC5AA320078E451 /* RouteStartButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteStartButton.swift; sourceTree = "<group>"; }; 34AB65D61FC5AA320078E451 /* MWMiPadRoutePreview.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMiPadRoutePreview.xib; sourceTree = "<group>"; }; @@ -1148,7 +1151,7 @@ 34AB65E61FC5AA320078E451 /* RouteManagerFooterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteManagerFooterView.swift; sourceTree = "<group>"; }; 34AB65E71FC5AA320078E451 /* MWMRoutePreviewTaxiCellType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRoutePreviewTaxiCellType.h; sourceTree = "<group>"; }; 34AB65E81FC5AA320078E451 /* RoutePreviewTaxiCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoutePreviewTaxiCell.swift; sourceTree = "<group>"; }; - 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMiPadRoutePreview.mm; sourceTree = "<group>"; }; + 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMiPadRoutePreview.m; sourceTree = "<group>"; }; 34AB65EA1FC5AA320078E451 /* MWMiPadRoutePreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMiPadRoutePreview.h; sourceTree = "<group>"; }; 34AB65EB1FC5AA320078E451 /* MWMTaxiPreviewDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMTaxiPreviewDataSource.h; sourceTree = "<group>"; }; 34AB65EE1FC5AA320078E451 /* TransportTransitPedestrian.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransportTransitPedestrian.swift; sourceTree = "<group>"; }; @@ -1410,6 +1413,8 @@ 473464A5218B0BC000D6AF5B /* MWMPurchaseValidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMPurchaseValidation.h; sourceTree = "<group>"; }; 473464A6218B0BC000D6AF5B /* MWMPurchaseValidation.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPurchaseValidation.mm; sourceTree = "<group>"; }; 473CBF9A2164DD470059BD54 /* SettingsTableViewSelectableProgressCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTableViewSelectableProgressCell.swift; sourceTree = "<group>"; }; + 474902D8224A54EC008D71E0 /* MWMRoutingOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMRoutingOptions.h; sourceTree = "<group>"; }; + 474902D9224A54EC008D71E0 /* MWMRoutingOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMRoutingOptions.mm; sourceTree = "<group>"; }; 474AC76A2139E4F2002F9BF9 /* RemoveAdsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAdsViewController.swift; sourceTree = "<group>"; }; 474AC76B2139E4F2002F9BF9 /* RemoveAdsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RemoveAdsViewController.xib; sourceTree = "<group>"; }; 474C9F59213FF75800369009 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; @@ -1423,6 +1428,7 @@ 47699A0621F08E37009E6585 /* NSDate+TimeDistance.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDate+TimeDistance.h"; sourceTree = "<group>"; }; 47699A0721F08E37009E6585 /* NSDate+TimeDistance.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDate+TimeDistance.m"; sourceTree = "<group>"; }; 47699A0921F0C4C8009E6585 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; }; + 477219042243E79500E5B227 /* DrivingOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrivingOptionsViewController.swift; sourceTree = "<group>"; }; 477D7AC6218F1515007EE2CB /* IPaidRoutePurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPaidRoutePurchase.swift; sourceTree = "<group>"; }; 47800D1C20BEEE2E00072F42 /* TermsOfUseController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfUseController.swift; sourceTree = "<group>"; }; 47800D2420C05E3200072F42 /* libFlurry_8.6.1.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry_8.6.1.a; sourceTree = "<group>"; }; @@ -1456,6 +1462,7 @@ 47C7F97421930F5300C2760C /* IInAppBilling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IInAppBilling.swift; sourceTree = "<group>"; }; 47C7F976219310D800C2760C /* IMWMPurchaseValidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IMWMPurchaseValidation.h; sourceTree = "<group>"; }; 47D0026621999DA900F651A2 /* PendingTransactionsHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PendingTransactionsHandler.swift; sourceTree = "<group>"; }; + 47DF72BA225356BF0004AB10 /* DrivingOptions.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DrivingOptions.storyboard; sourceTree = "<group>"; }; 47E3C71F21108E9F008B3B27 /* BookmarksLoadedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksLoadedViewController.swift; sourceTree = "<group>"; }; 47E3C72021108E9F008B3B27 /* BookmarksLoadedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksLoadedViewController.xib; sourceTree = "<group>"; }; 47E3C7242111E41B008B3B27 /* DimmedModalPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DimmedModalPresentationController.swift; sourceTree = "<group>"; }; @@ -1613,7 +1620,7 @@ F607C1831C032A8800B53A87 /* resources-hdpi_clear */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-hdpi_clear"; path = "../../data/resources-hdpi_clear"; sourceTree = "<group>"; }; F607C1841C032A8800B53A87 /* resources-hdpi_dark */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-hdpi_dark"; path = "../../data/resources-hdpi_dark"; sourceTree = "<group>"; }; F607C18C1C047FDC00B53A87 /* MWMSegue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSegue.h; sourceTree = "<group>"; }; - F607C18D1C047FDC00B53A87 /* MWMSegue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSegue.mm; sourceTree = "<group>"; }; + F607C18D1C047FDC00B53A87 /* MWMSegue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSegue.m; sourceTree = "<group>"; }; F60C8BED1FCED15900DCF5FB /* DiscoverySearchCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DiscoverySearchCell.xib; sourceTree = "<group>"; }; F61579321AC2CE9A0032D8E9 /* MWMRateAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRateAlert.h; sourceTree = "<group>"; }; F61579331AC2CE9A0032D8E9 /* MWMRateAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMRateAlert.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -2445,6 +2452,8 @@ 340475401E081A4600C92850 /* MWMSettings.h */, 340475411E081A4600C92850 /* MWMSettings.mm */, 34FB47581E3B928D00D94ED8 /* MWMCoreUnits.h */, + 474902D8224A54EC008D71E0 /* MWMRoutingOptions.h */, + 474902D9224A54EC008D71E0 /* MWMRoutingOptions.mm */, ); path = Settings; sourceTree = "<group>"; @@ -3055,16 +3064,16 @@ isa = PBXGroup; children = ( 34AB65EA1FC5AA320078E451 /* MWMiPadRoutePreview.h */, - 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.mm */, + 34AB65E91FC5AA320078E451 /* MWMiPadRoutePreview.m */, 34AB65D61FC5AA320078E451 /* MWMiPadRoutePreview.xib */, 34AB65FC1FC5AA320078E451 /* MWMiPhoneRoutePreview.h */, - 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.mm */, + 34AB65D21FC5AA320078E451 /* MWMiPhoneRoutePreview.m */, 34AB65FE1FC5AA320078E451 /* MWMiPhoneRoutePreview.xib */, 34AB65FF1FC5AA320078E451 /* MWMRoutePreview.h */, 34AB65FD1FC5AA320078E451 /* MWMRoutePreview.mm */, 34AB65E71FC5AA320078E451 /* MWMRoutePreviewTaxiCellType.h */, 34AB65FB1FC5AA320078E451 /* MWMTaxiCollectionLayout.h */, - 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.mm */, + 34AB65D31FC5AA320078E451 /* MWMTaxiCollectionLayout.m */, 34AB65EB1FC5AA320078E451 /* MWMTaxiPreviewDataSource.h */, 34AB65D41FC5AA320078E451 /* MWMTaxiPreviewDataSource.mm */, 34AB65D71FC5AA320078E451 /* RouteManager */, @@ -3516,7 +3525,7 @@ isa = PBXGroup; children = ( F607C18C1C047FDC00B53A87 /* MWMSegue.h */, - F607C18D1C047FDC00B53A87 /* MWMSegue.mm */, + F607C18D1C047FDC00B53A87 /* MWMSegue.m */, ); name = Segue; sourceTree = "<group>"; @@ -4290,6 +4299,8 @@ F6E2FD4D1E097BA00083EBEC /* MWMUnitsController.mm */, 3DEE1AE921F72CD300054A91 /* MWMPowerManagmentViewController.h */, 3DEE1AEA21F72CD300054A91 /* MWMPowerManagmentViewController.mm */, + 477219042243E79500E5B227 /* DrivingOptionsViewController.swift */, + 47DF72BA225356BF0004AB10 /* DrivingOptions.storyboard */, ); path = Settings; sourceTree = "<group>"; @@ -4693,6 +4704,7 @@ 34AB66711FC5AA330078E451 /* TransportTransitTrain.xib in Resources */, 33046836219C5A4E0041F3A8 /* CategorySettings.storyboard in Resources */, 34BBD6471F82649D0070CA50 /* GoogleSignIn.bundle in Resources */, + 47DF72BB225356BF0004AB10 /* DrivingOptions.storyboard in Resources */, F6E2FE851E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */, F6E2FE941E097BA00083EBEC /* PlacePageTaxiCell.xib in Resources */, 47289E5B2212DFFF002ABFC0 /* EditOnWebAlertViewController.xib in Resources */, @@ -4940,6 +4952,7 @@ 34AB666B1FC5AA330078E451 /* TransportTransitCell.swift in Sources */, 3404163C1E7BDFE000E2B6D6 /* PhotosViewController.swift in Sources */, 34AB66471FC5AA330078E451 /* RouteManagerTableView.swift in Sources */, + 47DF72B922520CE20004AB10 /* MWMRoutingOptions.mm in Sources */, F6E2FE611E097BA00083EBEC /* MWMBookmarkCell.mm in Sources */, F6E2FEA31E097BA00083EBEC /* MWMPPView.mm in Sources */, 3D15ACEE2155117000F725D5 /* MWMObjectsCategorySelectorDataSource.mm in Sources */, @@ -5070,7 +5083,7 @@ F6E2FD561E097BA00083EBEC /* MWMMapDownloaderButtonTableViewCell.mm in Sources */, 3462258F1DDC5DBA001E8752 /* MWMSearchNoResultsAlert.mm in Sources */, 470F5A7D2189BB2F00754295 /* PaidRoutePurchase.swift in Sources */, - 34AB66171FC5AA320078E451 /* MWMiPhoneRoutePreview.mm in Sources */, + 34AB66171FC5AA320078E451 /* MWMiPhoneRoutePreview.m in Sources */, 6741A9E71BF340DE002C974C /* MWMCircularProgressView.mm in Sources */, 34AC8FDB1EFC07FE00E7F910 /* UILabel+NumberOfVisibleLines.swift in Sources */, 4767CD9F20AAD48A00BD8166 /* Checkmark.swift in Sources */, @@ -5130,6 +5143,7 @@ F6E2FF361E097BA00083EBEC /* MWMSearchSuggestionCell.mm in Sources */, F6E2FE3A1E097BA00083EBEC /* MWMMigrationView.mm in Sources */, 3472B5CF200F4A2B00DC6CD5 /* BackgroundFetchTask.swift in Sources */, + 477219052243E79500E5B227 /* DrivingOptionsViewController.swift in Sources */, F6E2FF3C1E097BA00083EBEC /* MWMSearchTableView.mm in Sources */, F6E2FF661E097BA00083EBEC /* MWMTTSSettingsViewController.mm in Sources */, 3472B5EB200F8CFF00DC6CD5 /* MWMUGCHelper.mm in Sources */, @@ -5234,7 +5248,7 @@ F63AF5061EA6162400A1DB98 /* FilterTypeCell.swift in Sources */, 347752881F725002000D46A3 /* UGCAddReviewRatingCell.swift in Sources */, 47E3C7332111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift in Sources */, - 34AB661A1FC5AA330078E451 /* MWMTaxiCollectionLayout.mm in Sources */, + 34AB661A1FC5AA330078E451 /* MWMTaxiCollectionLayout.m in Sources */, 345C2F8A1F86361B009DB8B4 /* MWMUGCViewModel.mm in Sources */, 33F8BA4E2199AB9500ECA8EE /* TagsDataSource.swift in Sources */, 47F67D1521CAB21B0069754E /* MWMImageCoder.m in Sources */, @@ -5278,7 +5292,7 @@ 33B19C65218B46C100B323A7 /* SharingTagsViewController.swift in Sources */, 3404754D1E081A4600C92850 /* MWMKeyboard.mm in Sources */, 3457C4261F680F1900028233 /* String+BoundingRect.swift in Sources */, - 34EF94291C05A6F30050B714 /* MWMSegue.mm in Sources */, + 34EF94291C05A6F30050B714 /* MWMSegue.m in Sources */, 3430291D1F87BF4400D0A07C /* ReviewsViewController.swift in Sources */, F6E2FE731E097BA00083EBEC /* MWMOpeningHours.mm in Sources */, 47E3C7312111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift in Sources */, @@ -5324,7 +5338,7 @@ 349FC54B1F680DAE00968C9F /* ExpandableReviewSettings.swift in Sources */, F6E2FE0A1E097BA00083EBEC /* MWMOpeningHoursDeleteScheduleTableViewCell.mm in Sources */, 3454D7DA1E07F045004AF2AD /* UILabel+RuntimeAttributes.mm in Sources */, - 34AB66531FC5AA330078E451 /* MWMiPadRoutePreview.mm in Sources */, + 34AB66531FC5AA330078E451 /* MWMiPadRoutePreview.m in Sources */, 3454D7E31E07F045004AF2AD /* UITextView+RuntimeAttributes.mm in Sources */, F6A2184A1CA3F26800BE2CC6 /* MWMEditorViralActivityItem.mm in Sources */, F6E2FED61E097BA00083EBEC /* MWMSearchChangeModeView.mm in Sources */, diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index 9c0f872c32..9cf9107be4 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -139,7 +139,7 @@ using NewSectionsAreReady = void (^)(NSRange const & range, MWMPlacePageData * d @protocol MWMBanner; /// ViewModel for place page. -@interface MWMPlacePageData : NSObject<MWMActionBarSharedData> +@interface MWMPlacePageData : NSObject @property(copy, nonatomic) MWMVoidBlock refreshPreviewCallback; @property(copy, nonatomic) place_page::NewSectionsAreReady sectionsAreReadyCallback; @@ -252,6 +252,7 @@ using NewSectionsAreReady = void (^)(NSRange const & range, MWMPlacePageData * d - (BOOL)isHTMLDescription; - (BOOL)isMyPosition; - (BOOL)isRoutePoint; +- (RoadWarningMarkType)roadType; - (BOOL)isPreviewExtended; - (BOOL)isPartnerAppInstalled; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index cf3f5d473e..839d2df610 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -792,6 +792,7 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; - (BOOL)isMyPosition { return m_info.IsMyPosition(); } - (BOOL)isHTMLDescription { return strings::IsHTML(GetPreferredBookmarkStr(m_info.GetBookmarkData().m_description)); } - (BOOL)isRoutePoint { return m_info.IsRoutePoint(); } +- (RoadWarningMarkType)roadType { return m_info.GetRoadType(); } - (BOOL)isPreviewExtended { return m_info.IsPreviewExtended(); } - (BOOL)isPartnerAppInstalled { diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 123b422c8e..28562bd149 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -543,6 +543,30 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page: [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; } +- (void)avoidDirty { + [MWMRouter avoidRoadTypeAndRebuild:MWMRoadTypeDirty]; + [self closePlacePage]; +} + + +- (void)avoidFerry { + [MWMRouter avoidRoadTypeAndRebuild:MWMRoadTypeFerry]; + [self closePlacePage]; +} + + +- (void)avoidMotorway { + [MWMRouter avoidRoadTypeAndRebuild:MWMRoadTypeMotorway]; + [self closePlacePage]; +} + + +- (void)avoidToll { + [MWMRouter avoidRoadTypeAndRebuild:MWMRoadTypeToll]; + [self closePlacePage]; +} + + - (void)showPhotoAtIndex:(NSInteger)index referenceView:(UIView *)referenceView referenceViewWhenDismissingHandler: diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h index 4f9ec0bea2..f790cc32cf 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageProtocol.h @@ -20,9 +20,11 @@ - (void)searchBookingHotels; - (void)openPartner; - -- (void)apiBack; - (void)downloadSelectedArea; +- (void)avoidToll; +- (void)avoidDirty; +- (void)avoidFerry; +- (void)avoidMotorway; @end diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h index b4e77e4c34..e48fd0d29e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.h @@ -12,7 +12,11 @@ enum class EButton // Required button's order RouteFrom, RouteRemoveStop, RouteTo, - Share + Share, + AvoidToll, + AvoidDirty, + AvoidFerry, + AvoidMotorway }; NSString * titleForButton(EButton type, int partnerIndex, BOOL isSelected); diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm index 3784399f3a..f7f9ab20b5 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMActionBarButton.mm @@ -27,6 +27,10 @@ NSString * titleForButton(EButton type, int partnerIndex, BOOL isSelected) case EButton::More: return L(@"placepage_more_button"); case EButton::RouteAddStop: return L(@"placepage_add_stop"); case EButton::RouteRemoveStop: return L(@"placepage_remove_stop"); + case EButton::AvoidToll: return L(@"avoid_tolls"); + case EButton::AvoidDirty: return L(@"avoid_unpaved"); + case EButton::AvoidFerry: return L(@"avoid_ferry"); + case EButton::AvoidMotorway: return L(@"avoid_motorways"); case EButton::Partner: return titleForPartner(partnerIndex); } } @@ -156,6 +160,22 @@ UIColor * backgroundColorForPartner(int partnerIndex) self.label.textColor = textColorForPartner(self.partnerIndex); self.backgroundColor = backgroundColorForPartner(self.partnerIndex); break; + case EButton::AvoidToll: + [self.button setImage:[UIImage imageNamed:@"ic_avoid_tolls"] + forState:UIControlStateNormal]; + break; + case EButton::AvoidDirty: + [self.button setImage:[UIImage imageNamed:@"ic_avoid_dirty"] + forState:UIControlStateNormal]; + break; + case EButton::AvoidFerry: + [self.button setImage:[UIImage imageNamed:@"ic_avoid_ferry"] + forState:UIControlStateNormal]; + break; + case EButton::AvoidMotorway: + [self.button setImage:[UIImage imageNamed:@"ic_remove_route_point"] + forState:UIControlStateNormal]; + break; } self.button.enabled = !isDisabled; } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h index bca53be71a..0b48ffd723 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.h @@ -2,31 +2,12 @@ @class MWMPlacePageData; -@protocol MWMActionBarSharedData<NSObject> - -- (BOOL)isBookmark; -- (BOOL)isBookmarkEditable; -- (BOOL)isOpentable; -- (BOOL)isPartner; -- (BOOL)isBooking; -- (BOOL)isBookingSearch; -- (BOOL)isApi; -- (BOOL)isMyPosition; -- (BOOL)isRoutePoint; -- (NSString *)title; -- (NSString *)subtitle; -- (NSString *)phoneNumber; -- (int)partnerIndex; -- (NSURL *)sponsoredURL; - -@end - @protocol MWMActionBarProtocol; @interface MWMPlacePageActionBar : SolidTouchView + (MWMPlacePageActionBar *)actionBarWithDelegate:(id<MWMActionBarProtocol>)delegate; -- (void)configureWithData:(id<MWMActionBarSharedData>)data; +- (void)configureWithData:(MWMPlacePageData *)data; @property(nonatomic) BOOL isAreaNotDownloaded; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm index 55b874f07b..cab5bf4247 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/ActionBar/MWMPlacePageActionBar.mm @@ -6,6 +6,7 @@ #import "MWMPlacePageProtocol.h" #import "MWMRouter.h" #import "MapViewController.h" +#import "MWMPlacePageData.h" @interface MWMPlacePageActionBar ()<MWMActionBarButtonDelegate> { @@ -16,7 +17,7 @@ @property(nonatomic) NSLayoutConstraint * visibleConstraint; @property(weak, nonatomic) IBOutlet UIStackView * barButtons; @property(weak, nonatomic) id<MWMActionBarProtocol> delegate; -@property(weak, nonatomic) id<MWMActionBarSharedData> data; +@property(weak, nonatomic) MWMPlacePageData * data; @end @@ -31,7 +32,7 @@ return bar; } -- (void)configureWithData:(id<MWMActionBarSharedData>)data +- (void)configureWithData:(MWMPlacePageData *)data { self.data = data; [self configureButtons]; @@ -46,7 +47,7 @@ [self.barButtons.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; } -- (void)setFirstButton:(id<MWMActionBarSharedData>)data +- (void)setFirstButton:(MWMPlacePageData *)data { vector<EButton> buttons; @@ -90,7 +91,7 @@ std::copy(begin, buttons.end(), std::back_inserter(m_additionalButtons)); } -- (void)setSecondButton:(id<MWMActionBarSharedData>)data +- (void)setSecondButton:(MWMPlacePageData *)data { vector<EButton> buttons; BOOL const isCanAddIntermediatePoint = [MWMRouter canAddIntermediatePoint]; @@ -122,7 +123,7 @@ } } -- (void)addButtons2UI:(id<MWMActionBarSharedData>)data +- (void)addButtons2UI:(MWMPlacePageData *)data { BOOL const isPartner = [data isPartner] && [data sponsoredURL] != nil; int const partnerIndex = isPartner ? [data partnerIndex] : -1; @@ -142,12 +143,26 @@ - (void)setSingleButton { m_visibleButtons.push_back(EButton::RouteRemoveStop); } -- (void)setButtons:(id<MWMActionBarSharedData>)data +- (void)setButtons:(MWMPlacePageData *)data { - BOOL const isRoutePoint = [data isRoutePoint]; - if (isRoutePoint) + RoadWarningMarkType roadType = [data roadType]; + if ([data isRoutePoint]) { [self setSingleButton]; + } else if (roadType != RoadWarningMarkType::Count) { + switch (roadType) { + case RoadWarningMarkType::Toll: + m_visibleButtons.push_back(EButton::AvoidToll); + break; + case RoadWarningMarkType::Ferry: + m_visibleButtons.push_back(EButton::AvoidFerry); + break; + case RoadWarningMarkType::Dirty: + m_visibleButtons.push_back(EButton::AvoidDirty); + break; + default: + break; + } } else { @@ -227,6 +242,10 @@ case EButton::More: [self showActionSheet]; break; case EButton::RouteAddStop: [delegate routeAddStop]; break; case EButton::RouteRemoveStop: [delegate routeRemoveStop]; break; + case EButton::AvoidToll: [delegate avoidToll]; break; + case EButton::AvoidDirty: [delegate avoidDirty]; break; + case EButton::AvoidFerry: [delegate avoidFerry]; break; + case EButton::AvoidMotorway: [delegate avoidMotorway]; break; case EButton::Partner: [delegate openPartner]; break; } } diff --git a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift index 4aad8e8947..7a2896a42c 100644 --- a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift +++ b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift @@ -12,7 +12,7 @@ final class SettingsTableViewSwitchCell: MWMTableViewCell { } } - weak var delegate: SettingsTableViewSwitchCellDelegate? + @IBOutlet weak var delegate: SettingsTableViewSwitchCellDelegate? @objc var isEnabled = true { diff --git a/iphone/Maps/UI/Settings/DrivingOptions.storyboard b/iphone/Maps/UI/Settings/DrivingOptions.storyboard new file mode 100644 index 0000000000..8fe1ebba8a --- /dev/null +++ b/iphone/Maps/UI/Settings/DrivingOptions.storyboard @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="8YO-Xx-cAh"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Driving Options View Controller--> + <scene sceneID="BWZ-fX-cej"> + <objects> + <tableViewController storyboardIdentifier="DrivingOptionsViewController" id="8YO-Xx-cAh" userLabel="Driving Options View Controller" customClass="DrivingOptionsViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController"> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="Q8U-4Z-lWC"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> + <sections> + <tableViewSection headerTitle="AVOID ON EVERY ROUTE" id="qNN-Uw-84i"> + <cells> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="YrA-ve-xPG" customClass="SettingsTableViewSwitchCell" customModule="maps_me" customModuleProvider="target"> + <rect key="frame" x="0.0" y="55.5" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="YrA-ve-xPG" id="gKI-YE-akp"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Avoid toll roads" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="PKT-Eh-l9Q"> + <rect key="frame" x="16" y="11.5" width="286" height="20.5"/> + <inset key="insetFor6xAndEarlier" minX="0.0" minY="0.0" maxX="-25" maxY="0.0"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="colorName" value="blackPrimaryText"/> + <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> + <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="avoid_tolls"/> + </userDefinedRuntimeAttributes> + </label> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nlP-Dk-uja"> + <rect key="frame" x="310" y="6.5" width="51" height="31"/> + <inset key="insetFor6xAndEarlier" minX="3" minY="-2" maxX="-3" maxY="2"/> + <color key="onTintColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </switch> + </subviews> + <constraints> + <constraint firstAttribute="trailingMargin" secondItem="nlP-Dk-uja" secondAttribute="trailing" id="5CB-YF-tBp"/> + <constraint firstItem="PKT-Eh-l9Q" firstAttribute="leading" secondItem="gKI-YE-akp" secondAttribute="leading" constant="16" id="5dg-1e-U4h"/> + <constraint firstItem="nlP-Dk-uja" firstAttribute="centerY" secondItem="gKI-YE-akp" secondAttribute="centerY" id="AUq-22-7X0"/> + <constraint firstItem="nlP-Dk-uja" firstAttribute="leading" secondItem="PKT-Eh-l9Q" secondAttribute="trailing" constant="8" id="pkY-UP-YbA"/> + <constraint firstItem="PKT-Eh-l9Q" firstAttribute="centerY" secondItem="gKI-YE-akp" secondAttribute="centerY" id="yiZ-Et-ruq"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="delegate" destination="8YO-Xx-cAh" id="w8e-bi-R4K"/> + <outlet property="switchButton" destination="nlP-Dk-uja" id="4jG-7K-sWV"/> + <outlet property="title" destination="PKT-Eh-l9Q" id="FdA-Xd-B6c"/> + </connections> + </tableViewCell> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="Edm-gG-iZL" customClass="SettingsTableViewSwitchCell" customModule="maps_me" customModuleProvider="target"> + <rect key="frame" x="0.0" y="99.5" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Edm-gG-iZL" id="mIt-Ku-xiU"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Avoid unpaved roads" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="v9t-VR-YwE"> + <rect key="frame" x="16" y="11.5" width="286" height="20.5"/> + <inset key="insetFor6xAndEarlier" minX="0.0" minY="0.0" maxX="-25" maxY="0.0"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="colorName" value="blackPrimaryText"/> + <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> + <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="avoid_unpaved"/> + </userDefinedRuntimeAttributes> + </label> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u63-P9-9ZM"> + <rect key="frame" x="310" y="6.5" width="51" height="31"/> + <inset key="insetFor6xAndEarlier" minX="3" minY="-2" maxX="-3" maxY="2"/> + <color key="onTintColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </switch> + </subviews> + <constraints> + <constraint firstItem="u63-P9-9ZM" firstAttribute="centerY" secondItem="mIt-Ku-xiU" secondAttribute="centerY" id="E68-jT-G0O"/> + <constraint firstItem="u63-P9-9ZM" firstAttribute="leading" secondItem="v9t-VR-YwE" secondAttribute="trailing" constant="8" id="IaF-Cc-T99"/> + <constraint firstItem="v9t-VR-YwE" firstAttribute="leading" secondItem="mIt-Ku-xiU" secondAttribute="leading" constant="16" id="X4E-mC-lAs"/> + <constraint firstItem="v9t-VR-YwE" firstAttribute="centerY" secondItem="mIt-Ku-xiU" secondAttribute="centerY" id="iQU-rF-tI8"/> + <constraint firstAttribute="trailingMargin" secondItem="u63-P9-9ZM" secondAttribute="trailing" id="zVr-oH-1aL"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="delegate" destination="8YO-Xx-cAh" id="d0x-IA-p32"/> + <outlet property="switchButton" destination="u63-P9-9ZM" id="GMO-FY-FGY"/> + <outlet property="title" destination="v9t-VR-YwE" id="Z8m-Ie-Ten"/> + </connections> + </tableViewCell> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="ZqG-Fn-9Da" customClass="SettingsTableViewSwitchCell" customModule="maps_me" customModuleProvider="target"> + <rect key="frame" x="0.0" y="143.5" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ZqG-Fn-9Da" id="7US-xU-xAU"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Avoid ferry crossings" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="cIW-w0-eCH"> + <rect key="frame" x="16" y="11.5" width="286" height="20.5"/> + <inset key="insetFor6xAndEarlier" minX="0.0" minY="0.0" maxX="-25" maxY="0.0"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="colorName" value="blackPrimaryText"/> + <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> + <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="avoid_ferry"/> + </userDefinedRuntimeAttributes> + </label> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="COE-Zp-Rda"> + <rect key="frame" x="310" y="6.5" width="51" height="31"/> + <inset key="insetFor6xAndEarlier" minX="3" minY="-2" maxX="-3" maxY="2"/> + <color key="onTintColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </switch> + </subviews> + <constraints> + <constraint firstItem="COE-Zp-Rda" firstAttribute="centerY" secondItem="7US-xU-xAU" secondAttribute="centerY" id="23d-6c-LMC"/> + <constraint firstAttribute="trailingMargin" secondItem="COE-Zp-Rda" secondAttribute="trailing" id="RxJ-np-Eda"/> + <constraint firstItem="COE-Zp-Rda" firstAttribute="leading" secondItem="cIW-w0-eCH" secondAttribute="trailing" constant="8" id="kRT-wA-8tq"/> + <constraint firstItem="cIW-w0-eCH" firstAttribute="centerY" secondItem="7US-xU-xAU" secondAttribute="centerY" id="nH4-EJ-6bz"/> + <constraint firstItem="cIW-w0-eCH" firstAttribute="leading" secondItem="7US-xU-xAU" secondAttribute="leading" constant="16" id="vYU-LJ-yK6"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="delegate" destination="8YO-Xx-cAh" id="SKD-CC-bJO"/> + <outlet property="switchButton" destination="COE-Zp-Rda" id="16p-2l-T41"/> + <outlet property="title" destination="cIW-w0-eCH" id="Uc5-KH-WaN"/> + </connections> + </tableViewCell> + <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="EZ7-Gy-8aA" customClass="SettingsTableViewSwitchCell" customModule="maps_me" customModuleProvider="target"> + <rect key="frame" x="0.0" y="187.5" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EZ7-Gy-8aA" id="6ee-yF-kGr"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Avoid motorways" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="L5B-JN-YBU"> + <rect key="frame" x="16" y="11.5" width="286" height="20.5"/> + <inset key="insetFor6xAndEarlier" minX="0.0" minY="0.0" maxX="-25" maxY="0.0"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="colorName" value="blackPrimaryText"/> + <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> + <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="avoid_motorways"/> + </userDefinedRuntimeAttributes> + </label> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qDh-Oi-fF2"> + <rect key="frame" x="310" y="6.5" width="51" height="31"/> + <inset key="insetFor6xAndEarlier" minX="3" minY="-2" maxX="-3" maxY="2"/> + <color key="onTintColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </switch> + </subviews> + <constraints> + <constraint firstItem="L5B-JN-YBU" firstAttribute="centerY" secondItem="6ee-yF-kGr" secondAttribute="centerY" id="0fe-aJ-kqu"/> + <constraint firstItem="qDh-Oi-fF2" firstAttribute="centerY" secondItem="6ee-yF-kGr" secondAttribute="centerY" id="4yM-xR-vgD"/> + <constraint firstItem="L5B-JN-YBU" firstAttribute="leading" secondItem="6ee-yF-kGr" secondAttribute="leading" constant="16" id="BOe-ZN-h3k"/> + <constraint firstItem="qDh-Oi-fF2" firstAttribute="leading" secondItem="L5B-JN-YBU" secondAttribute="trailing" constant="8" id="bQb-Bq-hjE"/> + <constraint firstAttribute="trailingMargin" secondItem="qDh-Oi-fF2" secondAttribute="trailing" id="hNa-7M-GkI"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="delegate" destination="8YO-Xx-cAh" id="bcu-c0-4xR"/> + <outlet property="switchButton" destination="qDh-Oi-fF2" id="Tuw-4C-QNT"/> + <outlet property="title" destination="L5B-JN-YBU" id="RAC-DL-FwU"/> + </connections> + </tableViewCell> + </cells> + </tableViewSection> + </sections> + <connections> + <outlet property="dataSource" destination="8YO-Xx-cAh" id="3Lz-g5-LiH"/> + <outlet property="delegate" destination="8YO-Xx-cAh" id="Iup-r1-FJ7"/> + </connections> + </tableView> + <connections> + <outlet property="ferryCrossingsCell" destination="ZqG-Fn-9Da" id="td7-b1-uPz"/> + <outlet property="motorwaysCell" destination="EZ7-Gy-8aA" id="g4i-mp-cFD"/> + <outlet property="tollRoadsCell" destination="YrA-ve-xPG" id="s0c-im-mto"/> + <outlet property="unpavedRoadsCell" destination="Edm-gG-iZL" id="X5s-mB-VZ6"/> + </connections> + </tableViewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="XZd-C9-klr" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="100" y="100"/> + </scene> + </scenes> +</document> diff --git a/iphone/Maps/UI/Settings/DrivingOptionsViewController.swift b/iphone/Maps/UI/Settings/DrivingOptionsViewController.swift new file mode 100644 index 0000000000..9a7496818a --- /dev/null +++ b/iphone/Maps/UI/Settings/DrivingOptionsViewController.swift @@ -0,0 +1,38 @@ +import UIKit + +class DrivingOptionsViewController: MWMTableViewController { + let options = MWMRoutingOptions() + @IBOutlet var tollRoadsCell: SettingsTableViewSwitchCell! + @IBOutlet var unpavedRoadsCell: SettingsTableViewSwitchCell! + @IBOutlet var ferryCrossingsCell: SettingsTableViewSwitchCell! + @IBOutlet var motorwaysCell: SettingsTableViewSwitchCell! + + override func viewDidLoad() { + super.viewDidLoad() + title = L("driving_options_title") + tollRoadsCell.isOn = options.avoidToll + unpavedRoadsCell.isOn = options.avoidDirty + ferryCrossingsCell.isOn = options.avoidFerry + motorwaysCell.isOn = options.avoidMotorway + } + + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return L("driving_options_subheader") + } +} + +extension DrivingOptionsViewController: SettingsTableViewSwitchCellDelegate { + func switchCell(_ cell: SettingsTableViewSwitchCell, didChangeValue value: Bool) { + if cell == tollRoadsCell { + options.avoidToll = cell.isOn + } else if cell == unpavedRoadsCell { + options.avoidDirty = cell.isOn + } else if cell == ferryCrossingsCell { + options.avoidFerry = cell.isOn + } else if cell == motorwaysCell { + options.avoidMotorway = cell.isOn + } + + options.save() + } +} diff --git a/iphone/Maps/UI/Settings/MWMSettingsViewController.mm b/iphone/Maps/UI/Settings/MWMSettingsViewController.mm index dbef215740..c1f9394e8c 100644 --- a/iphone/Maps/UI/Settings/MWMSettingsViewController.mm +++ b/iphone/Maps/UI/Settings/MWMSettingsViewController.mm @@ -44,6 +44,7 @@ using namespace power_management; @property(weak, nonatomic) IBOutlet SettingsTableViewSwitchCell * perspectiveViewCell; @property(weak, nonatomic) IBOutlet SettingsTableViewSwitchCell * autoZoomCell; @property(weak, nonatomic) IBOutlet SettingsTableViewLinkCell * voiceInstructionsCell; +@property(weak, nonatomic) IBOutlet SettingsTableViewLinkCell * drivingOptionsCell; @property(weak, nonatomic) IBOutlet SettingsTableViewLinkCell * helpCell; @property(weak, nonatomic) IBOutlet SettingsTableViewLinkCell * aboutCell; @@ -349,6 +350,10 @@ using namespace power_management; withParameters:@{kStatAction : kStatChangeLanguage}]; [self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil]; } + else if (cell == self.drivingOptionsCell) + { + [self performSegueWithIdentifier:@"settingsToDrivingOptionsSegue" sender:nil]; + } else if (cell == self.helpCell) { [Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatHelp}]; diff --git a/iphone/Maps/UI/Storyboard/Settings.storyboard b/iphone/Maps/UI/Storyboard/Settings.storyboard index c00671cd6c..d97c282c4d 100644 --- a/iphone/Maps/UI/Storyboard/Settings.storyboard +++ b/iphone/Maps/UI/Storyboard/Settings.storyboard @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" 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="14460.20"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -722,12 +722,50 @@ <outlet property="title" destination="2v2-mU-aWi" id="Zp1-zJ-xDM"/> </connections> </tableViewCell> + <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SettingsTableViewLinkCell" id="KrE-Sc-fI1" customClass="SettingsTableViewLinkCell" customModule="maps_me" customModuleProvider="target"> + <rect key="frame" x="0.0" y="1102.5" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KrE-Sc-fI1" id="AKJ-VB-Pzr"> + <rect key="frame" x="0.0" y="0.0" width="349" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Drivinig options" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Svw-vb-P42"> + <rect key="frame" x="16" y="12" width="329" height="19.5"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <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="driving_options_title"/> + </userDefinedRuntimeAttributes> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="300" verticalHuggingPriority="251" horizontalCompressionResistancePriority="700" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wC1-f8-Br8"> + <rect key="frame" x="349" y="12" width="0.0" height="19.5"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <constraints> + <constraint firstItem="wC1-f8-Br8" firstAttribute="top" secondItem="AKJ-VB-Pzr" secondAttribute="top" constant="12" id="0MT-eX-qIY"/> + <constraint firstAttribute="bottom" secondItem="Svw-vb-P42" secondAttribute="bottom" constant="12" id="5hB-kU-bbd"/> + <constraint firstItem="wC1-f8-Br8" firstAttribute="leading" secondItem="Svw-vb-P42" secondAttribute="trailing" constant="4" id="AwL-2X-aRk"/> + <constraint firstItem="Svw-vb-P42" firstAttribute="top" secondItem="AKJ-VB-Pzr" secondAttribute="top" constant="12" id="Z9g-9O-vbl"/> + <constraint firstAttribute="trailing" secondItem="wC1-f8-Br8" secondAttribute="trailing" id="hc1-xs-ciL"/> + <constraint firstItem="Svw-vb-P42" firstAttribute="leading" secondItem="AKJ-VB-Pzr" secondAttribute="leading" constant="16" id="i6J-FV-8mz"/> + <constraint firstAttribute="bottom" secondItem="wC1-f8-Br8" secondAttribute="bottom" constant="12" id="m21-5d-nGY"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="info" destination="wC1-f8-Br8" id="65Q-Wq-Jze"/> + <outlet property="title" destination="Svw-vb-P42" id="V80-Qf-JuQ"/> + </connections> + </tableViewCell> </cells> </tableViewSection> <tableViewSection headerTitle="ИНФОРМАЦИЯ" id="i4H-WV-BaS"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SettingsTableViewLinkCell" id="JTZ-K9-RVv" customClass="SettingsTableViewLinkCell" customModule="maps_me" customModuleProvider="target"> - <rect key="frame" x="0.0" y="1150.5" width="375" height="44"/> + <rect key="frame" x="0.0" y="1194.5" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="JTZ-K9-RVv" id="mHA-wn-hse"> <rect key="frame" x="0.0" y="0.0" width="349" height="43.5"/> @@ -762,7 +800,7 @@ </connections> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SettingsTableViewLinkCell" id="Kv3-pO-jV5" customClass="SettingsTableViewLinkCell" customModule="maps_me" customModuleProvider="target"> - <rect key="frame" x="0.0" y="1194.5" width="375" height="44"/> + <rect key="frame" x="0.0" y="1238.5" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Kv3-pO-jV5" id="8mJ-wm-9uJ"> <rect key="frame" x="0.0" y="0.0" width="349" height="43.5"/> @@ -817,6 +855,7 @@ <outlet property="autoZoomCell" destination="veW-Fm-2Hl" id="zbI-m2-mDP"/> <outlet property="backupBookmarksCell" destination="hbG-yu-ut3" id="Wxn-pQ-gEU"/> <outlet property="compassCalibrationCell" destination="P5e-67-f4k" id="KcB-EC-S2y"/> + <outlet property="drivingOptionsCell" destination="KrE-Sc-fI1" id="XOl-eI-xJX"/> <outlet property="fontScaleCell" destination="pri-6G-9Zb" id="rHJ-ZT-lwM"/> <outlet property="helpCell" destination="JTZ-K9-RVv" id="FcU-iF-pKx"/> <outlet property="is3dCell" destination="0Lf-xU-P2U" id="obI-bL-FLh"/> @@ -843,11 +882,12 @@ <segue destination="f2i-mO-skH" kind="custom" identifier="SettingsToHelp" customClass="MWMSegue" id="PSn-ic-YWl"/> <segue destination="4XX-qH-r6x" kind="custom" identifier="SettingsToMobileInternetSegue" customClass="MWMSegue" id="wBF-fV-zWQ"/> <segue destination="vni-Mo-vH1" kind="custom" identifier="SettingsToPowerManagementSegue" customClass="MWMSegue" id="arI-ZG-u4b"/> + <segue destination="CoS-Kv-RlQ" kind="custom" identifier="settingsToDrivingOptionsSegue" customClass="MWMSegue" id="sdV-0Y-OKf"/> </connections> </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="I90-hv-hTP" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> - <point key="canvasLocation" x="-559" y="-339"/> + <point key="canvasLocation" x="919" y="-339"/> </scene> <!--Night Mode Controller--> <scene sceneID="f6s-C8-Bfx"> @@ -1902,6 +1942,14 @@ </objects> <point key="canvasLocation" x="-559" y="428"/> </scene> + <!--DrivingOptions--> + <scene sceneID="sWS-Id-gGL"> + <objects> + <viewControllerPlaceholder storyboardName="DrivingOptions" id="CoS-Kv-RlQ" sceneMemberID="viewController"/> + <placeholder placeholderIdentifier="IBFirstResponder" id="hwf-lT-jqo" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="430" y="578"/> + </scene> <!--Mobile Internet View Controller--> <scene sceneID="oc3-3x-xki"> <objects> diff --git a/iphone/Maps/UI/Storyboard/Storyboard.swift b/iphone/Maps/UI/Storyboard/Storyboard.swift index bbecdf2485..07ca84ea15 100644 --- a/iphone/Maps/UI/Storyboard/Storyboard.swift +++ b/iphone/Maps/UI/Storyboard/Storyboard.swift @@ -2,7 +2,6 @@ import UIKit @objc(MWMStoryboard) enum Storyboard: Int { - case authorization case launchScreen case main @@ -11,6 +10,7 @@ enum Storyboard: Int { case welcome case sharing case categorySettings + case drivingOptions } extension UIStoryboard { @@ -25,6 +25,7 @@ extension UIStoryboard { case .welcome: name = "Welcome" case .sharing: name = "BookmarksSharingFlow" case .categorySettings: name = "CategorySettings" + case .drivingOptions: name = "DrivingOptions" } return UIStoryboard(name: name, bundle: nil) } |