[ios] Added error handling and route restoring. Fixed UI bugs.

This commit is contained in:
v.mikhaylenko 2015-07-28 16:49:12 +03:00 committed by Alex Zolotarev
parent 5430c7cf2e
commit ca81e9889c
34 changed files with 298 additions and 179 deletions

View file

@ -334,11 +334,6 @@
//******************************************************************
//*********** Location manager callbacks ***************************
- (void)onLocationError:(location::TLocationError)errorCode
{
// Handle location status changes if necessary
}
- (void)onLocationUpdate:(location::GpsInfo const &)info
{
// Refresh distance

View file

@ -46,5 +46,7 @@
- (void)setupRoutingDashboard:(location::FollowingInfo const &)info;
- (void)routingReady;
- (void)routingNavigation;
- (void)handleRoutingError;
@end

View file

@ -114,10 +114,16 @@
[self.navigationManager setupDashboard:info];
}
- (void)handleRoutingError
{
[self.navigationManager handleError];
}
- (void)buildRouteWithType:(enum routing::RouterType)type
{
GetFramework().BuildRoute(self.routeDestination, 0 /* timeoutSec */);
[[MapsAppDelegate theApp].m_locationManager start:self.navigationManager];
self.navigationManager.state = MWMNavigationDashboardStatePlanning;
GetFramework().BuildRoute(self.routeDestination, 0 /* timeoutSec */);
}
- (void)navigationDashBoardDidUpdate
@ -135,14 +141,15 @@
self.zoomHidden = NO;
GetFramework().FollowRoute();
self.disableStandbyOnRouteFollowing = YES;
// [RouteState save];
[RouteState save];
}
- (void)didCancelRouting
{
[[MapsAppDelegate theApp].m_locationManager stop:self.navigationManager];
GetFramework().CloseRouting();
self.disableStandbyOnRouteFollowing = NO;
// [RouteState remove];
[RouteState remove];
}
- (void)routingReady
@ -150,6 +157,12 @@
self.navigationManager.state = MWMNavigationDashboardStateReady;
}
- (void)routingNavigation
{
self.navigationManager.state = MWMNavigationDashboardStateNavigation;
[self didStartFollowing];
}
- (void)setDisableStandbyOnRouteFollowing:(BOOL)disableStandbyOnRouteFollowing
{
if (_disableStandbyOnRouteFollowing == disableStandbyOnRouteFollowing)

View file

@ -19,6 +19,7 @@
@property (nonatomic, readonly) UIImage * turnImage;
@property (nonatomic, readonly) NSUInteger roundExitNumber;
@property (nonatomic, readonly) NSUInteger timeToTarget;
@property (nonatomic, readonly) BOOL isPedestrian;
- (instancetype)initWithFollowingInfo:(location::FollowingInfo const &)info;
- (void)updateWithFollowingInfo:(location::FollowingInfo const &)info;

View file

@ -6,8 +6,11 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "LocationManager.h"
#import "MapsAppDelegate.h"
#import "MWMNavigationDashboardEntity.h"
#import "Framework.h"
#include "Framework.h"
@implementation MWMNavigationDashboardEntity
@ -27,10 +30,35 @@
- (void)configure:(location::FollowingInfo const &)info
{
_timeToTarget = info.m_time;
_targetDistance = [NSString stringWithUTF8String:info.m_distToTarget.c_str()];
_targetUnits = [NSString stringWithUTF8String:info.m_targetUnitsSuffix.c_str()];
_distanceToTurn = [NSString stringWithUTF8String:info.m_distToTurn.c_str()];
_turnUnits = [NSString stringWithUTF8String:info.m_turnUnitsSuffix.c_str()];
_targetDistance = @(info.m_distToTarget.c_str());
_targetUnits = @(info.m_targetUnitsSuffix.c_str());
auto & f = GetFramework();
if (f.GetRouter() == routing::RouterType::Pedestrian)
{
_isPedestrian = YES;
LocationManager * locationManager = [MapsAppDelegate theApp].m_locationManager;
double north = -1.0;
[locationManager getNorthRad:north];
string distance;
double azimut = -1.0;
CLLocationCoordinate2D const coordinate (locationManager.lastLocation.coordinate);
ms::LatLon const & latLon = info.m_pedestrianDirectionPos;
m2::PointD const point (MercatorBounds::LonToX(latLon.lon), MercatorBounds::LatToY(latLon.lat));
f.GetDistanceAndAzimut(point, coordinate.latitude, coordinate.longitude, north, distance, azimut);
istringstream is (distance);
string dist;
string units;
is>>dist;
is>>units;
_distanceToTurn = @(dist.c_str());
_turnUnits = @(units.c_str());
}
else
{
_isPedestrian = NO;
_distanceToTurn = @(info.m_distToTurn.c_str());
_turnUnits = @(info.m_turnUnitsSuffix.c_str());
}
_turnImage = image(info.m_turn);
if (info.m_turn == routing::turns::TurnDirection::EnterRoundAbout)
_roundExitNumber = info.m_exitNum;

View file

@ -28,7 +28,7 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState)
@class MWMNavigationDashboardEntity;
@interface MWMNavigationDashboardManager : NSObject
@interface MWMNavigationDashboardManager : NSObject <LocationObserver>
@property (nonatomic, readonly) MWMNavigationDashboardEntity * entity;
@property (nonatomic) MWMNavigationDashboardState state;
@ -39,6 +39,7 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState)
- (instancetype)init __attribute__((unavailable("init is not available")));
- (instancetype)initWithParentView:(UIView *)view delegate:(id<MWMNavigationDashboardManagerDelegate>)delegate;
- (void)setupDashboard:(location::FollowingInfo const &)info;
- (void)handleError;
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation;
@end

View file

@ -6,7 +6,9 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "LocationManager.h"
#import "Macros.h"
#import "MapsAppDelegate.h"
#import "MWMNavigationDashboard.h"
#import "MWMNavigationDashboardEntity.h"
#import "MWMNavigationDashboardManager.h"
@ -82,6 +84,12 @@
[self updateDashboard];
}
- (void)handleError
{
[self.routePreviewPortrait stateError];
[self.routePreviewLandscape stateError];
}
- (void)updateDashboard
{
[self.routePreviewLandscape configureWithEntity:self.entity];
@ -139,6 +147,7 @@
- (void)showStatePlanning
{
[self.routePreview addToView:self.ownerView];
[self.navigationDashboard remove];
[self.routePreviewLandscape statePlaning];
[self.routePreviewPortrait statePlaning];
auto const state = GetFramework().GetRouter();
@ -189,7 +198,6 @@
[self hideState];
break;
case MWMNavigationDashboardStatePlanning:
NSAssert(_state == MWMNavigationDashboardStateHidden || _state == MWMNavigationDashboardStateReady, @"Invalid state change");
[self showStatePlanning];
break;
case MWMNavigationDashboardStateReady:
@ -197,7 +205,6 @@
[self showStateReady];
break;
case MWMNavigationDashboardStateNavigation:
NSAssert(_state == MWMNavigationDashboardStateReady, @"Invalid state change");
[self showStateNavigation];
break;
}
@ -225,4 +232,29 @@
}
}
#pragma mark - LocationObserver
- (void)onCompassUpdate:(location::CompassInfo const &)info
{
auto & f = GetFramework();
if (f.GetRouter() == routing::RouterType::Vehicle)
return;
CLLocation * location = [MapsAppDelegate theApp].m_locationManager.lastLocation;
if (!location)
return;
location::FollowingInfo res;
f.GetRouteFollowingInfo(res);
if (!res.IsValid())
return;
ms::LatLon const dest (res.m_pedestrianDirectionPos);
CLLocationCoordinate2D const lastPosition (location.coordinate);
CGFloat const angle = ang::AngleTo(MercatorBounds::FromLatLon(lastPosition.latitude, lastPosition.longitude), MercatorBounds::FromLatLon(dest.lat, dest.lon)) + info.m_bearing;
CGAffineTransform const transform (CGAffineTransformMakeRotation(M_PI_2 - angle));
self.navigationDashboardPortrait.direction.transform = transform;
self.navigationDashboardLandscape.direction.transform = transform;
}
@end

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
@ -45,6 +45,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="36"/>
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium36"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="km" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vo5-Yp-xWN">
<rect key="frame" x="83" y="21" width="26" height="22"/>
@ -55,8 +59,12 @@
<constraint firstAttribute="width" constant="26" id="rCL-RY-GbF"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="18"/>
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.11764705882352941" green="0.58823529411764708" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium18"/>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
<exclude reference="2Xd-X9-QxK"/>
@ -64,6 +72,20 @@
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vrh-bu-AbG" userLabel="exit">
<rect key="frame" x="6" y="16" width="42" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="5QF-QH-iSo"/>
<constraint firstAttribute="width" constant="42" id="dYV-fP-4ba"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.11764705882352941" green="0.58823529411764708" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="bold17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
@ -78,9 +100,11 @@
<constraint firstItem="Vo5-Yp-xWN" firstAttribute="leading" secondItem="sMk-g9-2oJ" secondAttribute="trailing" constant="3.5" id="RsH-2c-74p"/>
<constraint firstItem="sMk-g9-2oJ" firstAttribute="leading" secondItem="1r7-WJ-4zD" secondAttribute="trailing" constant="8" id="XLA-lU-avx"/>
<constraint firstItem="Vo5-Yp-xWN" firstAttribute="leading" secondItem="sMk-g9-2oJ" secondAttribute="trailing" constant="4" id="chw-Mu-gak"/>
<constraint firstItem="1r7-WJ-4zD" firstAttribute="centerX" secondItem="Vrh-bu-AbG" secondAttribute="centerX" id="hGz-2W-3DF"/>
<constraint firstAttribute="width" constant="190" id="pfA-s3-hU5"/>
<constraint firstAttribute="trailing" secondItem="Vo5-Yp-xWN" secondAttribute="trailing" id="sCi-Lc-G8B"/>
<constraint firstItem="sMk-g9-2oJ" firstAttribute="baseline" secondItem="Vo5-Yp-xWN" secondAttribute="baseline" id="t80-eN-Ymv"/>
<constraint firstItem="1r7-WJ-4zD" firstAttribute="centerY" secondItem="Vrh-bu-AbG" secondAttribute="centerY" constant="0.5" id="wsB-QZ-xjY"/>
<constraint firstAttribute="height" constant="54" id="y3P-ga-yXV"/>
</constraints>
<variation key="default">
@ -94,34 +118,46 @@
</variation>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r2o-8G-3Cv" userLabel="Distance Box">
<rect key="frame" x="548" y="14" width="180" height="42"/>
<rect key="frame" x="616" y="14" width="112" height="42"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12 min" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yzZ-6b-Jou">
<rect key="frame" x="0.0" y="0.0" width="180" height="21"/>
<rect key="frame" x="0.0" y="0.0" width="112" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="Z2S-i8-Ntf"/>
</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="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium18"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="20 km" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="heX-Mf-T11">
<rect key="frame" x="0.0" y="27" width="112" height="16"/>
<rect key="frame" x="0.0" y="27" width="48" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="112" id="APr-Ng-kVm"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="48" id="LEc-Kx-45B"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F95-AG-2uX">
<rect key="frame" x="132" y="27" width="48" height="16"/>
<rect key="frame" x="68" y="27" width="44" height="15"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="44" id="lBX-qz-7jM"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -130,15 +166,14 @@
<constraint firstItem="yzZ-6b-Jou" firstAttribute="leading" secondItem="r2o-8G-3Cv" secondAttribute="leading" id="8Ys-z7-0ic"/>
<constraint firstAttribute="trailing" secondItem="heX-Mf-T11" secondAttribute="trailing" constant="84" id="LwO-bA-IkU"/>
<constraint firstAttribute="trailing" secondItem="yzZ-6b-Jou" secondAttribute="trailing" id="NnS-Nz-XvI"/>
<constraint firstAttribute="bottom" secondItem="heX-Mf-T11" secondAttribute="bottom" constant="-1" id="SI8-Pr-fmE"/>
<constraint firstAttribute="bottom" secondItem="heX-Mf-T11" secondAttribute="bottom" id="SI8-Pr-fmE"/>
<constraint firstItem="heX-Mf-T11" firstAttribute="leading" secondItem="r2o-8G-3Cv" secondAttribute="leading" id="Xii-Px-eo7"/>
<constraint firstAttribute="height" constant="42" id="Y1G-Es-QFk"/>
<constraint firstAttribute="width" constant="180" id="Y2M-zQ-72a"/>
<constraint firstAttribute="trailing" secondItem="F95-AG-2uX" secondAttribute="trailing" id="ZSo-ff-YeK"/>
<constraint firstItem="heX-Mf-T11" firstAttribute="top" secondItem="yzZ-6b-Jou" secondAttribute="bottom" constant="6" id="nke-Cf-wrp"/>
<constraint firstItem="yzZ-6b-Jou" firstAttribute="top" secondItem="r2o-8G-3Cv" secondAttribute="top" id="nqg-k8-6Zp"/>
<constraint firstItem="F95-AG-2uX" firstAttribute="top" secondItem="yzZ-6b-Jou" secondAttribute="bottom" constant="6" id="pYP-hY-4tg"/>
<constraint firstAttribute="bottom" secondItem="F95-AG-2uX" secondAttribute="bottom" constant="-1" id="wrw-dm-07W"/>
<constraint firstAttribute="bottom" secondItem="F95-AG-2uX" secondAttribute="bottom" id="wrw-dm-07W"/>
</constraints>
<variation key="default">
<mask key="constraints">
@ -175,6 +210,7 @@
<outlet property="distanceToNextAction" destination="sMk-g9-2oJ" id="bjw-PH-BYo"/>
<outlet property="distanceToNextActionUnits" destination="Vo5-Yp-xWN" id="8Cy-zx-hPd"/>
<outlet property="eta" destination="yzZ-6b-Jou" id="cnG-M1-dFR"/>
<outlet property="roundRoadLabel" destination="Vrh-bu-AbG" id="0YE-g0-pTM"/>
</connections>
<point key="canvasLocation" x="369" y="261"/>
</view>

View file

@ -18,6 +18,7 @@
@property (weak, nonatomic) IBOutlet UILabel * distanceLeft;
@property (weak, nonatomic) IBOutlet UILabel * eta;
@property (weak, nonatomic) IBOutlet UILabel * arrivalsTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel * roundRoadLabel;
- (void)configureWithEntity:(MWMNavigationDashboardEntity *)entity;

View file

@ -15,10 +15,14 @@
- (void)configureWithEntity:(MWMNavigationDashboardEntity *)entity
{
self.direction.image = entity.turnImage;
if (!entity.isPedestrian)
self.direction.transform = CGAffineTransformIdentity;
self.distanceToNextAction.text = entity.distanceToTurn;
self.distanceToNextActionUnits.text = entity.turnUnits;
self.distanceLeft.text = [NSString stringWithFormat:@"%@ %@", entity.targetDistance, entity.targetUnits];
self.eta.text = [NSDateFormatter estimatedArrivalTimeWithSeconds:@(entity.timeToTarget)];
self.arrivalsTimeLabel.text = [NSDateFormatter localizedStringFromDate:[[NSDate date] dateByAddingTimeInterval:entity.timeToTarget] dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
self.roundRoadLabel.text = entity.roundExitNumber ? @(entity.roundExitNumber).stringValue : @"";
}
@end

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
@ -40,14 +40,32 @@
<constraint firstAttribute="width" constant="52" id="xGv-2r-BQ7"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tmo-Mk-HBF" userLabel="exit">
<rect key="frame" x="5" y="16" width="42" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="MJv-jd-lKn"/>
<constraint firstAttribute="width" constant="42" id="ST5-eh-bxs"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="bold17"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="w7a-mi-GxC">
<rect key="frame" x="60" y="5" width="21" height="42"/>
<rect key="frame" x="60" y="5" width="20.5" height="42"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="36"/>
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium36"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="km" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vQs-gj-DUL">
<rect key="frame" x="81" y="21" width="26" height="22"/>
<rect key="frame" x="81.5" y="21" width="26" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="21.5" id="8Id-se-VcH"/>
<constraint firstAttribute="height" constant="21.5" id="Hag-8H-qLV"/>
@ -57,6 +75,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="18"/>
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium18"/>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
<exclude reference="8Id-se-VcH"/>
@ -71,6 +93,8 @@
<constraint firstItem="vcg-Bu-8CX" firstAttribute="top" secondItem="8Zr-ul-QD4" secondAttribute="top" id="B2K-uh-ENJ"/>
<constraint firstItem="vcg-Bu-8CX" firstAttribute="leading" secondItem="8Zr-ul-QD4" secondAttribute="leading" id="DNa-pK-w4t"/>
<constraint firstAttribute="bottom" secondItem="w7a-mi-GxC" secondAttribute="bottom" constant="5" id="Gqm-CL-ck0"/>
<constraint firstItem="vcg-Bu-8CX" firstAttribute="centerX" secondItem="Tmo-Mk-HBF" secondAttribute="centerX" id="Lyu-ef-srt"/>
<constraint firstItem="vcg-Bu-8CX" firstAttribute="centerY" secondItem="Tmo-Mk-HBF" secondAttribute="centerY" id="PbW-09-NyW"/>
<constraint firstAttribute="trailing" secondItem="vQs-gj-DUL" secondAttribute="trailing" id="PeX-D3-WSc"/>
<constraint firstItem="vQs-gj-DUL" firstAttribute="leading" secondItem="w7a-mi-GxC" secondAttribute="trailing" constant="1" id="S4k-of-Pfg"/>
<constraint firstAttribute="width" constant="190" id="aes-L3-OVF"/>
@ -104,12 +128,20 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium18"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="10 km" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="w2P-mo-JWt">
<rect key="frame" x="0.0" y="26" width="96" height="16"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -153,6 +185,7 @@
<outlet property="distanceToNextAction" destination="w7a-mi-GxC" id="8SR-Qv-Udp"/>
<outlet property="distanceToNextActionUnits" destination="vQs-gj-DUL" id="OOE-0F-Y8v"/>
<outlet property="eta" destination="fLt-4z-zaW" id="C1L-bX-xd5"/>
<outlet property="roundRoadLabel" destination="Tmo-Mk-HBF" id="K74-y4-vwk"/>
</connections>
<point key="canvasLocation" x="369" y="261"/>
</view>

View file

@ -48,10 +48,8 @@ static CGFloat const kStatusbarHeight = 20.0;
[UIView animateWithDuration:0.2 animations:^
{
if (!CGRectEqualToRect(self.frame, self.defaultFrame))
{
self.frame = self.defaultFrame;
[self layoutStatusbar];
}
[self layoutStatusbar];
}
completion:^(BOOL finished)
{
@ -85,13 +83,13 @@ static CGFloat const kStatusbarHeight = 20.0;
- (void)setTopBound:(CGFloat)topBound
{
_topBound = MAX(topBound, kStatusbarHeight);
[self layoutSubviews];
[self setNeedsLayout];
}
- (void)setIsVisible:(BOOL)isVisible
{
_isVisible = isVisible;
[self layoutSubviews];
[self setNeedsLayout];
}
- (CGFloat)visibleHeight

View file

@ -32,6 +32,9 @@
<userDefinedRuntimeAttribute type="color" keyPath="layer.shadowUIColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.23999999999999999" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_start"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="whitePrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="navigationGoPressed:" destination="-1" eventType="touchUpInside" id="oB1-g0-g7y"/>
@ -77,6 +80,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.26000000000000001" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackHintText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -98,6 +105,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="dist" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ziN-lg-ual">
<rect key="frame" x="66" y="0.0" width="31" height="20"/>
@ -107,6 +118,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Arrivals time in progress" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0NR-QB-wCJ">
<rect key="frame" x="135" y="0.0" width="183" height="20"/>
@ -116,6 +131,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -141,7 +160,6 @@
<state key="normal" image="ic_walk_off">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="ic_walk_disable"/>
<state key="selected" image="ic_walk_on"/>
<connections>
<action selector="routePreviewChange:" destination="-1" eventType="touchUpInside" id="bf4-fQ-DLf"/>
@ -152,7 +170,6 @@
<state key="normal" image="ic_drive_off">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="ic_drive_disable"/>
<state key="selected" image="ic_drive_on"/>
<connections>
<action selector="routePreviewChange:" destination="-1" eventType="touchUpInside" id="XHs-7h-PYO"/>
@ -223,11 +240,9 @@
</objects>
<resources>
<image name="ic_cancel" width="40" height="40"/>
<image name="ic_drive_disable" width="40" height="40"/>
<image name="ic_drive_off" width="40" height="40"/>
<image name="ic_drive_on" width="40" height="40"/>
<image name="ic_spinner_close_1" width="40" height="40"/>
<image name="ic_walk_disable" width="40" height="40"/>
<image name="ic_walk_off" width="40" height="40"/>
<image name="ic_walk_on" width="40" height="40"/>
</resources>

View file

@ -32,6 +32,9 @@
<userDefinedRuntimeAttribute type="color" keyPath="layer.shadowUIColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.23999999999999999" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="routing_start"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="whitePrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="navigationGoPressed:" destination="-1" eventType="touchUpInside" id="Ftg-bM-Sht"/>
@ -74,7 +77,6 @@
<state key="normal" image="ic_walk_off">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="ic_walk_disable"/>
<state key="selected" image="ic_walk_on"/>
<connections>
<action selector="routePreviewChange:" destination="-1" eventType="touchUpInside" id="p1B-We-5Eo"/>
@ -85,7 +87,6 @@
<state key="normal" image="ic_drive_off">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="ic_drive_disable"/>
<state key="selected" image="ic_drive_on"/>
<connections>
<action selector="routePreviewChange:" destination="-1" eventType="touchUpInside" id="PmK-Z7-ySd"/>
@ -117,6 +118,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.26000000000000001" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackHintText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -139,6 +144,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium17"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="dist" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z2M-yN-YAq">
<rect key="frame" x="66" y="0.0" width="80" height="20"/>
@ -150,6 +159,10 @@
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
<exclude reference="HJX-Qb-nzT"/>
@ -227,11 +240,9 @@
</objects>
<resources>
<image name="ic_cancel" width="40" height="40"/>
<image name="ic_drive_disable" width="40" height="40"/>
<image name="ic_drive_off" width="40" height="40"/>
<image name="ic_drive_on" width="40" height="40"/>
<image name="ic_spinner_close_1" width="40" height="40"/>
<image name="ic_walk_disable" width="40" height="40"/>
<image name="ic_walk_off" width="40" height="40"/>
<image name="ic_walk_on" width="40" height="40"/>
</resources>

View file

@ -23,6 +23,7 @@
- (void)configureWithEntity:(MWMNavigationDashboardEntity *)entity;
- (void)statePlaning;
- (void)stateError;
- (void)showGoButtonAnimated:(BOOL)show;

View file

@ -9,6 +9,7 @@
#import "MWMNavigationDashboardEntity.h"
#import "MWMRoutePreview.h"
#import "TimeUtils.h"
#import "UIColor+MapsMeColor.h"
#import "UIKitCategories.h"
@interface MWMRoutePreview ()
@ -17,7 +18,6 @@
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * goButtonVerticalOffset;
@property (weak, nonatomic) IBOutlet UIView * statusBox;
@property (weak, nonatomic) IBOutlet UIView * completeBox;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * goButtonHeight;
@property (nonatomic) BOOL showGoButton;
@ -37,6 +37,14 @@
{
self.timeLabel.text = [NSDateFormatter estimatedArrivalTimeWithSeconds:@(entity.timeToTarget)];
self.distanceLabel.text = [NSString stringWithFormat:@"%@ %@", entity.targetDistance, entity.targetUnits];
self.arrivalsLabel.text = [NSString stringWithFormat:@"%@ %@", L(@"routing_arrive"), [NSDateFormatter localizedStringFromDate:[[NSDate date] dateByAddingTimeInterval:entity.timeToTarget] dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle]];
}
- (void)remove
{
[super remove];
self.pedestrian.enabled = YES;
self.vehicle.enabled = YES;
}
- (void)statePlaning
@ -46,17 +54,26 @@
self.completeBox.hidden = YES;
self.spinner.hidden = NO;
self.cancelButton.hidden = YES;
self.status.text = L(@"routing_planning");
self.status.textColor = UIColor.blackHintText;
NSUInteger const capacity = 12;
NSMutableArray * images = [NSMutableArray arrayWithCapacity:capacity];
for (int i = 1; i != capacity; ++i)
[images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"ic_spinner_close_%@", @(i)]]];
for (int i = 0; i < capacity; ++i)
images[i] = [UIImage imageNamed:[NSString stringWithFormat:@"ic_spinner_close_%@", @(i + 1)]];
self.spinner.imageView.animationImages = images.copy;
self.spinner.imageView.animationDuration = .5;
self.spinner.imageView.animationImages = images;
[self.spinner.imageView startAnimating];
}
- (void)stateError
{
self.spinner.hidden = YES;
self.cancelButton.hidden = NO;
self.status.text = L(@"routing_planning_error");
self.status.textColor = UIColor.red;
}
- (void)showGoButtonAnimated:(BOOL)show
{
[self layoutIfNeeded];

View file

@ -234,11 +234,6 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
[self.delegate dragPlacePage:point];
}
- (void)onLocationError:(location::TLocationError)errorCode
{
NSLog(@"Location error %i in %@", errorCode, [[self class] className]);
}
- (void)onLocationUpdate:(location::GpsInfo const &)info
{
[self updateDistance];

View file

@ -160,64 +160,15 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
- (void)updateRoutingInfo
{
Framework & frm = GetFramework();
if (frm.IsRoutingActive())
{
location::FollowingInfo res;
frm.GetRouteFollowingInfo(res);
if (!frm.IsRoutingActive())
return;
if (res.IsValid())
{
[self.controlsManager setupRoutingDashboard:res];
// NSMutableDictionary *routeInfo = [NSMutableDictionary dictionaryWithCapacity:7];
// routeInfo[@"timeToTarget"] = @(res.m_time);
// routeInfo[@"targetDistance"] = [NSString stringWithUTF8String:res.m_distToTarget.c_str()];
// routeInfo[@"targetMetrics"] = [NSString stringWithUTF8String:res.m_targetUnitsSuffix.c_str()];
// routeInfo[@"turnDistance"] = [NSString stringWithUTF8String:res.m_distToTurn.c_str()];
// routeInfo[@"turnMetrics"] = [NSString stringWithUTF8String:res.m_turnUnitsSuffix.c_str()];
// routeInfo[@"turnType"] = [self turnTypeToImage:res.m_turn];
// static NSNumber * turnTypeValue;
// if (res.m_turn == routing::turns::TurnDirection::EnterRoundAbout)
// turnTypeValue = @(res.m_exitNum);
// else if (res.m_turn != routing::turns::TurnDirection::StayOnRoundAbout)
// turnTypeValue = nil;
// if (turnTypeValue)
// [routeInfo setObject:turnTypeValue forKey:@"turnTypeValue"];
//
// [self.routeView updateWithInfo:routeInfo];
}
}
location::FollowingInfo res;
frm.GetRouteFollowingInfo(res);
if (res.IsValid())
[self.controlsManager setupRoutingDashboard:res];
}
//
//- (NSString *)turnTypeToImage:(routing::turns::TurnDirection)type
//{
// using namespace routing::turns;
// switch (type)
// {
// case TurnDirection::TurnSlightRight:
// return @"right-1";
// case TurnDirection::TurnRight:
// return @"right-2";
// case TurnDirection::TurnSharpRight:
// return @"right-3";
//
// case TurnDirection::TurnSlightLeft:
// return @"left-1";
// case TurnDirection::TurnLeft:
// return @"left-2";
// case TurnDirection::TurnSharpLeft:
// return @"left-3";
//
// case TurnDirection::UTurn:
// return @"turn-around";
//
// case TurnDirection::LeaveRoundAbout:
// case TurnDirection::StayOnRoundAbout:
// case TurnDirection::EnterRoundAbout:
// return @"circle";
//
// default: return @"straight";
// }
//}
- (void)onCompassUpdate:(location::CompassInfo const &)info
{
@ -254,8 +205,12 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
- (void)restoreRoute
{
GetFramework().BuildRoute(self.restoreRouteDestination, 0 /* timeoutSec */);
self.forceRoutingStateChange = ForceRoutingStateChangeStartFollowing;
auto & f = GetFramework();
CLLocationCoordinate2D const lastCoordinate ([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate);
m2::PointD const lastCoordinatePoint (MercatorBounds::LonToX(lastCoordinate.longitude), MercatorBounds::LatToY(lastCoordinate.latitude));
f.SetRouter(f.GetBestRouter(lastCoordinatePoint, self.restoreRouteDestination));
GetFramework().BuildRoute(self.restoreRouteDestination, 0 /* timeoutSec */);
}
#pragma mark - Map Navigation
@ -574,7 +529,6 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
{
[super viewDidLoad];
self.view.clipsToBounds = YES;
// [self.view addSubview:self.routeViewWrapper];
self.controlsManager = [[MWMMapViewControlsManager alloc] initWithParentController:self];
[self.view addSubview:self.searchView];
__weak MapViewController * weakSelf = self;
@ -715,15 +669,16 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
f.GetBalloonManager().Dismiss();
[self.searchView setState:SearchViewStateHidden animated:YES];
[self performAfterDelay:0.3 block:^
{
// if (self.forceRoutingStateChange == ForceRoutingStateChangeStartFollowing)
// [self routeViewDidStartFollowing:self.routeView];
// else
// [self.routeView setState:RouteViewStateInfo animated:YES];
//TODO(Vlad): Implement logic for restore route.
[self.controlsManager routingReady];
{
if (self.forceRoutingStateChange == ForceRoutingStateChangeStartFollowing)
[self.controlsManager routingNavigation];
else
[self.controlsManager routingReady];
[self updateRoutingInfo];
}];
self.forceRoutingStateChange = ForceRoutingStateChangeNone;
}];
bool isDisclaimerApproved = false;
(void)Settings::Get("IsDisclaimerApproved", isDisclaimerApproved);
@ -734,18 +689,21 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
}
break;
}
//TODO(Vlad): Implement routing error handler in new navigation UI.
case routing::IRouter::RouteFileNotExist:
case routing::IRouter::InconsistentMWMandRoute:
case routing::IRouter::NeedMoreMaps:
case routing::IRouter::FileTooOld:
case routing::IRouter::RouteNotFound:
[self.controlsManager handleRoutingError];
[self presentDownloaderAlert:code countries:absentCountries routes:absentRoutes];
self.forceRoutingStateChange = ForceRoutingStateChangeNone;
break;
case routing::IRouter::Cancelled:
break;
default:
[self.controlsManager handleRoutingError];
[self presentDefaultAlert:code];
self.forceRoutingStateChange = ForceRoutingStateChangeNone;
break;
}
});

View file

@ -248,11 +248,6 @@ static BOOL keyboardLoaded = NO;
[self.delegate searchViewDidEnterState:state];
}
- (void)onLocationError:(location::TLocationError)errorCode
{
NSLog(@"Location error %i in %@", errorCode, self);
}
- (void)onLocationUpdate:(location::GpsInfo const &)info
{
if (self.state == SearchViewStateFullscreen && ![self isShowingCategories])

View file

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "ic_drive_disable.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "ic_drive_disable@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "ic_drive_disable@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

View file

@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "ic_walk_disable.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "ic_walk_disable@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "ic_walk_disable@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -8,11 +8,10 @@
@protocol LocationObserver
@required
- (void)onLocationError:(location::TLocationError)errorCode;
- (void)onLocationUpdate:(location::GpsInfo const &)info;
@optional
- (void)onCompassUpdate:(location::CompassInfo const &)info;
- (void)onLocationError:(location::TLocationError)errorCode;
- (void)onLocationUpdate:(location::GpsInfo const &)info;
- (void)onCompassUpdate:(location::CompassInfo const &)info;
@end
@interface LocationManager : NSObject <CLLocationManagerDelegate>

View file

@ -73,12 +73,12 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
break;
case kCLAuthorizationStatusRestricted:
case kCLAuthorizationStatusDenied:
[observer onLocationError:location::EDenied];
[self observer:observer onLocationError:location::EDenied];
break;
}
}
else
[observer onLocationError:location::EDenied];
[self observer:observer onLocationError:location::EDenied];
}
else
{
@ -90,7 +90,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
// (default CLLocationManagerDelegate behaviour)
location::GpsInfo newInfo;
[self location:[self lastLocation] toGpsInfo:newInfo];
[observer onLocationUpdate:newInfo];
[self observer:observer onLocationUpdate:newInfo];
}
}
}
@ -189,7 +189,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
location::GpsInfo newInfo;
[self location:newLocation toGpsInfo:newInfo];
for (id observer in m_observers)
[observer onLocationUpdate:newInfo];
[self observer:observer onLocationUpdate:newInfo];
// TODO(AlexZ): Temporary, remove in the future.
[[Statistics instance] logLocation:newLocation];
}
@ -202,7 +202,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
if (kRequestAuthStatus == kCLAuthorizationStatusAuthorizedAlways && [m_locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
[Alohalytics logEvent:kAlohalyticsLocationRequestAlwaysFailed];
for (id observer in m_observers)
[observer onLocationError:location::EDenied];
[self observer:observer onLocationError:location::EDenied];
}
}
@ -339,4 +339,22 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
[observer onCompassUpdate:newInfo];
}
- (void)observer:(id<LocationObserver>)observer onLocationUpdate:(location::GpsInfo const &)info
{
if ([(NSObject *)observer respondsToSelector:@selector(onLocationUpdate:)])
[observer onLocationUpdate:info];
}
- (void)observer:(id<LocationObserver>)observer onLocationError:(location::TLocationError)errorCode
{
if ([(NSObject *)observer respondsToSelector:@selector(onLocationError:)])
[observer onLocationError:errorCode];
}
- (void)observer:(id<LocationObserver>)observer onCompasUpdate:(location::CompassInfo const &)info
{
if ([(NSObject *)observer respondsToSelector:@selector(onCompassUpdate:)])
[observer onCompassUpdate:info];
}
@end

View file

@ -22,11 +22,13 @@
+ (UIFont *)medium17;
+ (UIFont *)medium18;
+ (UIFont *)medium24;
+ (UIFont *)medium36;
+ (UIFont *)light10;
+ (UIFont *)light12;
+ (UIFont *)light16;
+ (UIFont *)light17;
+ (UIFont *)bold16;
+ (UIFont *)bold17;
+ (UIFont *)bold48;
+ (UIFont *)fontWithName:(NSString *)fontName;

View file

@ -70,6 +70,11 @@ static NSString * const kBoldFont = @"HelveticaNeue-Bold";
return [UIFont fontWithName:kMediumFont size:24];
}
+ (UIFont *)medium36
{
return [UIFont fontWithName:kMediumFont size:36];
}
+ (UIFont *)light10
{
return [UIFont fontWithName:kLightFont size:10];
@ -95,6 +100,11 @@ static NSString * const kBoldFont = @"HelveticaNeue-Bold";
return [UIFont fontWithName:kBoldFont size:16];
}
+ (UIFont *)bold17
{
return [UIFont fontWithName:kBoldFont size:17];
}
+ (UIFont *)bold48
{
return [UIFont fontWithName:kBoldFont size:48];