From 70c07fdb2fde0b82888f2c2a0d4c7a05956d0231 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Wed, 2 Aug 2017 15:12:30 +0300 Subject: [PATCH] [MAPSME-5030] Review fixes. --- iphone/Maps/Bridging-Header.h | 4 +- .../MWMMapViewControlsManager.h | 1 - .../MWMMapViewControlsManager.mm | 33 +++------ .../MWMTrafficButtonViewController.mm | 5 +- .../MWMNavigationDashboardEntity.h | 26 ++++--- .../MWMNavigationDashboardEntity.mm | 21 +++--- .../MWMNavigationDashboardManager+Entity.h | 5 +- .../MWMNavigationDashboardManager+Entity.mm | 72 ++++++------------- .../MWMNavigationDashboardManager.h | 9 ++- .../MWMNavigationDashboardManager.mm | 61 +++++++++++----- .../Views/MWMNavigationInfoView.mm | 28 ++++---- iphone/Maps/Common/Keyboard/MWMKeyboard.mm | 16 ++--- .../Core/Framework/MWMFrameworkListener.mm | 32 ++++----- .../Maps/Core/Location/MWMLocationManager.mm | 18 ++--- iphone/Maps/Core/Routing/MWMRouter.mm | 28 +++++--- iphone/Maps/Core/Search/MWMSearch.mm | 14 ++-- .../Core/TextToSpeech/MWMTextToSpeech+CPP.h | 8 +-- .../Maps/Core/TextToSpeech/MWMTextToSpeech.mm | 10 +-- iphone/Maps/Core/Traffic/MWMTrafficManager.mm | 14 ++-- iphone/Maps/UI/Search/MWMSearchManager.mm | 10 +-- .../Settings/MWMTTSSettingsViewController.mm | 4 +- 21 files changed, 205 insertions(+), 214 deletions(-) diff --git a/iphone/Maps/Bridging-Header.h b/iphone/Maps/Bridging-Header.h index 986dafe32c..9b79341152 100644 --- a/iphone/Maps/Bridging-Header.h +++ b/iphone/Maps/Bridging-Header.h @@ -7,10 +7,10 @@ #import #import "3party/Alohalytics/src/alohalytics_objc.h" -#import "MoPub-Bridging-Header.h" -#import "MPNativeAd.h" #import "MPNativeAd+MWM.h" +#import "MPNativeAd.h" #import "MWMTypes.h" +#import "MoPub-Bridging-Header.h" #import "UIKitCategories.h" #import "private.h" diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h index f41f52de20..9b8b6e6a5e 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h @@ -46,7 +46,6 @@ - (void)onRouteReady; - (void)onRouteStart; - (void)onRouteStop; -- (void)onRoutePointsUpdated; #pragma mark - MWMSearchManager diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 19f6a44d21..82cf713efd 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -251,8 +251,9 @@ extern NSString * const kAlohalyticsTapEventKey; - (void)onRoutePrepare { - self.navigationManager.state = MWMNavigationDashboardStatePrepare; - [self onRoutePointsUpdated]; + auto nm = self.navigationManager; + [nm onRoutePrepare]; + [nm onRoutePointsUpdated]; } - (void)onRouteRebuild @@ -260,30 +261,13 @@ extern NSString * const kAlohalyticsTapEventKey; if (IPAD) self.searchManager.state = MWMSearchManagerStateHidden; - self.navigationManager.state = MWMNavigationDashboardStatePlanning; -} - -- (void)onRouteError -{ - if ([MWMRouter isTaxi]) - return; - auto nm = self.navigationManager; - nm.errorMessage = L(@"routing_planning_error"); - nm.state = MWMNavigationDashboardStateError; + [self.navigationManager onRoutePlanning]; } - (void)onRouteReady { - auto startPoint = [MWMRouter startPoint]; - if (!startPoint || !startPoint.isMyPosition) - { - dispatch_async(dispatch_get_main_queue(), ^{ - [MWMRouter disableFollowMode]; - }); - } - [MWMSearchManager manager].state = MWMSearchManagerStateHidden; - if (self.navigationManager.state != MWMNavigationDashboardStateNavigation && ![MWMRouter isTaxi]) - self.navigationManager.state = MWMNavigationDashboardStateReady; + self.searchManager.state = MWMSearchManagerStateHidden; + [self.navigationManager onRouteReady]; } - (void)onRouteStart @@ -293,18 +277,17 @@ extern NSString * const kAlohalyticsTapEventKey; self.sideButtonsHidden = NO; self.disableStandbyOnRouteFollowing = YES; self.trafficButtonHidden = YES; - self.navigationManager.state = MWMNavigationDashboardStateNavigation; + [self.navigationManager onRouteStart]; } - (void)onRouteStop { self.sideButtons.zoomHidden = self.zoomHidden; - self.navigationManager.state = MWMNavigationDashboardStateHidden; + [self.navigationManager onRouteStop]; self.disableStandbyOnRouteFollowing = NO; self.trafficButtonHidden = NO; } -- (void)onRoutePointsUpdated { [self.navigationManager onRoutePointsUpdated]; } #pragma mark - Properties - (MWMSideButtons *)sideButtons diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm index 7cc9084b6a..98d5f87bfb 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm @@ -153,10 +153,7 @@ NSArray * imagesWithName(NSString * name) - (IBAction)buttonTouchUpInside { - if ([MWMTrafficManager state] == MWMTrafficManagerStateDisabled) - [MWMTrafficManager enableTraffic:YES]; - else - [MWMTrafficManager enableTraffic:NO]; + [MWMTrafficManager enableTraffic:[MWMTrafficManager state] == MWMTrafficManagerStateDisabled]; } + (void)updateAvailableArea:(CGRect)frame diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h index afa0ef5cf0..42eae1dd33 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.h @@ -1,23 +1,21 @@ @interface MWMNavigationDashboardEntity : NSObject -@property(nonatomic, readonly) CLLocation * pedestrianDirectionPosition; +@property(copy, nonatomic, readonly) NSAttributedString * estimate; +@property(copy, nonatomic, readonly) NSString * distanceToTurn; +@property(copy, nonatomic, readonly) NSString * streetName; +@property(copy, nonatomic, readonly) NSString * targetDistance; +@property(copy, nonatomic, readonly) NSString * targetUnits; +@property(copy, nonatomic, readonly) NSString * turnUnits; @property(nonatomic, readonly) BOOL isValid; +@property(nonatomic, readonly) CGFloat progress; +@property(nonatomic, readonly) CLLocation * pedestrianDirectionPosition; +@property(nonatomic, readonly) NSString * arrival; +@property(nonatomic, readonly) NSString * eta; @property(nonatomic, readonly) NSString * speed; @property(nonatomic, readonly) NSString * speedUnits; -@property(nonatomic, readonly) NSString * targetDistance; -@property(nonatomic, readonly) NSString * targetUnits; -@property(nonatomic, readonly) NSString * distanceToTurn; -@property(nonatomic, readonly) NSString * turnUnits; -@property(nonatomic, readonly) NSString * streetName; -@property(nonatomic, readonly) UIImage * turnImage; -@property(nonatomic, readonly) UIImage * nextTurnImage; @property(nonatomic, readonly) NSUInteger roundExitNumber; -@property(nonatomic, readonly) NSString * eta; -@property(nonatomic, readonly) NSString * arrival; -@property(nonatomic, readonly) CGFloat progress; -//@property (nonatomic, readonly) vector lanes; -@property(nonatomic, readonly) BOOL isPedestrian; -@property(nonatomic, readonly) NSAttributedString * estimate; +@property(nonatomic, readonly) UIImage * nextTurnImage; +@property(nonatomic, readonly) UIImage * turnImage; + (instancetype) new __attribute__((unavailable("init is not available"))); diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm index 0d69ddb1f4..423fd74b76 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardEntity.mm @@ -8,20 +8,19 @@ @interface MWMNavigationDashboardEntity () -@property(nonatomic, readwrite) CLLocation * pedestrianDirectionPosition; +@property(copy, nonatomic, readwrite) NSAttributedString * estimate; +@property(copy, nonatomic, readwrite) NSString * distanceToTurn; +@property(copy, nonatomic, readwrite) NSString * streetName; +@property(copy, nonatomic, readwrite) NSString * targetDistance; +@property(copy, nonatomic, readwrite) NSString * targetUnits; +@property(copy, nonatomic, readwrite) NSString * turnUnits; @property(nonatomic, readwrite) BOOL isValid; -@property(nonatomic, readwrite) NSString * targetDistance; -@property(nonatomic, readwrite) NSString * targetUnits; -@property(nonatomic, readwrite) NSString * distanceToTurn; -@property(nonatomic, readwrite) NSString * turnUnits; -@property(nonatomic, readwrite) NSString * streetName; -@property(nonatomic, readwrite) UIImage * turnImage; -@property(nonatomic, readwrite) UIImage * nextTurnImage; +@property(nonatomic, readwrite) CGFloat progress; +@property(nonatomic, readwrite) CLLocation * pedestrianDirectionPosition; @property(nonatomic, readwrite) NSUInteger roundExitNumber; @property(nonatomic, readwrite) NSUInteger timeToTarget; -@property(nonatomic, readwrite) CGFloat progress; -@property(nonatomic, readwrite) BOOL isPedestrian; -@property(nonatomic, readwrite) NSAttributedString * estimate; +@property(nonatomic, readwrite) UIImage * nextTurnImage; +@property(nonatomic, readwrite) UIImage * turnImage; @end diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.h index 9cb7bccb44..c58507bcce 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.h @@ -1,6 +1,9 @@ #import "MWMNavigationDashboardManager.h" -#include "platform/location.hpp" +namespace location +{ +struct FollowingInfo; +} @interface MWMNavigationDashboardManager (Entity) diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm index 2106bb7ad0..01277e2eb4 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager+Entity.mm @@ -4,13 +4,18 @@ #import "MWMRouter.h" #import "SwiftBridge.h" -#include "geometry/distance_on_sphere.hpp" #include "routing/turns.hpp" +#include "platform/location.hpp" + +#include "geometry/distance_on_sphere.hpp" + namespace { UIImage * image(routing::turns::CarDirection t, bool isNextTurn) { + if (![MWMLocationManager lastLocation]) + return nil; if ([MWMRouter type] == MWMRouterTypePedestrian) return [UIImage imageNamed:@"ic_direction"]; @@ -44,25 +49,25 @@ UIImage * image(routing::turns::CarDirection t, bool isNextTurn) @interface MWMNavigationDashboardEntity () -@property(nonatomic, readwrite) CLLocation * pedestrianDirectionPosition; +@property(copy, nonatomic, readwrite) NSAttributedString * estimate; +@property(copy, nonatomic, readwrite) NSString * distanceToTurn; +@property(copy, nonatomic, readwrite) NSString * streetName; +@property(copy, nonatomic, readwrite) NSString * targetDistance; +@property(copy, nonatomic, readwrite) NSString * targetUnits; +@property(copy, nonatomic, readwrite) NSString * turnUnits; @property(nonatomic, readwrite) BOOL isValid; -@property(nonatomic, readwrite) NSString * targetDistance; -@property(nonatomic, readwrite) NSString * targetUnits; -@property(nonatomic, readwrite) NSString * distanceToTurn; -@property(nonatomic, readwrite) NSString * turnUnits; -@property(nonatomic, readwrite) NSString * streetName; -@property(nonatomic, readwrite) UIImage * turnImage; -@property(nonatomic, readwrite) UIImage * nextTurnImage; +@property(nonatomic, readwrite) CGFloat progress; +@property(nonatomic, readwrite) CLLocation * pedestrianDirectionPosition; @property(nonatomic, readwrite) NSUInteger roundExitNumber; @property(nonatomic, readwrite) NSUInteger timeToTarget; -@property(nonatomic, readwrite) CGFloat progress; -@property(nonatomic, readwrite) BOOL isPedestrian; -@property(nonatomic, readwrite) NSAttributedString * estimate; +@property(nonatomic, readwrite) UIImage * nextTurnImage; +@property(nonatomic, readwrite) UIImage * turnImage; @end @interface MWMNavigationDashboardManager () +@property(copy, nonatomic) NSDictionary * etaAttributes; @property(nonatomic) MWMNavigationDashboardEntity * entity; - (void)onNavigationInfoUpdated; @@ -87,49 +92,18 @@ UIImage * image(routing::turns::CarDirection t, bool isNextTurn) entity.targetDistance = @(info.m_distToTarget.c_str()); entity.targetUnits = @(info.m_targetUnitsSuffix.c_str()); entity.progress = info.m_completionPercent; - CLLocation * lastLocation = [MWMLocationManager lastLocation]; - if (lastLocation && [MWMRouter type] == MWMRouterTypePedestrian) - { - entity.isPedestrian = YES; - string distance; - CLLocationCoordinate2D const & coordinate = lastLocation.coordinate; + entity.distanceToTurn = @(info.m_distToTurn.c_str()); + entity.turnUnits = @(info.m_turnUnitsSuffix.c_str()); + entity.streetName = @(info.m_targetName.c_str()); + entity.nextTurnImage = image(info.m_nextTurn, true); - auto const lat = info.m_pedestrianDirectionPos.lat; - auto const lon = info.m_pedestrianDirectionPos.lon; - entity.pedestrianDirectionPosition = [[CLLocation alloc] initWithLatitude:lat longitude:lon]; - // TODO: Not the best solution, but this solution is temporary and will be replaced in future - measurement_utils::FormatDistance( - ms::DistanceOnEarth(coordinate.latitude, coordinate.longitude, lat, lon), distance); - istringstream is(distance); - string dist; - string units; - is >> dist; - is >> units; - entity.nextTurnImage = nil; - entity.distanceToTurn = @(dist.c_str()); - entity.turnUnits = @(units.c_str()); - entity.streetName = @""; - } - else - { - entity.isPedestrian = NO; - entity.distanceToTurn = @(info.m_distToTurn.c_str()); - entity.turnUnits = @(info.m_turnUnitsSuffix.c_str()); - entity.streetName = @(info.m_targetName.c_str()); - entity.nextTurnImage = image(info.m_nextTurn, true); - } - - NSDictionary * etaAttributes = @{ - NSForegroundColorAttributeName : UIColor.blackPrimaryText, - NSFontAttributeName : UIFont.medium17 - }; NSString * eta = [NSDateComponentsFormatter etaStringFrom:entity.timeToTarget]; NSString * resultString = [NSString stringWithFormat:@"%@ • %@ %@", eta, entity.targetDistance, entity.targetUnits]; NSMutableAttributedString * result = [[NSMutableAttributedString alloc] initWithString:resultString]; - [result addAttributes:etaAttributes range:NSMakeRange(0, resultString.length)]; - entity.estimate = [result copy]; + [result addAttributes:self.etaAttributes range:NSMakeRange(0, resultString.length)]; + entity.estimate = result; using namespace routing::turns; CarDirection const turn = info.m_turn; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h index 5697a338ab..6a31a4cee2 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.h @@ -17,15 +17,20 @@ typedef NS_ENUM(NSUInteger, MWMNavigationDashboardState) { + (void)addObserver:(id)observer; + (void)removeObserver:(id)observer; -@property(nonatomic) MWMNavigationDashboardState state; +@property(nonatomic, readonly) MWMNavigationDashboardState state; @property(nonatomic, readonly) MWMTaxiPreviewDataSource * taxiDataSource; -@property(nonatomic) NSString * errorMessage; - (instancetype)init __attribute__((unavailable("init is not available"))); - (instancetype)initWithParentView:(UIView *)view; - (void)setRouteBuilderProgress:(CGFloat)progress; - (void)mwm_refreshUI; +- (void)onRoutePrepare; +- (void)onRoutePlanning; +- (void)onRouteError:(NSString *)error; +- (void)onRouteReady; +- (void)onRouteStart; +- (void)onRouteStop; - (void)onRoutePointsUpdated; + (void)updateNavigationInfoAvailableArea:(CGRect)frame; diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm index d7f04237de..91e6e14499 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm @@ -28,8 +28,8 @@ NSString * const kRoutePreviewIPhoneXibName = @"MWMiPhoneRoutePreview"; NSString * const kNavigationInfoViewXibName = @"MWMNavigationInfoView"; NSString * const kNavigationControlViewXibName = @"NavigationControlView"; -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMMapViewControlsManager () @@ -40,13 +40,15 @@ using TObservers = NSHashTable<__kindof TObserver>; @interface MWMNavigationDashboardManager () +@property(copy, nonatomic) NSDictionary * etaAttributes; +@property(copy, nonatomic) NSString * errorMessage; @property(nonatomic) IBOutlet MWMNavigationControlView * navigationControlView; @property(nonatomic) IBOutlet MWMNavigationInfoView * navigationInfoView; @property(nonatomic) IBOutlet MWMRoutePreview * routePreview; @property(nonatomic) IBOutlet MWMRoutePreviewStatus * statusBox; @property(nonatomic) IBOutlet MWMRouteStartButton * goButton; @property(nonatomic) MWMNavigationDashboardEntity * entity; -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @property(nonatomic, readwrite) MWMTaxiPreviewDataSource * taxiDataSource; @property(weak, nonatomic) IBOutlet MWMTaxiCollectionView * taxiCollectionView; @property(weak, nonatomic) UIView * ownerView; @@ -66,7 +68,7 @@ using TObservers = NSHashTable<__kindof TObserver>; if (self) { _ownerView = view; - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; } return self; } @@ -100,7 +102,6 @@ using TObservers = NSHashTable<__kindof TObserver>; [self.goButton setTitle:title forState:UIControlStateNormal]; } -- (void)onRoutePointsUpdated { [self.navigationInfoView updateToastView]; } - (void)mwm_refreshUI { [_routePreview mwm_refreshUI]; @@ -119,6 +120,23 @@ using TObservers = NSHashTable<__kindof TObserver>; [_navigationControlView onNavigationInfoUpdated:entity]; } +#pragma mark - On route updates + +- (void)onRoutePrepare { self.state = MWMNavigationDashboardStatePrepare; } +- (void)onRoutePlanning { self.state = MWMNavigationDashboardStatePlanning; } +- (void)onRouteError:(NSString *)error +{ + self.errorMessage = error; + self.state = MWMNavigationDashboardStateError; +} + +- (void)onRouteReady +{ + if (self.state != MWMNavigationDashboardStateNavigation && ![MWMRouter isTaxi]) + self.state = MWMNavigationDashboardStateReady; +} + +- (void)onRoutePointsUpdated { [self.navigationInfoView updateToastView]; } #pragma mark - State changes - (void)stateHidden @@ -154,15 +172,6 @@ using TObservers = NSHashTable<__kindof TObserver>; if (![MWMRouter isTaxi]) return; - __weak auto wSelf = self; - auto showError = ^(NSString * errorMessage) { - __strong auto self = wSelf; - if (!self) - return; - self.errorMessage = errorMessage; - self.state = MWMNavigationDashboardStateError; - }; - auto pFrom = [MWMRouter startPoint]; auto pTo = [MWMRouter finishPoint]; if (!pFrom || !pTo) @@ -170,16 +179,17 @@ using TObservers = NSHashTable<__kindof TObserver>; if (!Platform::IsConnected()) { [[MapViewController controller].alertController presentNoConnectionAlert]; - showError(L(@"dialog_taxi_offline")); + [self onRouteError:L(@"dialog_taxi_offline")]; return; } + __weak auto wSelf = self; [self.taxiDataSource requestTaxiFrom:pFrom to:pTo completion:^{ wSelf.state = MWMNavigationDashboardStateReady; } - failure:^(NSString * errorMessage) { - showError(errorMessage); + failure:^(NSString * error) { + [wSelf onRouteError:error]; }]; } @@ -202,6 +212,8 @@ using TObservers = NSHashTable<__kindof TObserver>; [self.statusBox stateReady]; } +- (void)onRouteStart { self.state = MWMNavigationDashboardStateNavigation; } +- (void)onRouteStop { self.state = MWMNavigationDashboardStateHidden; } - (void)stateNavigation { [self.routePreview remove]; @@ -210,6 +222,7 @@ using TObservers = NSHashTable<__kindof TObserver>; self.navigationControlView.isVisible = YES; [self.statusBox stateNavigation]; self.statusBox = nil; + [self onNavigationInfoUpdated]; } #pragma mark - MWMNavigationControlView @@ -252,7 +265,7 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onNavigationDashboardStateChanged { - for (TObserver observer in self.observers) + for (Observer observer in self.observers) [observer onNavigationDashboardStateChanged]; } @@ -275,6 +288,18 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)updateNavigationInfoAvailableArea:(CGRect)frame { _navigationInfoView.frame = frame; } #pragma mark - Properties +- (NSDictionary *)etaAttributes +{ + if (!_etaAttributes) + { + _etaAttributes = @{ + NSForegroundColorAttributeName : UIColor.blackPrimaryText, + NSFontAttributeName : UIFont.medium17 + }; + } + return _etaAttributes; +} + - (void)setState:(MWMNavigationDashboardState)state { if (_state == state) diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm index e245cfa157..29fcd0989a 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/MWMNavigationInfoView.mm @@ -78,7 +78,6 @@ BOOL defaultOrientation(CGSize const & size) @property(weak, nonatomic) IBOutlet NSLayoutConstraint * searchButtonsViewHeight; @property(weak, nonatomic) IBOutlet NSLayoutConstraint * searchButtonsViewWidth; @property(nonatomic) IBOutletCollection(NSLayoutConstraint) NSArray * searchLandscapeConstraints; -@property(weak, nonatomic) IBOutlet NSLayoutConstraint * searchButtonsToastOffset; @property(nonatomic) IBOutletCollection(UIButton) NSArray * searchButtons; @property(weak, nonatomic) IBOutlet NSLayoutConstraint * searchButtonsSideSize; @property(weak, nonatomic) IBOutlet MWMButton * searchGasButton; @@ -249,29 +248,25 @@ BOOL defaultOrientation(CGSize const & size) - (void)layoutSearch { BOOL const defaultView = defaultOrientation(self.frame.size); - CGFloat alpha = 1; - CGFloat searchButtonsSideSize = kSearchButtonsSideSize; + CGFloat alpha = 0; + CGFloat searchButtonsSideSize = 0; + self.searchButtonsViewWidth.constant = 0; + self.searchButtonsViewHeight.constant = 0; if (self.searchState == NavigationSearchState::Maximized) { + alpha = 1; + searchButtonsSideSize = kSearchButtonsSideSize; self.searchButtonsViewWidth.constant = defaultView ? kSearchButtonsViewWidthPortrait : kSearchButtonsViewWidthLandscape; self.searchButtonsViewHeight.constant = defaultView ? kSearchButtonsViewHeightPortrait : kSearchButtonsViewHeightLandscape; } - else - { - self.searchButtonsViewWidth.constant = 0; - self.searchButtonsViewHeight.constant = 0; - alpha = 0; - searchButtonsSideSize = 0; - } for (UIButton * searchButton in self.searchButtons) searchButton.alpha = alpha; UILayoutPriority const priority = - defaultView ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh; + (defaultView ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh); for (NSLayoutConstraint * constraint in self.searchLandscapeConstraints) constraint.priority = priority; - self.searchButtonsToastOffset.priority = priority + UILayoutPriorityFittingSizeLevel; self.searchButtonsSideSize.constant = searchButtonsSideSize; } @@ -280,9 +275,10 @@ BOOL defaultOrientation(CGSize const & size) - (void)onNavigationInfoUpdated:(MWMNavigationDashboardEntity *)info { self.navigationInfo = info; + BOOL const isPedestrianRouting = [MWMRouter type] == MWMRouterTypePedestrian; if (self.state != MWMNavigationInfoViewStateNavigation) return; - if (info.streetName.length != 0) + if (!isPedestrianRouting && info.streetName.length != 0) { [self setStreetNameVisible:YES]; self.streetNameLabel.text = info.streetName; @@ -325,7 +321,7 @@ BOOL defaultOrientation(CGSize const & size) attributes:turnLegendAttributes]]; self.distanceToNextTurnLabel.attributedText = distance; - if (info.nextTurnImage) + if (!isPedestrianRouting && info.nextTurnImage) { self.secondTurnView.hidden = NO; self.secondTurnImageView.image = info.nextTurnImage; @@ -361,7 +357,7 @@ BOOL defaultOrientation(CGSize const & size) { auto const angle = ang::AngleTo(lastLocation.mercator, self.navigationInfo.pedestrianDirectionPosition.mercator); - transform = CATransform3DMakeRotation(M_PI_2 - angle + info.m_bearing, 0, 0, 1); + transform = CATransform3DMakeRotation(M_PI_2 - angle - info.m_bearing, 0, 0, 1); } self.nextTurnImageView.layer.transform = transform; } @@ -526,7 +522,7 @@ BOOL defaultOrientation(CGSize const & size) self.toastView.hidden = NO; [self setNeedsLayout]; self.toastViewHideOffset.priority = - (hidden ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow) + 20; + (hidden ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow); [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ [self layoutIfNeeded]; diff --git a/iphone/Maps/Common/Keyboard/MWMKeyboard.mm b/iphone/Maps/Common/Keyboard/MWMKeyboard.mm index 8ef898c599..3e1f01a332 100644 --- a/iphone/Maps/Common/Keyboard/MWMKeyboard.mm +++ b/iphone/Maps/Common/Keyboard/MWMKeyboard.mm @@ -2,13 +2,13 @@ namespace { -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMKeyboard () -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @property(nonatomic) CGFloat keyboardHeight; @end @@ -31,7 +31,7 @@ using TObservers = NSHashTable<__kindof TObserver>; self = [super init]; if (self) { - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; NSNotificationCenter * nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(keyboardWillShow:) @@ -64,8 +64,8 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onKeyboardWillAnimate { - TObservers * observers = self.observers.copy; - for (TObserver observer in observers) + Observers * observers = self.observers.copy; + for (Observer observer in observers) { if ([observer respondsToSelector:@selector(onKeyboardWillAnimate)]) [observer onKeyboardWillAnimate]; @@ -74,8 +74,8 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onKeyboardAnimation { - TObservers * observers = self.observers.copy; - for (TObserver observer in observers) + Observers * observers = self.observers.copy; + for (Observer observer in observers) [observer onKeyboardAnimation]; } diff --git a/iphone/Maps/Core/Framework/MWMFrameworkListener.mm b/iphone/Maps/Core/Framework/MWMFrameworkListener.mm index 6a7bfcfd03..270ea20014 100644 --- a/iphone/Maps/Core/Framework/MWMFrameworkListener.mm +++ b/iphone/Maps/Core/Framework/MWMFrameworkListener.mm @@ -7,23 +7,23 @@ namespace { -using TObserver = id; +using Observer = id; using TRouteBuildingObserver = id; using TStorageObserver = id; using TDrapeObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observers = NSHashTable; Protocol * pRouteBuildingObserver = @protocol(MWMFrameworkRouteBuilderObserver); Protocol * pStorageObserver = @protocol(MWMFrameworkStorageObserver); Protocol * pDrapeObserver = @protocol(MWMFrameworkDrapeObserver); -using TLoopBlock = void (^)(__kindof TObserver observer); +using TLoopBlock = void (^)(__kindof Observer observer); -void loopWrappers(TObservers * observers, TLoopBlock block) +void loopWrappers(Observers * observers, TLoopBlock block) { dispatch_async(dispatch_get_main_queue(), ^{ - for (TObserver observer in observers) + for (Observer observer in observers) { if (observer) block(observer); @@ -34,9 +34,9 @@ void loopWrappers(TObservers * observers, TLoopBlock block) @interface MWMFrameworkListener () -@property(nonatomic) TObservers * routeBuildingObservers; -@property(nonatomic) TObservers * storageObservers; -@property(nonatomic) TObservers * drapeObservers; +@property(nonatomic) Observers * routeBuildingObservers; +@property(nonatomic) Observers * storageObservers; +@property(nonatomic) Observers * drapeObservers; @end @@ -52,7 +52,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) return listener; } -+ (void)addObserver:(TObserver)observer ++ (void)addObserver:(Observer)observer { dispatch_async(dispatch_get_main_queue(), ^{ MWMFrameworkListener * listener = [MWMFrameworkListener listener]; @@ -65,7 +65,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) }); } -+ (void)removeObserver:(TObserver)observer ++ (void)removeObserver:(Observer)observer { dispatch_async(dispatch_get_main_queue(), ^{ MWMFrameworkListener * listener = [MWMFrameworkListener listener]; @@ -80,9 +80,9 @@ void loopWrappers(TObservers * observers, TLoopBlock block) self = [super init]; if (self) { - _routeBuildingObservers = [TObservers weakObjectsHashTable]; - _storageObservers = [TObservers weakObjectsHashTable]; - _drapeObservers = [TObservers weakObjectsHashTable]; + _routeBuildingObservers = [Observers weakObjectsHashTable]; + _storageObservers = [Observers weakObjectsHashTable]; + _drapeObservers = [Observers weakObjectsHashTable]; [self registerRouteBuilderListener]; [self registerStorageObserver]; @@ -97,7 +97,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) { using namespace routing; using namespace storage; - TObservers * observers = self.routeBuildingObservers; + Observers * observers = self.routeBuildingObservers; auto & f = GetFramework(); // TODO(ldragunov,rokuz): Thise two routing callbacks are the only framework callbacks which does // not guarantee @@ -124,7 +124,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) - (void)registerStorageObserver { - TObservers * observers = self.storageObservers; + Observers * observers = self.storageObservers; auto & s = GetFramework().GetStorage(); s.Subscribe( [observers](TCountryId const & countryId) { @@ -144,7 +144,7 @@ void loopWrappers(TObservers * observers, TLoopBlock block) - (void)registerDrapeObserver { - TObservers * observers = self.drapeObservers; + Observers * observers = self.drapeObservers; auto & f = GetFramework(); f.SetCurrentCountryChangedListener([observers](TCountryId const & countryId) { for (TDrapeObserver observer in observers) diff --git a/iphone/Maps/Core/Location/MWMLocationManager.mm b/iphone/Maps/Core/Location/MWMLocationManager.mm index 4f30c3ac8c..11105f3972 100644 --- a/iphone/Maps/Core/Location/MWMLocationManager.mm +++ b/iphone/Maps/Core/Location/MWMLocationManager.mm @@ -19,8 +19,8 @@ namespace { -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; location::GpsInfo gpsInfoFromLocation(CLLocation * l, location::TLocationSource source) { @@ -158,7 +158,7 @@ void setPermissionRequested() @property(nonatomic) CLLocation * lastLocationInfo; @property(nonatomic) location::TLocationError lastLocationStatus; @property(nonatomic) MWMLocationPredictor * predictor; -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @property(nonatomic) MWMLocationFrameworkUpdate frameworkUpdateMode; @property(nonatomic) location::TLocationSource locationSource; @@ -182,7 +182,7 @@ void setPermissionRequested() { self = [super init]; if (self) - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; return self; } @@ -194,7 +194,7 @@ void setPermissionRequested() + (void)start { [self manager].started = YES; } #pragma mark - Add/Remove Observers -+ (void)addObserver:(TObserver)observer ++ (void)addObserver:(Observer)observer { runAsyncOnMainQueue(^{ MWMLocationManager * manager = [self manager]; @@ -203,7 +203,7 @@ void setPermissionRequested() }); } -+ (void)removeObserver:(TObserver)observer ++ (void)removeObserver:(Observer)observer { runAsyncOnMainQueue(^{ [[self manager].observers removeObject:observer]; @@ -265,7 +265,7 @@ void setPermissionRequested() self.lastLocationStatus = locationError; if (self.lastLocationStatus != location::TLocationError::ENoError) self.frameworkUpdateMode |= MWMLocationFrameworkUpdateStatus; - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onLocationError:)]) [observer onLocationError:self.lastLocationStatus]; @@ -277,7 +277,7 @@ void setPermissionRequested() self.lastHeadingInfo = headingInfo; self.frameworkUpdateMode |= MWMLocationFrameworkUpdateHeading; location::CompassInfo const compassInfo = compassInfoFromHeading(headingInfo); - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onHeadingUpdate:)]) [observer onHeadingUpdate:compassInfo]; @@ -301,7 +301,7 @@ void setPermissionRequested() self.lastLocationInfo = locationInfo; self.locationSource = source; self.frameworkUpdateMode |= MWMLocationFrameworkUpdateLocation; - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onLocationUpdate:)]) [observer onLocationUpdate:gpsInfo]; diff --git a/iphone/Maps/Core/Routing/MWMRouter.mm b/iphone/Maps/Core/Routing/MWMRouter.mm index 5f62a0ef7f..753a7e1c58 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.mm +++ b/iphone/Maps/Core/Routing/MWMRouter.mm @@ -247,7 +247,7 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI { [self applyTaxiTransaction]; GetFramework().GetRoutingManager().RemoveRoutePoint(type, intermediateIndex); - [[MWMMapViewControlsManager manager] onRoutePointsUpdated]; + [[MWMNavigationDashboardManager manager] onRoutePointsUpdated]; } + (void)addPoint:(MWMRoutePoint *)point intermediateIndex:(int8_t)intermediateIndex @@ -256,7 +256,7 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI RouteMarkData pt = point.routeMarkData; pt.m_intermediateIndex = intermediateIndex; GetFramework().GetRoutingManager().AddRoutePoint(std::move(pt)); - [[MWMMapViewControlsManager manager] onRoutePointsUpdated]; + [[MWMNavigationDashboardManager manager] onRoutePointsUpdated]; } + (void)addPoint:(MWMRoutePoint *)point @@ -269,7 +269,7 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI [self applyTaxiTransaction]; RouteMarkData pt = point.routeMarkData; GetFramework().GetRoutingManager().AddRoutePoint(std::move(pt)); - [[MWMMapViewControlsManager manager] onRoutePointsUpdated]; + [[MWMNavigationDashboardManager manager] onRoutePointsUpdated]; } + (void)removeStartPointAndRebuild:(int8_t)intermediateIndex @@ -539,8 +539,16 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI { case routing::IRouter::ResultCode::NoError: { - auto & f = GetFramework(); - f.DeactivateMapSelection(true); + GetFramework().DeactivateMapSelection(true); + + auto startPoint = [MWMRouter startPoint]; + if (!startPoint || !startPoint.isMyPosition) + { + dispatch_async(dispatch_get_main_queue(), ^{ + [MWMRouter disableFollowMode]; + }); + } + [mapViewControlsManager onRouteReady]; [self updateFollowingInfo]; break; @@ -550,8 +558,10 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI case routing::IRouter::NeedMoreMaps: case routing::IRouter::FileTooOld: case routing::IRouter::RouteNotFound: + if ([MWMRouter isTaxi]) + return; [self presentDownloaderAlert:code countries:absentCountries]; - [mapViewControlsManager onRouteError]; + [[MWMNavigationDashboardManager manager] onRouteError:L(@"routing_planning_error")]; break; case routing::IRouter::Cancelled: [mapViewControlsManager onRoutePrepare]; @@ -561,9 +571,11 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI case routing::IRouter::NoCurrentPosition: case routing::IRouter::PointsInDifferentMWM: case routing::IRouter::InternalError: - case routing::IRouter::IntermediatePointNotFound: + case routing::IRouter::IntermediatePointNotFound: + if ([MWMRouter isTaxi]) + return; [[MWMAlertViewController activeAlertController] presentAlert:code]; - [mapViewControlsManager onRouteError]; + [[MWMNavigationDashboardManager manager] onRouteError:L(@"routing_planning_error")]; break; } } diff --git a/iphone/Maps/Core/Search/MWMSearch.mm b/iphone/Maps/Core/Search/MWMSearch.mm index 92ed38a4d6..cf00f1658f 100644 --- a/iphone/Maps/Core/Search/MWMSearch.mm +++ b/iphone/Maps/Core/Search/MWMSearch.mm @@ -18,8 +18,8 @@ namespace { -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMSearch () @@ -29,7 +29,7 @@ using TObservers = NSHashTable<__kindof TObserver>; @property(nonatomic) BOOL textChanged; -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @property(nonatomic) NSUInteger lastSearchStamp; @@ -72,7 +72,7 @@ using TObservers = NSHashTable<__kindof TObserver>; { self = [super init]; if (self) - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; return self; } @@ -333,7 +333,7 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onSearchStarted { - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onSearchStarted)]) [observer onSearchStarted]; @@ -355,7 +355,7 @@ using TObservers = NSHashTable<__kindof TObserver>; // [[MWMAlertViewController activeAlertController] presentSearchNoResultsAlert]; [self updateItemsIndexWithBannerReload:YES]; - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onSearchCompleted)]) [observer onSearchCompleted]; @@ -365,7 +365,7 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onSearchResultsUpdated { [self updateItemsIndexWithBannerReload:NO]; - for (TObserver observer in self.observers) + for (Observer observer in self.observers) { if ([observer respondsToSelector:@selector(onSearchResultsUpdated)]) [observer onSearchResultsUpdated]; diff --git a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech+CPP.h b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech+CPP.h index b5637da20f..53ad52d3fa 100644 --- a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech+CPP.h +++ b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech+CPP.h @@ -1,18 +1,18 @@ #import "MWMTextToSpeech.h" -#include "std/string.hpp" -#include "std/vector.hpp" +#include +#include @interface MWMTextToSpeech (CPP) // Returns a list of available languages in the following format: // * name in bcp47; // * localized name; -- (vector>)availableLanguages; +- (std::vector>)availableLanguages; @end namespace tts { -string translatedTwine(string const & twine); +std::string translatedTwine(std::string const & twine); } // namespace tts diff --git a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm index 9ebfe0926c..654385ebc1 100644 --- a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm +++ b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm @@ -41,8 +41,8 @@ vector> availableLanguages() return result; } -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMTextToSpeech () @@ -55,7 +55,7 @@ using TObservers = NSHashTable<__kindof TObserver>; @property(nonatomic) float speechRate; @property(nonatomic) AVAudioSession * audioSession; -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @end @@ -77,7 +77,7 @@ using TObservers = NSHashTable<__kindof TObserver>; if (self) { _availableLanguages = availableLanguages(); - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; NSString * saved = [[self class] savedLanguage]; NSString * preferedLanguageBcp47; @@ -263,7 +263,7 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onTTSStatusUpdated { - for (TObserver observer in self.observers) + for (Observer observer in self.observers) [observer onTTSStatusUpdated]; } diff --git a/iphone/Maps/Core/Traffic/MWMTrafficManager.mm b/iphone/Maps/Core/Traffic/MWMTrafficManager.mm index 3d249a9761..aaca00809c 100644 --- a/iphone/Maps/Core/Traffic/MWMTrafficManager.mm +++ b/iphone/Maps/Core/Traffic/MWMTrafficManager.mm @@ -7,13 +7,13 @@ namespace { -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMTrafficManager () -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @property(nonatomic) TrafficManager::TrafficState state; @@ -38,11 +38,11 @@ using TObservers = NSHashTable<__kindof TObserver>; self = [super init]; if (self) { - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; auto & m = GetFramework().GetTrafficManager(); m.SetStateListener([self](TrafficManager::TrafficState state) { self.state = state; - for (TObserver observer in self.observers) + for (Observer observer in self.observers) [observer onTrafficStateUpdated]; }); } @@ -51,12 +51,12 @@ using TObservers = NSHashTable<__kindof TObserver>; #pragma mark - Add/Remove Observers -+ (void)addObserver:(TObserver)observer ++ (void)addObserver:(Observer)observer { [[MWMTrafficManager manager].observers addObject:observer]; } -+ (void)removeObserver:(TObserver)observer ++ (void)removeObserver:(Observer)observer { [[MWMTrafficManager manager].observers removeObject:observer]; } diff --git a/iphone/Maps/UI/Search/MWMSearchManager.mm b/iphone/Maps/UI/Search/MWMSearchManager.mm index 72ca7908e3..43112590c7 100644 --- a/iphone/Maps/UI/Search/MWMSearchManager.mm +++ b/iphone/Maps/UI/Search/MWMSearchManager.mm @@ -36,8 +36,8 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerActionBarState) { MWMSearchManagerActionBarStateModeFilter }; -using TObserver = id; -using TObservers = NSHashTable<__kindof TObserver>; +using Observer = id; +using Observers = NSHashTable; } // namespace @interface MWMMapViewControlsManager () @@ -80,7 +80,7 @@ using TObservers = NSHashTable<__kindof TObserver>; @property(nonatomic) MWMSearchFilterTransitioningManager * filterTransitioningManager; -@property(nonatomic) TObservers * observers; +@property(nonatomic) Observers * observers; @end @@ -95,7 +95,7 @@ using TObservers = NSHashTable<__kindof TObserver>; [NSBundle.mainBundle loadNibNamed:@"MWMSearchView" owner:self options:nil]; self.state = MWMSearchManagerStateHidden; [MWMSearch addObserver:self]; - _observers = [TObservers weakObjectsHashTable]; + _observers = [Observers weakObjectsHashTable]; } return self; } @@ -354,7 +354,7 @@ using TObservers = NSHashTable<__kindof TObserver>; - (void)onSearchManagerStateChanged { - for (TObserver observer in self.observers) + for (Observer observer in self.observers) [observer onSearchManagerStateChanged]; } diff --git a/iphone/Maps/UI/Settings/MWMTTSSettingsViewController.mm b/iphone/Maps/UI/Settings/MWMTTSSettingsViewController.mm index 4de4e39b64..f80056c951 100644 --- a/iphone/Maps/UI/Settings/MWMTTSSettingsViewController.mm +++ b/iphone/Maps/UI/Settings/MWMTTSSettingsViewController.mm @@ -13,8 +13,8 @@ using namespace locale_translator; @interface MWMTTSSettingsViewController () { - pair _additionalTTSLanguage; - vector> _languages; + std::pair _additionalTTSLanguage; + std::vector> _languages; } @property(nonatomic) BOOL isLocaleLanguageAbsent;