[ios] Review fixes.

This commit is contained in:
Ilya Grechuhin 2015-07-30 13:52:50 +03:00 committed by Alex Zolotarev
parent 04118c9f51
commit 6d6bd1c266
36 changed files with 192 additions and 180 deletions

View file

@ -33,8 +33,8 @@ typedef void (^CloseAlertCompletion)();
- (void)presentnoWiFiAlertWithName:(nonnull NSString *)name downloadBlock:(nullable RightButtonAction)block;
- (void)closeAlertWithCompletion:(nullable CloseAlertCompletion)completion;
- (nonnull instancetype)init __attribute__((unavailable("-init isn't available, call -initWithViewController: instead!")));
+ (nonnull instancetype)new __attribute__((unavailable("+new isn't available, call -initWithViewController: instead!")));
- (nonnull instancetype)initWithCoder:(nonnull NSCoder *)aDecoder __attribute__((unavailable("-initWithCoder: isn't available, call -initWithViewController: instead!")));
- (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil __attribute__((unavailable("-initWithNibName:bundle: isn't available, call -initWithViewController: instead!")));
- (nonnull instancetype)init __attribute__((unavailable("call -initWithViewController: instead!")));
+ (nonnull instancetype)new __attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithCoder:(nonnull NSCoder *)aDecoder __attribute__((unavailable("call -initWithViewController: instead!")));
- (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil __attribute__((unavailable("call -initWithViewController: instead!")));
@end

View file

@ -23,7 +23,8 @@ NS_ENUM(NSUInteger, MWMDownloadMapRequestState)
@interface MWMDownloadMapRequest : NSObject
- (nonnull instancetype)init __attribute__((unavailable("init is not available")));
- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id <MWMDownloadMapRequestDelegate>)delegate;
- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView
delegate:(nonnull id <MWMDownloadMapRequestDelegate>)delegate;
- (void)showRequest;

View file

@ -37,7 +37,8 @@
@implementation MWMDownloadMapRequest
- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id <MWMDownloadMapRequestDelegate>)delegate
- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView
delegate:(nonnull id <MWMDownloadMapRequestDelegate>)delegate
{
self = [super init];
if (self)
@ -76,11 +77,13 @@
if (self.currentCountryIndex.IsValid())
{
self.mapTitleLabel.text = [NSString stringWithUTF8String:activeMapLayout.GetFormatedCountryName(self.currentCountryIndex).c_str()];
self.mapTitleLabel.text = @(activeMapLayout.GetFormatedCountryName(self.currentCountryIndex).c_str());
LocalAndRemoteSizeT const sizes = activeMapLayout.GetRemoteCountrySizes(self.currentCountryIndex);
self.mapSize = formattedSize(sizes.first);
self.mapAndRouteSize = formattedSize(sizes.first + sizes.second);
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)", L(@"downloader_download_map"), self.mapAndRouteSize] forState:UIControlStateNormal];
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)",
L(@"downloader_download_map"), self.mapAndRouteSize]
forState:UIControlStateNormal];
[self updateState:MWMDownloadMapRequestStateRequestLocation];
}
else
@ -129,7 +132,10 @@
- (IBAction)downloadRoutesTouchUpInside:(nonnull UIButton *)sender
{
sender.selected = !sender.selected;
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)", L(@"downloader_download_map"), sender.selected ? self.mapAndRouteSize : self.mapSize] forState:UIControlStateNormal];
[self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)",
L(@"downloader_download_map"),
sender.selected ? self.mapAndRouteSize : self.mapSize]
forState:UIControlStateNormal];
}
- (IBAction)selectMapTouchUpInside:(nonnull UIButton *)sender

View file

@ -8,23 +8,17 @@
@class SearchView;
typedef NS_ENUM(NSUInteger, MWMAPIBarState)
{
MWMAPIBarStateHidden,
MWMAPIBarStateVisible
};
@protocol MWMAPIBarProtocol <NSObject>
@property (nonnull, nonatomic) SearchView * searchView;
- (void)apiBarDidEnterState:(MWMAPIBarState)state;
- (void)apiBarBecameVisible:(BOOL)visible;
@end
@interface MWMAPIBar : NSObject
@property (nonatomic, readonly) MWMAPIBarState state;
@property (nonatomic, readonly) BOOL isVisible;
@property (nonatomic, readonly) CGRect frame;
- (nonnull instancetype)init __attribute__((unavailable("init is not available")));

View file

@ -19,7 +19,7 @@
@property (nonatomic) IBOutlet UILabel * titleLabel;
@property (weak, nonatomic) UIViewController<MWMAPIBarProtocol> * delegate;
@property (nonatomic) MWMAPIBarState state;
@property (nonatomic, setter = setVisible:) BOOL isVisible;
@end
@ -45,7 +45,7 @@
[UIView animateWithDuration:0.2 animations:^
{
self.rootView.targetY = 0.0;
self.state = MWMAPIBarStateVisible;
self.isVisible = YES;
}];
}
@ -54,7 +54,7 @@
[UIView animateWithDuration:animated ? 0.2 : 0.0 animations:^
{
self.rootView.targetY = -self.rootView.height;
self.state = MWMAPIBarStateHidden;
self.isVisible = NO;
}
completion:^(BOOL finished)
{
@ -84,10 +84,10 @@
#pragma mark - Properties
- (void)setState:(MWMAPIBarState)state
- (void)setVisible:(BOOL)visible
{
_state = state;
[self.delegate apiBarDidEnterState:state];
_isVisible = visible;
[self.delegate apiBarBecameVisible:visible];
}
- (CGRect)frame

View file

@ -22,7 +22,7 @@
<constraint firstAttribute="width" constant="60" id="0Xq-E4-45k"/>
<constraint firstAttribute="height" constant="44" id="TaT-76-6ui"/>
</constraints>
<state key="normal" image="BackArrow">
<state key="normal" image="btn_back_arrow">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@ -83,6 +83,6 @@
</view>
</objects>
<resources>
<image name="BackArrow" width="12" height="20"/>
<image name="btn_back_arrow" width="12" height="20"/>
</resources>
</document>

View file

@ -18,7 +18,8 @@
#import "MWMZoomButtons.h"
#import "RouteState.h"
@interface MWMMapViewControlsManager () <MWMPlacePageViewManagerProtocol, MWMNavigationDashboardManagerDelegate, MWMSideMenuManagerProtocol>
@interface MWMMapViewControlsManager () <MWMPlacePageViewManagerProtocol, MWMNavigationDashboardManagerProtocol,
MWMSideMenuManagerProtocol>
@property (nonatomic) MWMZoomButtons * zoomButtons;
@property (nonatomic) MWMLocationButton * locationButton;
@ -115,7 +116,7 @@
- (void)handleRoutingError
{
[self.navigationManager handleError];
self.navigationManager.state = MWMNavigationDashboardStateError;
}
- (void)buildRouteWithType:(enum routing::RouterType)type
@ -128,11 +129,8 @@
- (void)navigationDashBoardDidUpdate
{
CGFloat const topBound = self.topBound + self.navigationManager.height;
[UIView animateWithDuration:0.2 animations:^
{
[self.zoomButtons setTopBound:topBound];
[self.placePageManager setTopBound:topBound];
}];
[self.zoomButtons setTopBound:topBound];
[self.placePageManager setTopBound:topBound];
}
- (void)didStartFollowing

View file

@ -10,4 +10,4 @@
- (void)sideMenuDidUpdateLayout;
@end
@end

View file

@ -11,6 +11,8 @@
#import "MWMNavigationDashboardEntity.h"
#include "Framework.h"
#include "geometry/distance_on_sphere.hpp"
#include "platform/measurement_utils.hpp"
@implementation MWMNavigationDashboardEntity
@ -36,15 +38,12 @@
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);
CLLocationCoordinate2D const & coordinate ([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate);
ms::LatLon const & directionPos = info.m_pedestrianDirectionPos;
//TODO: Not the best solution, but this solution is temporary and will be replaced in future
MeasurementUtils::FormatDistance(ms::DistanceOnEarth(coordinate.latitude, coordinate.longitude,
directionPos.lat, directionPos.lon), distance);
istringstream is (distance);
string dist;
string units;

View file

@ -7,6 +7,7 @@
//
#import "LocationManager.h"
#import "MWMNavigationViewProtocol.h"
#include "Framework.h"
#include "platform/location.hpp"
@ -15,14 +16,14 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState)
{
MWMNavigationDashboardStateHidden,
MWMNavigationDashboardStatePlanning,
MWMNavigationDashboardStateError,
MWMNavigationDashboardStateReady,
MWMNavigationDashboardStateNavigation
};
@protocol MWMNavigationDashboardManagerDelegate <NSObject>
@protocol MWMNavigationDashboardManagerProtocol <MWMNavigationViewProtocol>
- (void)buildRouteWithType:(enum routing::RouterType)type;
- (void)navigationDashBoardDidUpdate;
- (void)didStartFollowing;
- (void)didCancelRouting;
- (void)updateStatusBarStyle;
@ -40,9 +41,8 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState)
- (instancetype)init __attribute__((unavailable("init is not available")));
- (instancetype)initWithParentView:(UIView *)view delegate:(id<MWMNavigationDashboardManagerDelegate>)delegate;
- (instancetype)initWithParentView:(UIView *)view delegate:(id<MWMNavigationDashboardManagerProtocol>)delegate;
- (void)setupDashboard:(location::FollowingInfo const &)info;
- (void)handleError;
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation;
@end

View file

@ -25,14 +25,14 @@
@property (weak, nonatomic) MWMNavigationDashboard * navigationDashboard;
@property (weak, nonatomic) UIView * ownerView;
@property (weak, nonatomic) id<MWMNavigationDashboardManagerDelegate> delegate;
@property (weak, nonatomic) id<MWMNavigationDashboardManagerProtocol> delegate;
@property (nonatomic, readwrite) MWMNavigationDashboardEntity * entity;
@end
@implementation MWMNavigationDashboardManager
- (instancetype)initWithParentView:(UIView *)view delegate:(id<MWMNavigationDashboardManagerDelegate>)delegate
- (instancetype)initWithParentView:(UIView *)view delegate:(id<MWMNavigationDashboardManagerProtocol>)delegate
{
self = [super init];
if (self)
@ -44,10 +44,12 @@
[NSBundle.mainBundle loadNibNamed:@"MWMPortraitRoutePreview" owner:self options:nil];
[NSBundle.mainBundle loadNibNamed:@"MWMLandscapeRoutePreview" owner:self options:nil];
self.routePreview = isPortrait ? self.routePreviewPortrait : self.routePreviewLandscape;
self.routePreviewPortrait.delegate = self.routePreviewLandscape.delegate = delegate;
[NSBundle.mainBundle loadNibNamed:@"MWMPortraitNavigationDashboard" owner:self options:nil];
[NSBundle.mainBundle loadNibNamed:@"MWMLandscapeNavigationDashboard" owner:self options:nil];
self.navigationDashboard = isPortrait ? self.navigationDashboardPortrait : self.navigationDashboardLandscape;
self.navigationDashboardPortrait.delegate = self.navigationDashboardLandscape.delegate = delegate;
}
return self;
}
@ -56,7 +58,8 @@
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
BOOL const isPortrait = orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown;
BOOL const isPortrait = orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown;
MWMRoutePreview * routePreview = isPortrait ? self.routePreviewPortrait : self.routePreviewLandscape;
if (self.routePreview.isVisible && ![routePreview isEqual:self.routePreview])
{
@ -65,7 +68,8 @@
}
self.routePreview = routePreview;
MWMNavigationDashboard * navigationDashboard = isPortrait ? self.navigationDashboardPortrait : self.navigationDashboardLandscape;
MWMNavigationDashboard * navigationDashboard = isPortrait ? self.navigationDashboardPortrait :
self.navigationDashboardLandscape;
if (self.navigationDashboard.isVisible && ![navigationDashboard isEqual:self.navigationDashboard])
{
[self.navigationDashboard remove];
@ -116,6 +120,7 @@
f.SetRouter(routing::RouterType::Vehicle);
}
f.CloseRouting();
[self showStatePlanning];
[self.delegate buildRouteWithType:f.GetRouter()];
}
@ -182,7 +187,6 @@
{
[self.routePreviewPortrait showGoButtonAnimated:show];
[self.routePreviewLandscape showGoButtonAnimated:show];
[self.delegate navigationDashBoardDidUpdate];
}
#pragma mark - Properties
@ -199,6 +203,10 @@
case MWMNavigationDashboardStatePlanning:
[self showStatePlanning];
break;
case MWMNavigationDashboardStateError:
NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change");
[self handleError];
break;
case MWMNavigationDashboardStateReady:
NSAssert(_state == MWMNavigationDashboardStatePlanning, @"Invalid state change");
[self showStateReady];
@ -209,13 +217,12 @@
}
_state = state;
[self.delegate updateStatusBarStyle];
[self.delegate navigationDashBoardDidUpdate];
}
- (void)setTopBound:(CGFloat)topBound
{
_topBound = self.routePreviewLandscape.topBound = self.routePreviewPortrait.topBound = self.navigationDashboardLandscape.topBound = self.navigationDashboardPortrait.topBound = topBound;
[self.delegate navigationDashBoardDidUpdate];
_topBound = self.routePreviewLandscape.topBound = self.routePreviewPortrait.topBound =
self.navigationDashboardLandscape.topBound = self.navigationDashboardPortrait.topBound = topBound;
}
- (CGFloat)height
@ -226,6 +233,7 @@
return 0.0;
case MWMNavigationDashboardStatePlanning:
case MWMNavigationDashboardStateReady:
case MWMNavigationDashboardStateError:
return self.routePreview.visibleHeight;
case MWMNavigationDashboardStateNavigation:
return self.navigationDashboard.visibleHeight;
@ -234,6 +242,13 @@
#pragma mark - LocationObserver
- (void)onLocationUpdate:(const location::GpsInfo &)info
{
// We don't need information about location update in this class,
// but in LocationObserver protocol this method is required
// since we don't want runtime overhead for introspection.
}
- (void)onCompassUpdate:(location::CompassInfo const &)info
{
auto & f = GetFramework();
@ -249,9 +264,8 @@
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;
CGFloat const angle = ang::AngleTo(ToMercator(location.coordinate),
ToMercator(res.m_pedestrianDirectionPos)) + info.m_bearing;
CGAffineTransform const transform (CGAffineTransformMakeRotation(M_PI_2 - angle));
self.navigationDashboardPortrait.direction.transform = transform;
self.navigationDashboardLandscape.direction.transform = transform;

View file

@ -34,14 +34,14 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZzU-jx-uYa" userLabel="Azimut Box">
<rect key="frame" x="56" y="9" width="190" height="54"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_direction" translatesAutoresizingMaskIntoConstraints="NO" id="1r7-WJ-4zD">
<rect key="frame" x="0.0" y="0.0" width="54" height="54"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_direction" translatesAutoresizingMaskIntoConstraints="NO" id="1r7-WJ-4zD" customClass="MWMImageView">
<rect key="frame" x="0.0" y="0.0" width="52" height="52"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="vnM-Ps-EOE"/>
<constraint firstAttribute="height" constant="52" id="RtV-rS-ooZ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sMk-g9-2oJ">
<rect key="frame" x="62" y="5" width="20.5" 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"/>
@ -51,7 +51,7 @@
</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"/>
<rect key="frame" x="81" y="21" width="26" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="21.5" id="2Xd-X9-QxK"/>
<constraint firstAttribute="height" constant="21.5" id="BJ0-k8-PFK"/>
@ -73,7 +73,7 @@
</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"/>
<rect key="frame" x="5" 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"/>
@ -96,7 +96,6 @@
<constraint firstItem="1r7-WJ-4zD" firstAttribute="leading" secondItem="ZzU-jx-uYa" secondAttribute="leading" id="HK7-8o-2bx"/>
<constraint firstItem="sMk-g9-2oJ" firstAttribute="top" secondItem="ZzU-jx-uYa" secondAttribute="top" constant="5" id="Ixf-kz-eFi"/>
<constraint firstItem="Vo5-Yp-xWN" firstAttribute="leading" secondItem="sMk-g9-2oJ" secondAttribute="trailing" constant="4" id="JKZ-WH-QTe"/>
<constraint firstAttribute="bottom" secondItem="1r7-WJ-4zD" secondAttribute="bottom" id="JsW-d1-58r"/>
<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"/>
@ -104,7 +103,7 @@
<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 firstItem="1r7-WJ-4zD" firstAttribute="centerY" secondItem="Vrh-bu-AbG" secondAttribute="centerY" id="wsB-QZ-xjY"/>
<constraint firstAttribute="height" constant="54" id="y3P-ga-yXV"/>
</constraints>
<variation key="default">

View file

@ -6,10 +6,27 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "Common.h"
#import "MWMNavigationDashboard.h"
#import "MWMNavigationDashboardEntity.h"
#import "TimeUtils.h"
@interface MWMImageView : UIImageView
@end
@implementation MWMImageView
- (void)setCenter:(CGPoint)center
{
//TODO(Vlad): There is hack for "cut" iOS7.
if (isIOSVersionLessThan(8))
return;
[super setCenter:center];
}
@end
@implementation MWMNavigationDashboard
- (void)configureWithEntity:(MWMNavigationDashboardEntity *)entity
@ -21,7 +38,9 @@
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.arrivalsTimeLabel.text = [NSDateFormatter localizedStringFromDate:[[NSDate date]
dateByAddingTimeInterval:entity.timeToTarget]
dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
self.roundRoadLabel.text = entity.roundExitNumber ? @(entity.roundExitNumber).stringValue : @"";
}

View file

@ -34,10 +34,10 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8Zr-ul-QD4" userLabel="Azimut Box">
<rect key="frame" x="56" y="9" width="190" height="52"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_direction" translatesAutoresizingMaskIntoConstraints="NO" id="vcg-Bu-8CX">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_direction" translatesAutoresizingMaskIntoConstraints="NO" id="vcg-Bu-8CX" customClass="MWMImageView">
<rect key="frame" x="0.0" y="0.0" width="52" height="52"/>
<constraints>
<constraint firstAttribute="width" constant="52" id="xGv-2r-BQ7"/>
<constraint firstAttribute="height" constant="52" id="sYu-4K-mVB"/>
</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">
@ -55,7 +55,7 @@
</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="20.5" height="42"/>
<rect key="frame" x="60" y="5" width="20.5" height="43"/>
<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"/>
@ -65,7 +65,7 @@
</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.5" y="21" width="26" height="22"/>
<rect key="frame" x="81" y="22" 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"/>
@ -92,30 +92,13 @@
<constraint firstAttribute="height" constant="52" id="0A6-z9-DaT"/>
<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"/>
<constraint firstItem="w7a-mi-GxC" firstAttribute="baseline" secondItem="vQs-gj-DUL" secondAttribute="baseline" id="fEx-bU-M8d"/>
<constraint firstItem="vQs-gj-DUL" firstAttribute="leading" secondItem="w7a-mi-GxC" secondAttribute="trailing" constant="3.5" id="jOo-j5-LYo"/>
<constraint firstAttribute="bottom" secondItem="vcg-Bu-8CX" secondAttribute="bottom" id="kjG-Xr-g7l"/>
<constraint firstItem="w7a-mi-GxC" firstAttribute="top" secondItem="8Zr-ul-QD4" secondAttribute="top" constant="5" id="lon-V9-cUc"/>
<constraint firstItem="vQs-gj-DUL" firstAttribute="leading" secondItem="w7a-mi-GxC" secondAttribute="trailing" constant="4" id="mvA-aH-9kW"/>
<constraint firstItem="w7a-mi-GxC" firstAttribute="baseline" secondItem="vQs-gj-DUL" secondAttribute="baseline" id="ukP-6L-edS"/>
<constraint firstItem="vQs-gj-DUL" firstAttribute="leading" secondItem="w7a-mi-GxC" secondAttribute="trailing" constant="4" id="vx0-h4-VxL"/>
<constraint firstItem="w7a-mi-GxC" firstAttribute="leading" secondItem="vcg-Bu-8CX" secondAttribute="trailing" constant="8" id="zgG-1s-uba"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="ukP-6L-edS"/>
<exclude reference="PeX-D3-WSc"/>
<exclude reference="jOo-j5-LYo"/>
<exclude reference="mvA-aH-9kW"/>
<exclude reference="vx0-h4-VxL"/>
</mask>
</variation>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BLc-UX-Tny" userLabel="Distance Box">
<rect key="frame" x="216" y="14" width="96" height="42"/>
@ -164,6 +147,7 @@
<constraint firstItem="CJi-qt-H0B" firstAttribute="leading" secondItem="9t0-Kj-KTa" secondAttribute="leading" id="KWV-js-hmR"/>
<constraint firstItem="BLc-UX-Tny" firstAttribute="top" secondItem="9t0-Kj-KTa" secondAttribute="top" constant="14" id="Tp6-iR-eSY"/>
<constraint firstItem="CJi-qt-H0B" firstAttribute="top" secondItem="9t0-Kj-KTa" secondAttribute="top" constant="16" id="X51-ti-88P"/>
<constraint firstAttribute="trailing" secondItem="8Zr-ul-QD4" secondAttribute="trailing" constant="74" id="Y1J-hh-1YM"/>
<constraint firstAttribute="trailing" secondItem="BLc-UX-Tny" secondAttribute="trailing" constant="8" id="uOC-Km-Ny3"/>
<constraint firstItem="8Zr-ul-QD4" firstAttribute="top" secondItem="9t0-Kj-KTa" secondAttribute="top" constant="9" id="vHg-jJ-TAh"/>
</constraints>

View file

@ -6,6 +6,7 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "MWMNavigationViewProtocol.h"
#import "UIKitCategories.h"
@interface MWMNavigationView : SolidTouchView
@ -13,6 +14,7 @@
@property (nonatomic) CGFloat topBound;
@property (nonatomic, readonly) CGFloat visibleHeight;
@property (nonatomic, readonly) BOOL isVisible;
@property (weak, nonatomic) id<MWMNavigationViewProtocol> delegate;
- (void)addToView:(UIView *)superview;
- (void)remove;

View file

@ -49,7 +49,8 @@ static CGFloat const kStatusbarHeight = 20.0;
{
if (!CGRectEqualToRect(self.frame, self.defaultFrame))
self.frame = self.defaultFrame;
[self layoutStatusbar];
self.statusbarBackground.frame = CGRectMake(0.0, -kStatusbarHeight, self.width, kStatusbarHeight);
[self.delegate navigationDashBoardDidUpdate];
}
completion:^(BOOL finished)
{
@ -59,30 +60,26 @@ static CGFloat const kStatusbarHeight = 20.0;
[super layoutSubviews];
}
- (void)layoutStatusbar
{
if (self.topBound <= kStatusbarHeight)
{
if (![self.statusbarBackground.superview isEqual:self])
[self addSubview:self.statusbarBackground];
self.statusbarBackground.frame = CGRectMake(0.0, -kStatusbarHeight, self.width, kStatusbarHeight);
}
else
{
[self.statusbarBackground removeFromSuperview];
}
}
#pragma mark - Properties
- (CGRect)defaultFrame
{
return CGRectMake(0.0, self.isVisible ? self.topBound : -self.defaultHeight, self.superview.width, self.defaultHeight);
return CGRectMake(0.0, self.isVisible ? self.topBound :
-self.defaultHeight, self.superview.width, self.defaultHeight);
}
- (void)setTopBound:(CGFloat)topBound
{
_topBound = MAX(topBound, kStatusbarHeight);
if (_topBound <= kStatusbarHeight)
{
if (![self.statusbarBackground.superview isEqual:self])
[self addSubview:self.statusbarBackground];
}
else
{
[self.statusbarBackground removeFromSuperview];
}
[self setNeedsLayout];
}

View file

@ -0,0 +1,13 @@
//
// MWMNavigationViewProtocol.h
// Maps
//
// Created by Ilya Grechuhin on 30.07.15.
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
@protocol MWMNavigationViewProtocol <NSObject>
- (void)navigationDashBoardDidUpdate;
@end

View file

@ -37,7 +37,11 @@
{
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]];
NSString * arriveStr = [NSDateFormatter localizedStringFromDate:[[NSDate date]
dateByAddingTimeInterval:entity.timeToTarget]
dateStyle:NSDateFormatterNoStyle
timeStyle:NSDateFormatterShortStyle];
self.arrivalsLabel.text = [NSString stringWithFormat:@"%@ %@", L(@"routing_arrive"), arriveStr];
}
- (void)remove

View file

@ -284,13 +284,10 @@ typedef void (^CompletionHandler)(UIBackgroundFetchResult);
{
/// @todo Fix this logic after Framework -> CountryTree -> ActiveMapLayout refactoring.
/// Call download via Framework.
Framework & f = GetFramework();
f.GetCountryTree().GetActiveMapLayout().DownloadMap(index, MapOptions::Map);
m2::RectD const rect = f.GetCountryBounds(index);
double const lon = MercatorBounds::XToLon(rect.Center().x);
double const lat = MercatorBounds::YToLat(rect.Center().y);
f.ShowRect(lat, lon, 10);
double const defaultZoom = 10;
f.ShowRect(f.GetCountryBounds(index).Center(), defaultZoom);
}
- (NSString *)flagStringForIndex:(TIndex)index
@ -341,7 +338,7 @@ typedef void (^CompletionHandler)(UIBackgroundFetchResult);
{
Framework & f = GetFramework();
CLLocation * lastLocation = [locations lastObject];
TIndex const index = f.GetCountryIndex(MercatorBounds::FromLatLon(lastLocation.coordinate.latitude, lastLocation.coordinate.longitude));
TIndex const index = f.GetCountryIndex(ToMercator(lastLocation.coordinate));
if (index.IsValid() && [self shouldShowNotificationForIndex:index])
{

View file

@ -46,6 +46,6 @@
- (void)setDistance:(NSString *)distance;
- (void)updateMyPositionStatus:(NSString *)status;
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithManager: instead")));
- (instancetype)init __attribute__((unavailable("call initWithManager: instead")));
@end

View file

@ -18,8 +18,8 @@
+ (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage;
- (void)configureForMyPosition:(BOOL)isMyPosition;
- (instancetype)init __attribute__((unavailable("init is unavailable, call actionBarForPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("initWithCoder: is unavailable, call actionBarForPlacePage: instead")));
- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame: is unavailable, call actionBarForPlacePage: instead")));
- (instancetype)init __attribute__((unavailable("call actionBarForPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("call actionBarForPlacePage: instead")));
- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("call actionBarForPlacePage: instead")));
@end

View file

@ -16,8 +16,8 @@
+ (void)showNavigationBarForPlacePage:(MWMiPhonePortraitPlacePage *)placePage;
+ (void)remove;
- (instancetype)init __attribute__((unavailable("init is unavailable, call navigationBarWithPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("initWithCoder: is unavailable, call navigationBarWithPlacePage: instead")));
- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame: is unavailable, call navigationBarWithPlacePage: instead")));
- (instancetype)init __attribute__((unavailable("call navigationBarWithPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("call navigationBarWithPlacePage: instead")));
- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("call navigationBarWithPlacePage: instead")));
@end

View file

@ -36,6 +36,6 @@
- (void)hideDirectionView;
- (void)addSubviews:(NSArray *)views withNavigationController:(UINavigationController *)controller;
- (instancetype)init __attribute__((unavailable("init is unavailable, call initWithViewController: instead")));
- (instancetype)init __attribute__((unavailable("call initWithViewController: instead")));
@end

View file

@ -172,10 +172,8 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
{
auto & f = GetFramework();
m2::PointD const & destination = m_userMark->GetUserMark()->GetOrg();
CLLocationCoordinate2D const & myCoordinate = [MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate;
m2::PointD const myPosition {MercatorBounds::LonToX(myCoordinate.longitude), MercatorBounds::LatToY(myCoordinate.latitude)};
routing::RouterType const actualyRoterType = f.GetBestRouter(myPosition, destination);
f.SetRouter(actualyRoterType);
m2::PointD const myPosition (ToMercator([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate));
f.SetRouter(f.GetBestRouter(myPosition, destination));
[self.delegate buildRoute:destination];
}
@ -268,8 +266,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
if (!location || !m_userMark)
return;
CLLocationCoordinate2D const coord = location.coordinate;
CGFloat angle = ang::AngleTo(MercatorBounds::FromLatLon(coord.latitude, coord.longitude), m_userMark->GetUserMark()->GetOrg()) + info.m_bearing;
CGFloat const angle = ang::AngleTo(ToMercator(location.coordinate), m_userMark->GetUserMark()->GetOrg()) + info.m_bearing;
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2 - angle);
[self.placePage setDirectionArrowTransform:transform];
[self.directionView setDirectionArrowTransform:transform];

View file

@ -203,9 +203,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
{
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));
f.SetRouter(f.GetBestRouter(ToMercator([MapsAppDelegate theApp].m_locationManager.lastLocation.coordinate), self.restoreRouteDestination));
GetFramework().BuildRoute(self.restoreRouteDestination, 0 /* timeoutSec */);
}
@ -555,13 +553,18 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
- (UIStatusBarStyle)preferredStatusBarStyle
{
if (self.apiBar.state == MWMAPIBarStateVisible)
if (self.apiBar.isVisible)
{
return UIStatusBarStyleLightContent;
}
else
{
if (self.searchView.state != SearchViewStateHidden || self.controlsManager.menuState == MWMSideMenuStateActive || self.controlsManager.isDirectionViewShown || (GetFramework().GetMapStyle() == MapStyleDark && self.controlsManager.navigationState == MWMNavigationDashboardStateHidden))
BOOL const isLight = self.searchView.state != SearchViewStateHidden ||
self.controlsManager.menuState == MWMSideMenuStateActive ||
self.controlsManager.isDirectionViewShown ||
(GetFramework().GetMapStyle() == MapStyleDark &&
self.controlsManager.navigationState == MWMNavigationDashboardStateHidden);
if (isLight)
return UIStatusBarStyleLightContent;
return UIStatusBarStyleDefault;
}
@ -695,6 +698,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
self.forceRoutingStateChange = ForceRoutingStateChangeNone;
break;
case routing::IRouter::Cancelled:
self.forceRoutingStateChange = ForceRoutingStateChangeNone;
break;
default:
[self.controlsManager handleRoutingError];
@ -723,9 +727,9 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
[self.apiBar show];
}
- (void)apiBarDidEnterState:(MWMAPIBarState)state
- (void)apiBarBecameVisible:(BOOL)visible
{
if (state == MWMAPIBarStateVisible)
if (visible)
{
[self setMapInfoViewFlag:MapInfoViewAPIBar];
CGRect const apiRect = self.apiBar.frame;

View file

@ -388,22 +388,6 @@ static BOOL keyboardLoaded = NO;
return YES;
}
//TODO(Vlad): Remove this code after new routing UI will be implement.
- (BOOL)tryToChangeRoutingModeCmd:(NSString *)cmd
{
BOOL const isPedestrian = [cmd isEqualToString:@"?pedestrian"];
BOOL const isVehicle = [cmd isEqualToString:@"?vehicle"];
if (!isPedestrian && !isVehicle)
return NO;
GetFramework().SetRouter(isPedestrian ? routing::RouterType::Pedestrian : routing::RouterType::Vehicle);
[self searchBarDidPressCancelButton:nil];
return YES;
}
- (void)textFieldTextChanged:(id)sender
{
NSString * currentText = self.searchBar.textField.text;

View file

@ -1,12 +1,13 @@
#import "LocationManager.h"
#import "ShareActionSheet.h"
#import "Framework.h"
#import <MessageUI/MFMessageComposeViewController.h>
#import <MessageUI/MFMailComposeViewController.h>
#import "Statistics.h"
#import "UIKitCategories.h"
#include "../../search/result.hpp"
#include "Framework.h"
#include "search/result.hpp"
@implementation ShareInfo
@ -87,7 +88,7 @@
if (self.info.myPosition)
{
search::AddressInfo info;
GetFramework().GetAddressInfoForGlobalPoint(m2::PointD(MercatorBounds::LonToX(self.info.lon), MercatorBounds::LatToY(self.info.lat)), info);
GetFramework().GetAddressInfoForGlobalPoint(MercatorBounds::FromLatLon(self.info.lat, self.info.lon), info);
NSString * nameAndAddress = [NSString stringWithUTF8String:info.FormatNameAndAddress().c_str()];
body = [NSString stringWithFormat:L(@"my_position_share_email"), nameAndAddress, shortUrl, httpGe0Url];
subject = L(@"my_position_share_email_subject");

View file

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

View file

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View file

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 413 B

View file

@ -15,6 +15,8 @@
28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; };
340F24631B14910500F874CD /* RouteState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 340F24621B14910500F874CD /* RouteState.mm */; };
341522BF1B666A550077AA8F /* MWMAPIBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 341522BE1B666A550077AA8F /* MWMAPIBarView.m */; };
341C2A571B72092A00AD41A1 /* 02_droidsans-fallback.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */; };
341C2A5B1B720B8A00AD41A1 /* MWMAPIBarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 341C2A5A1B720B8A00AD41A1 /* MWMAPIBarView.xib */; };
34287FDC1B3D7C4800F9959C /* libFlurry_6.4.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34287FDB1B3D7C4800F9959C /* libFlurry_6.4.0.a */; };
3428BC131B55477E00C85B30 /* MWMSideMenuDownloadBadge.m in Sources */ = {isa = PBXBuildFile; fileRef = 3428BC121B55477E00C85B30 /* MWMSideMenuDownloadBadge.m */; };
342AD76F1B53D30C00E0B997 /* UIButton+RuntimeAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 342AD76E1B53D30C00E0B997 /* UIButton+RuntimeAttributes.m */; };
@ -35,7 +37,6 @@
345C31781AE799B600EA0CC2 /* MWMSearchResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 345C31751AE799B600EA0CC2 /* MWMSearchResultCell.m */; };
345C31791AE799B600EA0CC2 /* MWMSearchResultController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345C31771AE799B600EA0CC2 /* MWMSearchResultController.mm */; };
3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */; };
3465E7DD1B6658EB00854C4D /* MWMAPIBarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */; };
347274731B0F4EE000756B37 /* me.maps.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274721B0F4EE000756B37 /* me.maps.entitlements */; };
347274771B0F4F3900756B37 /* me.maps.watchkitextension.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */; };
347274791B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */; };
@ -92,7 +93,6 @@
4579C89F1AD2FA36001D6B90 /* packed_polygons.bin in Resources */ = {isa = PBXBuildFile; fileRef = FA85F632145DDDC20090E1A0 /* packed_polygons.bin */; };
4579C8A01AD2FAB1001D6B90 /* 00_roboto_regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FAF30A94173AB23900818BF6 /* 00_roboto_regular.ttf */; };
4579C8A11AD2FAB1001D6B90 /* 01_dejavusans.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */; };
9DF04B241B71010E00DACAF1 /* 02_droidsans-fallback.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */; };
4579C8A31AD2FAB1001D6B90 /* 03_jomolhari-id-a3d.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E7134C4968003A9827 /* 03_jomolhari-id-a3d.ttf */; };
4579C8A41AD2FAB1001D6B90 /* 04_padauk.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E8134C4968003A9827 /* 04_padauk.ttf */; };
4579C8A51AD2FAB1001D6B90 /* 05_khmeros.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E9134C4968003A9827 /* 05_khmeros.ttf */; };
@ -158,6 +158,7 @@
97FC99DC19C1A2CD00C1CF98 /* resources-mdpi in Resources */ = {isa = PBXBuildFile; fileRef = 97FC99D919C1A2CD00C1CF98 /* resources-mdpi */; };
97FC99DE19C1A2CD00C1CF98 /* resources-xhdpi in Resources */ = {isa = PBXBuildFile; fileRef = 97FC99DA19C1A2CD00C1CF98 /* resources-xhdpi */; };
97FC99E019C1A2CD00C1CF98 /* resources-xxhdpi in Resources */ = {isa = PBXBuildFile; fileRef = 97FC99DB19C1A2CD00C1CF98 /* resources-xxhdpi */; };
9DF04B241B71010E00DACAF1 /* 02_droidsans-fallback.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */; };
A32B6D4C1A14980500E54A65 /* iosOGLContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = A32B6D491A14980500E54A65 /* iosOGLContext.mm */; };
A32B6D4D1A14980500E54A65 /* iosOGLContextFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = A32B6D4B1A14980500E54A65 /* iosOGLContextFactory.mm */; };
A3CC2CD41A1C723900B832E1 /* LocationPredictor.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3CC2CD21A1C723900B832E1 /* LocationPredictor.mm */; };
@ -182,7 +183,6 @@
EE7F29811219ECA300EB67A9 /* RenderBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */; };
EE7F29821219ECA300EB67A9 /* RenderContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE7F297E1219ECA300EB67A9 /* RenderContext.mm */; };
EEA61601134C496A003A9827 /* 01_dejavusans.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */; };
9DF04B241B71010E00DACAF1 /* 02_droidsans-fallback.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */; };
EEA61603134C496A003A9827 /* 03_jomolhari-id-a3d.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E7134C4968003A9827 /* 03_jomolhari-id-a3d.ttf */; };
EEA61604134C496A003A9827 /* 04_padauk.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E8134C4968003A9827 /* 04_padauk.ttf */; };
EEA61605134C496A003A9827 /* 05_khmeros.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E9134C4968003A9827 /* 05_khmeros.ttf */; };
@ -368,6 +368,7 @@
340F24641B15F01D00F874CD /* MWMSideMenuDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMSideMenuDelegate.h; sourceTree = "<group>"; };
341522BD1B666A550077AA8F /* MWMAPIBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBarView.h; sourceTree = "<group>"; };
341522BE1B666A550077AA8F /* MWMAPIBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMAPIBarView.m; sourceTree = "<group>"; };
341C2A5A1B720B8A00AD41A1 /* MWMAPIBarView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMAPIBarView.xib; sourceTree = "<group>"; };
34287FDB1B3D7C4800F9959C /* libFlurry_6.4.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFlurry_6.4.0.a; path = Statistics/libFlurry_6.4.0.a; sourceTree = "<group>"; };
3428BC111B55477E00C85B30 /* MWMSideMenuDownloadBadge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSideMenuDownloadBadge.h; sourceTree = "<group>"; };
3428BC121B55477E00C85B30 /* MWMSideMenuDownloadBadge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSideMenuDownloadBadge.m; sourceTree = "<group>"; };
@ -397,13 +398,13 @@
345C31771AE799B600EA0CC2 /* MWMSearchResultController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSearchResultController.mm; sourceTree = "<group>"; };
3465E7D61B6658C000854C4D /* MWMAPIBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBar.h; sourceTree = "<group>"; };
3465E7D71B6658C000854C4D /* MWMAPIBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMAPIBar.mm; sourceTree = "<group>"; };
3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMAPIBarView.xib; sourceTree = "<group>"; };
347274721B0F4EE000756B37 /* me.maps.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.entitlements; sourceTree = "<group>"; };
347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.entitlements; sourceTree = "<group>"; };
347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.production.entitlements; sourceTree = "<group>"; };
3472747A1B0F4FF100756B37 /* me.maps.production.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.production.entitlements; sourceTree = "<group>"; };
3472EC031B4D44BE0085CB79 /* UIFont+MapsMeFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+MapsMeFonts.h"; sourceTree = "<group>"; };
3472EC041B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIFont+MapsMeFonts.mm"; sourceTree = "<group>"; };
348320CC1B6A2C52007EC039 /* MWMNavigationViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMNavigationViewProtocol.h; sourceTree = "<group>"; };
348E57981B0F49D8000FA02A /* maps.me dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "maps.me dbg.app"; sourceTree = BUILT_PRODUCTS_DIR; };
348E57C81B0F49EE000FA02A /* maps.me WatchKit Extension WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "maps.me WatchKit Extension WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
348E57D71B0F49EE000FA02A /* maps.me WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "maps.me WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -559,6 +560,7 @@
97FC99D919C1A2CD00C1CF98 /* resources-mdpi */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-mdpi"; path = "../../data/resources-mdpi"; sourceTree = "<group>"; };
97FC99DA19C1A2CD00C1CF98 /* resources-xhdpi */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-xhdpi"; path = "../../data/resources-xhdpi"; sourceTree = "<group>"; };
97FC99DB19C1A2CD00C1CF98 /* resources-xxhdpi */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-xxhdpi"; path = "../../data/resources-xxhdpi"; sourceTree = "<group>"; };
9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "02_droidsans-fallback.ttf"; path = "../../data/02_droidsans-fallback.ttf"; sourceTree = "<group>"; };
A32B6D481A14980500E54A65 /* iosOGLContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iosOGLContext.h; path = Platform/opengl/iosOGLContext.h; sourceTree = "<group>"; };
A32B6D491A14980500E54A65 /* iosOGLContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = iosOGLContext.mm; path = Platform/opengl/iosOGLContext.mm; sourceTree = "<group>"; };
A32B6D4A1A14980500E54A65 /* iosOGLContextFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iosOGLContextFactory.h; path = Platform/opengl/iosOGLContextFactory.h; sourceTree = "<group>"; };
@ -592,7 +594,6 @@
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderBuffer.mm; path = Classes/RenderBuffer.mm; sourceTree = SOURCE_ROOT; };
EE7F297E1219ECA300EB67A9 /* RenderContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderContext.mm; path = Classes/RenderContext.mm; sourceTree = SOURCE_ROOT; };
EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 01_dejavusans.ttf; path = ../../data/01_dejavusans.ttf; sourceTree = SOURCE_ROOT; };
9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "02_droidsans-fallback.ttf"; path = "../../data/02_droidsans-fallback.ttf"; sourceTree = "<group>"; };
EEA615E7134C4968003A9827 /* 03_jomolhari-id-a3d.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "03_jomolhari-id-a3d.ttf"; path = "../../data/03_jomolhari-id-a3d.ttf"; sourceTree = SOURCE_ROOT; };
EEA615E8134C4968003A9827 /* 04_padauk.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 04_padauk.ttf; path = ../../data/04_padauk.ttf; sourceTree = SOURCE_ROOT; };
EEA615E9134C4968003A9827 /* 05_khmeros.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 05_khmeros.ttf; path = ../../data/05_khmeros.ttf; sourceTree = SOURCE_ROOT; };
@ -1094,7 +1095,7 @@
3465E7D71B6658C000854C4D /* MWMAPIBar.mm */,
341522BD1B666A550077AA8F /* MWMAPIBarView.h */,
341522BE1B666A550077AA8F /* MWMAPIBarView.m */,
3465E7DC1B6658EB00854C4D /* MWMAPIBarView.xib */,
341C2A5A1B720B8A00AD41A1 /* MWMAPIBarView.xib */,
);
path = APIBar;
sourceTree = "<group>";
@ -1241,6 +1242,7 @@
34D783C71B5F9D7800E0C0EE /* Views */ = {
isa = PBXGroup;
children = (
348320CC1B6A2C52007EC039 /* MWMNavigationViewProtocol.h */,
F6BD33821B6240F200F2CE18 /* MWMNavigationView.h */,
F6BD33831B6240F200F2CE18 /* MWMNavigationView.m */,
F6BD33731B62400E00F2CE18 /* Dashboard */,
@ -2104,8 +2106,7 @@
F64F4B711B4A41D40081A24A /* MWMDownloaderDialogHeader.xib in Resources */,
FAFF422A1347F101009BBB14 /* World.mwm in Resources */,
EEA61601134C496A003A9827 /* 01_dejavusans.ttf in Resources */,
9DF04B241B71010E00DACAF1 /* 02_droidsans-fallback.ttf in Resources */,
3497A9391B5CF8A900F51E55 /* MWMNavigationDashboard.xib in Resources */,
341C2A571B72092A00AD41A1 /* 02_droidsans-fallback.ttf in Resources */,
4A7D89C81B2EBF3B00AC843E /* resources-xxhdpi_dark in Resources */,
34BC722B1B0DECAE0012A34B /* MWMZoomButtonsView.xib in Resources */,
EEA61603134C496A003A9827 /* 03_jomolhari-id-a3d.ttf in Resources */,
@ -2152,6 +2153,7 @@
F7E7BA241672328F00B4492E /* bank.png in Resources */,
34BC72231B0DECAE0012A34B /* MWMLocationButton.xib in Resources */,
349A358D1B53EABC009677EE /* MWMSearchDownloadMapRequest.xib in Resources */,
341C2A5B1B720B8A00AD41A1 /* MWMAPIBarView.xib in Resources */,
F7E7BA251672328F00B4492E /* bank@2x.png in Resources */,
349A357B1B53D4C9009677EE /* MWMCircularProgress.xib in Resources */,
F7E7BA261672328F00B4492E /* entertainment.png in Resources */,

View file

@ -2,15 +2,15 @@
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIApplication.h>
#include "../../platform/location.hpp"
#include "../../std/utility.hpp"
#include "indexer/mercator.hpp"
#include "platform/location.hpp"
#include "std/utility.hpp"
@protocol LocationObserver
@required
- (void)onLocationUpdate:(location::GpsInfo const &)info;
@optional
- (void)onLocationError:(location::TLocationError)errorCode;
- (void)onLocationUpdate:(location::GpsInfo const &)info;
- (void)onCompassUpdate:(location::CompassInfo const &)info;
@end
@ -42,3 +42,13 @@
- (void)triggerCompass;
@end
static inline m2::PointD ToMercator(CLLocationCoordinate2D const & l)
{
return MercatorBounds::FromLatLon(l.latitude, l.longitude);
}
static inline m2::PointD ToMercator(ms::LatLon const & l)
{
return MercatorBounds::FromLatLon(l);
}

View file

@ -90,7 +90,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
// (default CLLocationManagerDelegate behaviour)
location::GpsInfo newInfo;
[self location:[self lastLocation] toGpsInfo:newInfo];
[self observer:observer onLocationUpdate:newInfo];
[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)
[self observer:observer onLocationUpdate:newInfo];
[observer onLocationUpdate:newInfo];
// TODO(AlexZ): Temporary, remove in the future.
[[Statistics instance] logLocation:newLocation];
}
@ -339,22 +339,10 @@ 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

@ -17,7 +17,6 @@
#include "platform/location.hpp"
extern NSString * const kSearchResultTitleKey;
extern NSString * const kSearchResultCategoryKey;
extern NSString * const kSearchResultPointKey;

View file

@ -19,9 +19,9 @@
- (location::GpsInfo)infoFromCurrentLocation;
- (NSString *)distanceToPoint:(m2::PointD const &)point;
+ (instancetype)alloc __attribute__((unavailable("alloc not available, call sharedLocationTracker instead")));
- (instancetype)init __attribute__((unavailable("init not available, call sharedLocation instead")));
+ (instancetype)new __attribute__((unavailable("new not available, call sharedLocationTracker instead")));
+ (instancetype)alloc __attribute__((unavailable("call sharedLocationTracker instead")));
- (instancetype)init __attribute__((unavailable("call sharedLocation instead")));
+ (instancetype)new __attribute__((unavailable("call sharedLocationTracker instead")));
@property (nonatomic, readonly) CLLocationManager * locationManager;
@property (weak, nonatomic) id<MWMWatchLocationTrackerDelegate> delegate;