Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorv.mikhaylenko <v.mikhaylenko@corp.mail.ru>2015-07-17 19:14:26 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:56:48 +0300
commit47e0c2ed5e980b587d851cac30f3642a5332c99b (patch)
tree4a44fa5980d885cf3dc2ad0aa78073d8005b5a38 /iphone/Maps/Classes/CustomAlert
parentc00910d16876a4e4edc74fc1bc561ffd9937c7da (diff)
[ios] New routing disclaimer.
Diffstat (limited to 'iphone/Maps/Classes/CustomAlert')
-rw-r--r--iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm2
-rw-r--r--iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h2
-rw-r--r--iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm5
-rw-r--r--iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h1
-rw-r--r--iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm6
-rw-r--r--iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm2
-rw-r--r--iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h15
-rw-r--r--iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm63
-rw-r--r--iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib128
9 files changed, 212 insertions, 12 deletions
diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
index 1021f7eb2b..debe681673 100644
--- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
+++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm
@@ -115,7 +115,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
- (void)presentRoutingDisclaimerAlert
{
- [self displayAlert:MWMAlert.routingDisclaimerAlert];
+ [self displayAlert:[MWMAlert routingDisclaimerAlertWithInitialOrientation:self.ownerViewController.interfaceOrientation]];
}
- (void)presentDisabledLocationAlert
diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h
index b16ecabc72..58a2d0486b 100644
--- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h
+++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h
@@ -25,7 +25,7 @@ typedef void (^RightButtonAction)();
+ (MWMAlert *)feedbackAlertWithStarsCount:(NSUInteger)starsCount;
+ (MWMAlert *)facebookAlert;
+ (MWMAlert *)locationAlert;
-+ (MWMAlert *)routingDisclaimerAlert;
++ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation;
+ (MWMAlert *)disabledLocationAlert;
+ (MWMAlert *)noWiFiAlertWithName:(NSString *)name downloadBlock:(RightButtonAction)block;
+ (MWMAlert *)noConnectionAlert;
diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm
index f1706e6620..cce1e6b360 100644
--- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm
+++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm
@@ -14,6 +14,7 @@
#import "MWMFeedbackAlert.h"
#import "MWMLocationAlert.h"
#import "MWMRateAlert.h"
+#import "MWMRoutingDisclaimerAlert.h"
@implementation MWMAlert
@@ -32,9 +33,9 @@
return [MWMFacebookAlert alert];
}
-+ (MWMAlert *)routingDisclaimerAlert
++ (MWMAlert *)routingDisclaimerAlertWithInitialOrientation:(UIInterfaceOrientation)orientation
{
- return [MWMDefaultAlert routingDisclaimerAlert];
+ return [MWMRoutingDisclaimerAlert alertWithInitialOrientation:orientation];
}
+ (MWMAlert *)disabledLocationAlert
diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h
index c6c8821100..508fca8698 100644
--- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h
+++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h
@@ -17,7 +17,6 @@
+ (instancetype)internalErrorAlert;
+ (instancetype)noCurrentPositionAlert;
+ (instancetype)pointsInDifferentMWMAlert;
-+ (instancetype)routingDisclaimerAlert;
+ (instancetype)disabledLocationAlert;
+ (instancetype)noWiFiAlertWithName:(NSString *)name downloadBlock:(RightButtonAction)block;
+ (instancetype)noConnectionAlert;
diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm
index 443573edfb..4231b1d847 100644
--- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm
+++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm
@@ -90,12 +90,6 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
return [self defaultAlertWithTitle:@"dialog_routing_check_gps" message:message rightButtonTitle:@"OK" leftButtonTitle:nil rightButtonAction:nil];
}
-+ (instancetype)routingDisclaimerAlert
-{
- NSString * message = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@", L(@"dialog_routing_disclaimer_priority"), L(@"dialog_routing_disclaimer_precision"), L(@"dialog_routing_disclaimer_recommendations"),L(@"dialog_routing_disclaimer_beware")];
- return [self defaultAlertWithTitle:@"dialog_routing_disclaimer_title" message:message rightButtonTitle:@"ok" leftButtonTitle:nil rightButtonAction:nil];
-}
-
+ (instancetype)disabledLocationAlert
{
RightButtonAction action = ^
diff --git a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm
index 9f8c81d587..0edbfefee5 100644
--- a/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm
+++ b/iphone/Maps/Classes/CustomAlert/DownloadTransitMapsAlert/MWMDownloadTransitMapAlert.mm
@@ -258,7 +258,7 @@ static CGFloat const kMinimumOffset = 20.;
NSUInteger const cellCount = self.cellCountForCurrentState;
CGFloat const actualHeight = kCellHeight * cellCount + kHeaderAndFooterHeight * numberOfSections;
self.tableViewHeight.constant = [self bounded:actualHeight withHeight:height];;
- self.dialogsTableView.scrollEnabled = actualHeight > self.tableViewHeight.constant ? YES : NO;
+ self.dialogsTableView.scrollEnabled = actualHeight > self.tableViewHeight.constant;
break;
}
}
diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h
new file mode 100644
index 0000000000..7ef5543564
--- /dev/null
+++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.h
@@ -0,0 +1,15 @@
+//
+// MWMRoutingDisclaimerAlert.h
+// Maps
+//
+// Created by v.mikhaylenko on 17.07.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMAlert.h"
+
+@interface MWMRoutingDisclaimerAlert : MWMAlert
+
++ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation;
+
+@end
diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm
new file mode 100644
index 0000000000..b0ae3f54a0
--- /dev/null
+++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.mm
@@ -0,0 +1,63 @@
+//
+// MWMRoutingDisclaimerAlert.m
+// Maps
+//
+// Created by v.mikhaylenko on 17.07.15.
+// Copyright (c) 2015 MapsWithMe. All rights reserved.
+//
+
+#import "MWMAlertViewController.h"
+#import "MWMRoutingDisclaimerAlert.h"
+#import "UIColor+MapsMeColor.h"
+#import "UIFont+MapsMeFonts.h"
+#import "UIKitCategories.h"
+
+static CGFloat const kMinimumOffset = 20.;
+
+@interface MWMRoutingDisclaimerAlert ()
+
+@property (weak, nonatomic) IBOutlet UITextView * textView;
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint * textViewHeight;
+
+@end
+
+@implementation MWMRoutingDisclaimerAlert
+
++ (instancetype)alertWithInitialOrientation:(UIInterfaceOrientation)orientation
+{
+ MWMRoutingDisclaimerAlert * alert = [[[NSBundle mainBundle] loadNibNamed:[MWMRoutingDisclaimerAlert className] owner:nil options:nil] firstObject];
+ NSString * message = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@", L(@"dialog_routing_disclaimer_priority"), L(@"dialog_routing_disclaimer_precision"), L(@"dialog_routing_disclaimer_recommendations"),L(@"dialog_routing_disclaimer_beware")];
+ alert.textView.attributedText = [[NSAttributedString alloc] initWithString:message attributes:@{NSFontAttributeName : UIFont.regular14, NSForegroundColorAttributeName : UIColor.blackSecondaryText}];
+ [alert.textView sizeToFit];
+ UIWindow * window = UIApplication.sharedApplication.keyWindow;
+ [alert invalidateTextViewHeight:alert.textView.height withHeight:UIInterfaceOrientationIsLandscape(orientation) ? window.width : window.height];
+ return alert;
+}
+
+- (IBAction)okTap
+{
+ [self close];
+}
+
+- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
+{
+ CGFloat const height = UIInterfaceOrientationIsLandscape(orientation) ? MIN(self.superview.width, self.superview.height) : MAX(self.superview.width, self.superview.height);
+ [self invalidateTextViewHeight:self.textView.contentSize.height withHeight:height];
+}
+
+- (void)invalidateTextViewHeight:(CGFloat)textViewHeight withHeight:(CGFloat)height
+{
+ self.textViewHeight.constant = [self bounded:textViewHeight withHeight:height];
+ self.textView.scrollEnabled = textViewHeight > self.textViewHeight.constant;
+ [self layoutIfNeeded];
+}
+
+- (CGFloat)bounded:(CGFloat)f withHeight:(CGFloat)h
+{
+ CGFloat const currentHeight = [self.subviews.firstObject height];
+ CGFloat const maximumHeight = h - 2. * kMinimumOffset;
+ CGFloat const availableHeight = maximumHeight - currentHeight;
+ return MIN(f, availableHeight + self.textViewHeight.constant);
+}
+
+@end
diff --git a/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib
new file mode 100644
index 0000000000..3e6ca62d8f
--- /dev/null
+++ b/iphone/Maps/Classes/CustomAlert/RoutingDisclaimerAlert/MWMRoutingDisclaimerAlert.xib
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
+ <dependencies>
+ <deployment version="2048" identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
+ </dependencies>
+ <customFonts key="customFonts">
+ <mutableArray key="HelveticaNeue.ttc">
+ <string>HelveticaNeue-Medium</string>
+ <string>HelveticaNeue-Medium</string>
+ </mutableArray>
+ </customFonts>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="Ie9-JJ-hnZ" customClass="MWMRoutingDisclaimerAlert">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ogu-AE-Ohh" userLabel="ContainerView">
+ <rect key="frame" x="20" y="215" width="280" height="138"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S3s-j7-v6E" userLabel="Title">
+ <rect key="frame" x="20" y="20.5" width="240" height="21.5"/>
+ <constraints>
+ <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="uht-Xi-vWk"/>
+ <constraint firstAttribute="width" constant="240" id="wsn-Cq-kJT"/>
+ </constraints>
+ <fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="18"/>
+ <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="dialog_routing_disclaimer_title"/>
+ </userDefinedRuntimeAttributes>
+ </label>
+ <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lbr-Xd-hLF">
+ <rect key="frame" x="20" y="53" width="240" height="20"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="240" id="GeJ-mk-jko"/>
+ <constraint firstAttribute="height" constant="20" id="XLp-um-S4A"/>
+ </constraints>
+ <attributedString key="attributedText">
+ <fragment content="Message">
+ <attributes>
+ <color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
+ <font key="NSFont" size="14" name="HelveticaNeue"/>
+ <paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
+ </attributes>
+ </fragment>
+ </attributedString>
+ <textInputTraits key="textInputTraits" autocapitalizationType="sentences" autocorrectionType="no" spellCheckingType="no"/>
+ </textView>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XIL-q9-MMp" userLabel="hDivider">
+ <rect key="frame" x="0.0" y="93" width="280" height="1"/>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="1" id="g4E-tB-Y4R"/>
+ </constraints>
+ </view>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aCY-1G-NL5" userLabel="right">
+ <rect key="frame" x="0.0" y="94" width="280" height="44"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="44" id="AAv-pX-uuc"/>
+ <constraint firstAttribute="width" constant="280" id="lvU-ua-qht"/>
+ </constraints>
+ <fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
+ <state key="normal" title="right">
+ <color key="titleColor" red="0.090196078430000007" green="0.61960784310000006" blue="0.30196078430000001" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="highlighted" backgroundImage="dialog_btn_press"/>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="ok"/>
+ </userDefinedRuntimeAttributes>
+ <connections>
+ <action selector="okTap" destination="Ie9-JJ-hnZ" eventType="touchUpInside" id="vfz-Rd-Kh6"/>
+ </connections>
+ </button>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="lbr-Xd-hLF" firstAttribute="top" secondItem="S3s-j7-v6E" secondAttribute="bottom" constant="11" id="20T-2E-mmf"/>
+ <constraint firstAttribute="width" secondItem="XIL-q9-MMp" secondAttribute="width" id="3m7-Ha-HlN"/>
+ <constraint firstItem="XIL-q9-MMp" firstAttribute="top" secondItem="lbr-Xd-hLF" secondAttribute="bottom" constant="20" id="4k1-g8-WZV"/>
+ <constraint firstAttribute="trailing" secondItem="aCY-1G-NL5" secondAttribute="trailing" id="BcN-zR-SdX"/>
+ <constraint firstAttribute="width" constant="280" id="KpN-ir-OWh"/>
+ <constraint firstAttribute="centerX" secondItem="lbr-Xd-hLF" secondAttribute="centerX" id="KuP-DA-FWV"/>
+ <constraint firstAttribute="centerX" secondItem="S3s-j7-v6E" secondAttribute="centerX" id="Oag-6s-ais"/>
+ <constraint firstItem="S3s-j7-v6E" firstAttribute="top" secondItem="Ogu-AE-Ohh" secondAttribute="top" constant="20" id="OoP-Qp-YIb"/>
+ <constraint firstAttribute="bottom" secondItem="aCY-1G-NL5" secondAttribute="bottom" id="WB8-od-eAG"/>
+ <constraint firstAttribute="centerX" secondItem="XIL-q9-MMp" secondAttribute="centerX" id="bas-rx-OTg"/>
+ <constraint firstItem="aCY-1G-NL5" firstAttribute="top" secondItem="XIL-q9-MMp" secondAttribute="bottom" id="swb-Yx-lVo"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="size" keyPath="layer.shadowOffset">
+ <size key="value" width="0.0" height="3"/>
+ </userDefinedRuntimeAttribute>
+ <userDefinedRuntimeAttribute type="number" keyPath="layer.shadowRadius">
+ <integer key="value" value="6"/>
+ </userDefinedRuntimeAttribute>
+ <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
+ <integer key="value" value="4"/>
+ </userDefinedRuntimeAttribute>
+ </userDefinedRuntimeAttributes>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="centerY" secondItem="Ogu-AE-Ohh" secondAttribute="centerY" id="Kg9-hX-fvu"/>
+ <constraint firstAttribute="centerX" secondItem="Ogu-AE-Ohh" secondAttribute="centerX" id="dkW-i0-CZ2"/>
+ </constraints>
+ <connections>
+ <outlet property="textView" destination="lbr-Xd-hLF" id="ru3-Uu-UKw"/>
+ <outlet property="textViewHeight" destination="XLp-um-S4A" id="GmU-gr-jlY"/>
+ </connections>
+ <point key="canvasLocation" x="305" y="172"/>
+ </view>
+ </objects>
+ <resources>
+ <image name="dialog_btn_press" width="280" height="44"/>
+ </resources>
+ <simulatedMetricsContainer key="defaultSimulatedMetrics">
+ <simulatedStatusBarMetrics key="statusBar"/>
+ <simulatedOrientationMetrics key="orientation"/>
+ <simulatedScreenMetrics key="destination" type="retina4"/>
+ </simulatedMetricsContainer>
+</document>