diff --git a/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h b/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h index f74ba5f53e7..3c2edc52c28 100644 --- a/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h +++ b/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h @@ -44,7 +44,9 @@ NS_SWIFT_NAME(FrameworkHelper) + (void)showBookmark:(MWMMarkID)bookmarkId; + (void)showTrack:(MWMTrackID)trackId; + (void)updatePlacePageData; - ++ (void)setPlacePageSelectedCallback:(MWMVoidBlock)selected + deselectedCallback:(MWMBoolBlock)deselected + updatedCallback:(MWMVoidBlock)updated; @end NS_ASSUME_NONNULL_END diff --git a/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm b/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm index e1bed8b1219..e4f9ed77faf 100644 --- a/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm +++ b/iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm @@ -190,4 +190,12 @@ + (void)updatePlacePageData { GetFramework().UpdatePlacePageInfoForCurrentSelection(); } ++ (void)setPlacePageSelectedCallback:(MWMVoidBlock)selected + deselectedCallback:(MWMBoolBlock)deselected + updatedCallback:(MWMVoidBlock)updated { + GetFramework().SetPlacePageListeners([selected]() { selected(); }, + [deselected](bool switchFullScreen) { deselected(switchFullScreen); }, + [updated]() { updated(); }); +} + @end diff --git a/iphone/CoreApi/CoreApi/Traffic/MWMMapOverlayManager.h b/iphone/CoreApi/CoreApi/Traffic/MWMMapOverlayManager.h index b124e924092..68177a7d298 100644 --- a/iphone/CoreApi/CoreApi/Traffic/MWMMapOverlayManager.h +++ b/iphone/CoreApi/CoreApi/Traffic/MWMMapOverlayManager.h @@ -22,7 +22,7 @@ typedef NS_ENUM(NSUInteger, MWMMapOverlayIsolinesState) { MWMMapOverlayIsolinesStateEnabled, MWMMapOverlayIsolinesStateExpiredData, MWMMapOverlayIsolinesStateNoData, -} NS_SWIFT_NAME(MapOverlayTransitState); +} NS_SWIFT_NAME(MapOverlayIsolinesState); typedef NS_ENUM(NSUInteger, MWMMapOverlayGuidesState) { MWMMapOverlayGuidesStateDisabled, diff --git a/iphone/Maps/Bookmarks/BookmarksCoordinator.swift b/iphone/Maps/Bookmarks/BookmarksCoordinator.swift index aedab8c274a..92db254ad7e 100644 --- a/iphone/Maps/Bookmarks/BookmarksCoordinator.swift +++ b/iphone/Maps/Bookmarks/BookmarksCoordinator.swift @@ -8,7 +8,7 @@ import UIKit } private weak var navigationController: UINavigationController? - private weak var controlsManager: MWMMapViewControlsManager? + weak var mapControlsViewController: MapControlsViewController? private weak var navigationManager: MWMNavigationDashboardManager? private var bookmarksControllers: [UIViewController]? private var state: BookmarksState = .closed { @@ -18,10 +18,8 @@ import UIKit } @objc init(navigationController: UINavigationController, - controlsManager: MWMMapViewControlsManager, navigationManager: MWMNavigationDashboardManager) { self.navigationController = navigationController - self.controlsManager = controlsManager self.navigationManager = navigationManager } @@ -59,11 +57,11 @@ import UIKit }, completion: nil) FrameworkHelper.deactivateMapSelection(notifyUI: true) self.bookmarksControllers = nil - controlsManager?.hideGuidesNavigationBar() + mapControlsViewController?.hideGuidesNavigationBar() case .closed: navigationController.popToRootViewController(animated: true) bookmarksControllers = nil - controlsManager?.hideGuidesNavigationBar() + mapControlsViewController?.hideGuidesNavigationBar() case let .hidden(categoryId): UIView.transition(with: self.navigationController!.view, duration: kDefaultAnimationDuration, @@ -73,7 +71,7 @@ import UIKit }, completion: nil) let isNavigation = navigationManager?.state != .hidden if isNavigation == false { - controlsManager?.showGuidesNavigationBar(categoryId) + mapControlsViewController?.showGuidesNavigationBar(categoryId) } } } diff --git a/iphone/Maps/Bridging-Header.h b/iphone/Maps/Bridging-Header.h index 95bf81782cb..f492964c64e 100644 --- a/iphone/Maps/Bridging-Header.h +++ b/iphone/Maps/Bridging-Header.h @@ -79,7 +79,6 @@ #import "MWMTextToSpeech.h" #import "MWMTextToSpeechObserver.h" #import "MWMTextView.h" -#import "MWMTrafficButtonViewController.h" #import "MWMViewController.h" #import "MapViewController.h" #import "MapsAppDelegate.h" diff --git a/iphone/Maps/Classes/CircleView.h b/iphone/Maps/Classes/CircleView.h deleted file mode 100644 index 2a5ec225356..00000000000 --- a/iphone/Maps/Classes/CircleView.h +++ /dev/null @@ -1,18 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface CircleView : UIView - -- (id)initWithFrame:(CGRect)frame andColor:(UIColor *)color; -- (id)initWithFrame:(CGRect)frame andColor:(UIColor *)color andImageName:(nullable NSString *)imageName; - -+ (UIImage *)createCircleImageWithFrameSize:(CGFloat)frameSize andDiameter:(CGFloat)diameter andColor:(UIColor *)color; -+ (UIImage *)createCircleImageWithDiameter:(CGFloat)diameter andColor:(UIColor *)color; -+ (UIImage *)createCircleImageWithDiameter:(CGFloat)diameter - andColor:(UIColor *)color - andImageName:(NSString *)imageName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/iphone/Maps/Classes/CircleView.m b/iphone/Maps/Classes/CircleView.m deleted file mode 100644 index aef5247bbb4..00000000000 --- a/iphone/Maps/Classes/CircleView.m +++ /dev/null @@ -1,80 +0,0 @@ -#import -#import "CircleView.h" -#import - -@interface CircleView() - -@property(nonatomic) UIColor *circleColor; -@property(nonatomic) UIImage *image; - -@end - -@implementation CircleView - -- (id)initWithFrame:(CGRect)frame andColor:(UIColor *)color { - return [self initWithFrame:frame andColor:color andImageName:nil]; -} - -- (id)initWithFrame:(CGRect)frame andColor:(UIColor *)color andImageName:(nullable NSString *)imageName { - self = [super initWithFrame:frame]; - if (self) - { - _circleColor = color; - if (imageName) - _image = [UIImage imageNamed:imageName]; - self.opaque = NO; - } - return self; -} - -- (void)drawRect:(CGRect)rect { - CGContextRef ctx = UIGraphicsGetCurrentContext(); - CGContextAddEllipseInRect(ctx, rect); - CGContextSetFillColor(ctx, CGColorGetComponents(self.circleColor.CGColor)); - CGContextFillPath(ctx); - - if (self.image) - [self.image drawInRect:CGRectMake(3, 3, rect.size.width - 6, rect.size.height - 6)]; -} - -+ (UIImage *)createCircleImageWithFrameSize:(CGFloat)frameSize - andDiameter:(CGFloat)diameter - andColor:(UIColor *)color - andImageName:(nullable NSString *)imageName { - UIView *circleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frameSize, frameSize)]; - circleView.backgroundColor = UIColor.clearColor; - CircleView *circle = [[self alloc] initWithFrame:CGRectMake(0.5, 0.5, diameter - 1, diameter - 1) - andColor:color - andImageName:imageName]; - circle.center = circleView.center; - [circleView addSubview:circle]; - return [self imageWithView:circleView]; -} - -+ (UIImage *)createCircleImageWithFrameSize:(CGFloat)frameSize - andDiameter:(CGFloat)diameter - andColor:(UIColor *)color { - return [self createCircleImageWithFrameSize:frameSize andDiameter:diameter andColor:color andImageName:nil]; -} - -+ (UIImage *)createCircleImageWithDiameter:(CGFloat)diameter andColor:(UIColor *)color { - return [self createCircleImageWithFrameSize:diameter andDiameter:diameter andColor:color andImageName:nil]; -} - -+ (UIImage *)createCircleImageWithDiameter:(CGFloat)diameter - andColor:(UIColor *)color - andImageName:(NSString *)imageName { - return [self createCircleImageWithFrameSize:diameter andDiameter:diameter andColor:color andImageName:imageName]; -} - -+ (UIImage *)imageWithView:(UIView *)view { - UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:view.bounds.size]; - - UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext *rendererContext) { - [view.layer renderInContext:rendererContext.CGContext]; - }]; - - return image; -} - -@end diff --git a/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm b/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm index d26ec571c93..fe46457d104 100644 --- a/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/MWMEditorViralAlert.mm @@ -21,8 +21,8 @@ - (IBAction)shareTap { [Statistics logEvent:kStatEditorSecondTimeShareClick]; [self close:^{ MWMActivityViewController* shareVC = [MWMActivityViewController shareControllerForEditorViral]; - [shareVC presentInParentViewController:self.alertController.ownerViewController - anchorView:[BottomTabBarViewController controller].view]; +// [shareVC presentInParentViewController:self.alertController.ownerViewController +// anchorView:[BottomTabBarViewController controller].view]; }]; } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMMapViewControlsCommon.h b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMMapViewControlsCommon.h index 7f53f253fc9..ee8d247974f 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMMapViewControlsCommon.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/APIBar/MWMMapViewControlsCommon.h @@ -1,10 +1,7 @@ static NSTimeInterval const kMenuViewHideFramesCount = 4.0; -static inline NSTimeInterval framesDuration(NSTimeInterval const framesCount) -{ - static NSTimeInterval const kFPS = 30.0; - static NSTimeInterval const kFrameDuration = 1.0 / kFPS; - return kFrameDuration * framesCount; +static inline NSTimeInterval framesDuration(NSTimeInterval const framesCount) { + return framesCount / 30; } static CGFloat const kViewControlsOffsetToBounds = 6; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/GuidesNavigationBar/GuidesNavigationBarViewController.swift b/iphone/Maps/Classes/CustomViews/MapViewControls/GuidesNavigationBar/GuidesNavigationBarViewController.swift index 568bbd6c9c8..5abef23fc3e 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/GuidesNavigationBar/GuidesNavigationBarViewController.swift +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/GuidesNavigationBar/GuidesNavigationBarViewController.swift @@ -6,7 +6,7 @@ class GuidesNavigationBarViewController: UIViewController { @IBOutlet var navigationBar: UINavigationBar! @IBOutlet var navigationBarItem: UINavigationItem! - @objc init(categoryId: MWMMarkGroupID) { + init(categoryId: MWMMarkGroupID) { category = BookmarksManager.shared().category(withId: categoryId) super.init(nibName: nil, bundle: nil) } @@ -31,35 +31,6 @@ class GuidesNavigationBarViewController: UIViewController { style: .plain, target: self, action: #selector(onCancelPessed)) - refreshLayout(false) - } - - @objc func configLayout() { - guard let superview = view.superview else { - fatalError() - } - - NSLayoutConstraint.activate([ - view.topAnchor.constraint(equalTo: superview.topAnchor), - view.leftAnchor.constraint(equalTo: superview.leftAnchor), - view.rightAnchor.constraint(equalTo: superview.rightAnchor) - ]) - } - - func refreshLayout(_ animated: Bool = true) { - DispatchQueue.main.async { - let availableArea = self.availableArea - self.view.alpha = min(1, availableArea.height / self.view.height) - } - } - - class func updateAvailableArea(_ frame: CGRect) { - guard let controller = MWMMapViewControlsManager.manager()?.guidesNavigationBar, - !controller.availableArea.equalTo(frame) else { - return - } - controller.availableArea = frame - controller.refreshLayout() } @objc func onBackPressed(_ sender: Any) { diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h index 61e747ac38e..2123fc83cd7 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.h @@ -5,7 +5,6 @@ @class MapViewController; @class BottomTabBarViewController; -@class GuidesNavigationBarViewController; @protocol MWMFeatureHolder; @interface MWMMapViewControlsManager : NSObject @@ -20,18 +19,12 @@ @property(nonatomic) MWMBottomMenuState menuState; @property(nonatomic) MWMBottomMenuState menuRestoreState; @property(nonatomic) BOOL isDirectionViewHidden; -@property(nonatomic) BottomTabBarViewController *tabBarController; -@property(nonatomic) GuidesNavigationBarViewController *guidesNavigationBar; - (instancetype)init __attribute__((unavailable("init is not available"))); - (instancetype)initWithParentController:(MapViewController *)controller; - (UIStatusBarStyle)preferredStatusBarStyle; -#pragma mark GuidesNavigationBar -- (void)showGuidesNavigationBar:(MWMMarkGroupID)categoryId; -- (void)hideGuidesNavigationBar; - #pragma mark - Layout - (UIView *)anchorView; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index b1ec9ea6337..bb300c86910 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -7,7 +7,6 @@ #import "MWMPlacePageProtocol.h" #import "MWMSearchManager.h" #import "MWMSideButtons.h" -#import "MWMTrafficButtonViewController.h" #import "MapViewController.h" #import "MapsAppDelegate.h" #import "SwiftBridge.h" @@ -31,7 +30,6 @@ @interface MWMMapViewControlsManager () @property(nonatomic) MWMSideButtons *sideButtons; -@property(nonatomic) MWMTrafficButtonViewController *trafficButton; @property(nonatomic) UIButton *promoButton; @property(nonatomic) UIViewController *menuController; @property(nonatomic) id placePageManager; @@ -65,15 +63,15 @@ - (instancetype)initWithParentController:(MapViewController *)controller { self.isDirectionViewHidden = YES; self.menuRestoreState = MWMBottomMenuStateInactive; self.promoDiscoveryCampaign = [ABTestManager manager].promoDiscoveryCampaign; - if (_promoDiscoveryCampaign.enabled) { - [controller.controlsView addSubview:self.promoButton]; - self.promoButton.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints:@[ - [self.promoButton.centerXAnchor constraintEqualToAnchor:self.trafficButton.view.centerXAnchor], - [self.promoButton.topAnchor constraintEqualToAnchor:self.sideButtons.view.topAnchor] - ]]; - [Statistics logEvent:kStatMapSponsoredButtonShow withParameters:@{kStatTarget: kStatGuidesSubscription}]; - } +// if (_promoDiscoveryCampaign.enabled) { +// [controller.controlsView addSubview:self.promoButton]; +// self.promoButton.translatesAutoresizingMaskIntoConstraints = NO; +// [NSLayoutConstraint activateConstraints:@[ +// [self.promoButton.centerXAnchor constraintEqualToAnchor:self.trafficButton.view.centerXAnchor], +// [self.promoButton.topAnchor constraintEqualToAnchor:self.sideButtons.view.topAnchor] +// ]]; +// [Statistics logEvent:kStatMapSponsoredButtonShow withParameters:@{kStatTarget: kStatGuidesSubscription}]; +// } return self; } @@ -96,14 +94,12 @@ - (UIStatusBarStyle)preferredStatusBarStyle { #pragma mark - Layout - (UIView *)anchorView { - return self.tabBarController.view; + return nil; +// return self.tabBarController.view; } - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { - [self.trafficButton viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [self.tabBarController viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - [self.guidesNavigationBar viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [self.searchManager viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } @@ -199,7 +195,7 @@ - (void)onSearchManagerStateChanged { if (!IPAD && state == MWMSearchManagerStateHidden) { self.hidden = NO; } else if (state != MWMSearchManagerStateHidden) { - [self hideGuidesNavigationBar]; +// [self hideGuidesNavigationBar]; } } @@ -264,23 +260,6 @@ - (MWMSideButtons *)sideButtons { return _sideButtons; } -- (MWMTrafficButtonViewController *)trafficButton { - if (!_trafficButton) - _trafficButton = [[MWMTrafficButtonViewController alloc] init]; - return _trafficButton; -} - -- (BottomTabBarViewController *)tabBarController { - if (!_tabBarController) { - _tabBarController = [BottomTabBarBuilder buildWithMapViewController:_ownerController controlsManager:self]; - [self.ownerController addChildViewController:_tabBarController]; - UIView *tabBarViewSuperView = self.ownerController.controlsView; - [tabBarViewSuperView addSubview:_tabBarController.view]; - } - - return _tabBarController; -} - - (id)placePageManager { if (!_placePageManager) _placePageManager = [[MWMPlacePageManager alloc] init]; @@ -325,69 +304,47 @@ - (void)setSideButtonsHidden:(BOOL)sideButtonsHidden { - (void)setTrafficButtonHidden:(BOOL)trafficButtonHidden { BOOL const isNavigation = self.navigationManager.state == MWMNavigationDashboardStateNavigation; _trafficButtonHidden = isNavigation || trafficButtonHidden; - self.trafficButton.hidden = self.hidden || _trafficButtonHidden; -} - -- (void)showGuidesNavigationBar:(MWMMarkGroupID)categoryId { - if (!_guidesNavigationBar) { - MapViewController *parentViewController = self.ownerController; - _guidesNavigationBar = [[GuidesNavigationBarViewController alloc] initWithCategoryId:categoryId]; - [parentViewController addChildViewController:_guidesNavigationBar]; - [parentViewController.controlsView addSubview:_guidesNavigationBar.view]; - [_guidesNavigationBar configLayout]; - _guidesNavigationBarHidden = YES; - self.menuState = MWMBottomMenuStateHidden; - } -} - -- (void)hideGuidesNavigationBar { - if (_guidesNavigationBar) { - [_guidesNavigationBar removeFromParentViewController]; - [_guidesNavigationBar.view removeFromSuperview]; - _guidesNavigationBar = nil; - _guidesNavigationBarHidden = NO; - self.menuState = _menuRestoreState; - } +// self.trafficButton.hidden = self.hidden || _trafficButtonHidden; } - (void)setMenuState:(MWMBottomMenuState)menuState { _menuState = menuState; - switch (_menuState) { - case MWMBottomMenuStateActive: - _tabBarController.isHidden = NO; - if (_menuController == nil) { - _menuController = [BottomMenuBuilder buildMenuWithMapViewController:_ownerController - controlsManager:self - delegate:self]; - [_ownerController presentViewController:_menuController animated:YES completion:nil]; - } - break; - case MWMBottomMenuStateLayers: - _tabBarController.isHidden = NO; - if (_menuController == nil) { - _menuController = [BottomMenuBuilder buildLayersWithMapViewController:_ownerController - controlsManager:self - delegate:self]; - [_ownerController presentViewController:_menuController animated:YES completion:nil]; - } - break; - case MWMBottomMenuStateInactive: - _tabBarController.isHidden = NO; - if (_menuController != nil) { - [_menuController dismissViewControllerAnimated:YES completion:nil]; - _menuController = nil; - } - break; - case MWMBottomMenuStateHidden: - _tabBarController.isHidden = YES; - if (_menuController != nil) { - [_menuController dismissViewControllerAnimated:YES completion:nil]; - _menuController = nil; - } - break; - default: - break; - } +// switch (_menuState) { +// case MWMBottomMenuStateActive: +//// _tabBarController.isHidden = NO; +// if (_menuController == nil) { +// _menuController = [BottomMenuBuilder buildMenuWithMapViewController:_ownerController +// controlsManager:self +// delegate:self]; +// [_ownerController presentViewController:_menuController animated:YES completion:nil]; +// } +// break; +// case MWMBottomMenuStateLayers: +//// _tabBarController.isHidden = NO; +// if (_menuController == nil) { +// _menuController = [BottomMenuBuilder buildLayersWithMapViewController:_ownerController +// controlsManager:self +// delegate:self]; +// [_ownerController presentViewController:_menuController animated:YES completion:nil]; +// } +// break; +// case MWMBottomMenuStateInactive: +//// _tabBarController.isHidden = NO; +// if (_menuController != nil) { +// [_menuController dismissViewControllerAnimated:YES completion:nil]; +// _menuController = nil; +// } +// break; +// case MWMBottomMenuStateHidden: +//// _tabBarController.isHidden = YES; +// if (_menuController != nil) { +// [_menuController dismissViewControllerAnimated:YES completion:nil]; +// _menuController = nil; +// } +// break; +// default: +// break; +// } } #pragma mark - MWMFeatureHolder @@ -398,36 +355,36 @@ - (void)setMenuState:(MWMBottomMenuState)menuState { - (MWMTutorialViewController *)tutorialWithType:(MWMTip)tutorialType { MWMTutorialViewController *tutorial; - switch (tutorialType) { - case MWMTipSearch: - tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSearch - target:self.tabBarController.searchButton - delegate:self]; - break; - case MWMTipDiscovery: - tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeDiscovery - target:self.tabBarController.discoveryButton - delegate:self]; - break; - case MWMTipBookmarks: - tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeBookmarks - target:self.tabBarController.bookmarksButton - delegate:self]; - break; - case MWMTipSubway: - tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSubway - target:(UIControl *)self.trafficButton.view - delegate:self]; - break; - case MWMTipIsolines: - tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeIsolines - target:(UIControl *)self.trafficButton.view - delegate:self]; - break; - case MWMTipNone: - tutorial = nil; - break; - } +// switch (tutorialType) { +// case MWMTipSearch: +// tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSearch +// target:self.tabBarController.searchButton +// delegate:self]; +// break; +// case MWMTipDiscovery: +// tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeDiscovery +// target:self.tabBarController.discoveryButton +// delegate:self]; +// break; +// case MWMTipBookmarks: +// tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeBookmarks +// target:self.tabBarController.bookmarksButton +// delegate:self]; +// break; +// case MWMTipSubway: +// tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSubway +// target:(UIControl *)self.trafficButton.view +// delegate:self]; +// break; +// case MWMTipIsolines: +// tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeIsolines +// target:(UIControl *)self.trafficButton.view +// delegate:self]; +// break; +// case MWMTipNone: +// tutorial = nil; +// break; +// } return tutorial; } diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.h deleted file mode 100644 index f17ca3efc08..00000000000 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.h +++ /dev/null @@ -1,11 +0,0 @@ -#import "MWMViewController.h" - -@interface MWMTrafficButtonViewController : MWMViewController - -+ (MWMTrafficButtonViewController *)controller; - -@property(nonatomic) BOOL hidden; - -+ (void)updateAvailableArea:(CGRect)frame; - -@end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm deleted file mode 100644 index e2a1d1a3066..00000000000 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm +++ /dev/null @@ -1,234 +0,0 @@ -#import "MWMTrafficButtonViewController.h" - -#import - -#import "MWMAlertViewController.h" -#import "MWMButton.h" -#import "MWMMapViewControlsCommon.h" -#import "MWMMapViewControlsManager.h" -#import "MapViewController.h" -#import "SwiftBridge.h" -#import "base/assert.hpp" - -namespace { -CGFloat const kTopOffset = 6; - -NSArray *imagesWithName(NSString *name) { - NSUInteger const imagesCount = 3; - NSMutableArray *images = [NSMutableArray arrayWithCapacity:imagesCount]; - NSString *mode = [UIColor isNightMode] ? @"dark" : @"light"; - for (NSUInteger i = 1; i <= imagesCount; i += 1) { - NSString *imageName = [NSString stringWithFormat:@"%@_%@_%@", name, mode, @(i).stringValue]; - [images addObject:static_cast([UIImage imageNamed:imageName])]; - } - return [images copy]; -} -} // namespace - -@interface MWMMapViewControlsManager () - -@property(nonatomic) MWMTrafficButtonViewController *trafficButton; - -@end - -@interface MWMTrafficButtonViewController () - -@property(nonatomic) NSLayoutConstraint *topOffset; -@property(nonatomic) NSLayoutConstraint *leftOffset; -@property(nonatomic) CGRect availableArea; - -@end - -@implementation MWMTrafficButtonViewController - -+ (MWMTrafficButtonViewController *)controller { - return [MWMMapViewControlsManager manager].trafficButton; -} - -- (instancetype)init { - self = [super init]; - if (self) { - MapViewController *ovc = [MapViewController sharedController]; - [ovc addChildViewController:self]; - [ovc.controlsView addSubview:self.view]; - [self configLayout]; - [self applyTheme]; - [StyleManager.shared addListener:self]; - [MWMMapOverlayManager addObserver:self]; - } - return self; -} - -- (void)dealloc { - [StyleManager.shared removeListener:self]; -} - -- (void)configLayout { - UIView *sv = self.view; - UIView *ov = sv.superview; - - self.topOffset = [sv.topAnchor constraintEqualToAnchor:ov.topAnchor constant:kTopOffset]; - self.topOffset.active = YES; - self.leftOffset = [sv.leadingAnchor constraintEqualToAnchor:ov.leadingAnchor constant:kViewControlsOffsetToBounds]; - self.leftOffset.active = YES; -} - -- (void)setHidden:(BOOL)hidden { - _hidden = hidden; - [self refreshLayout]; -} - -- (void)refreshLayout { - dispatch_async(dispatch_get_main_queue(), ^{ - auto const availableArea = self.availableArea; - auto const leftOffset = self.hidden ? -self.view.width : availableArea.origin.x + kViewControlsOffsetToBounds; - [self.view.superview animateConstraintsWithAnimations:^{ - self.topOffset.constant = availableArea.origin.y + kTopOffset; - self.leftOffset.constant = leftOffset; - self.view.alpha = self.hidden ? 0 : 1; - }]; - }); -} - -- (void)handleTrafficState:(MWMMapOverlayTrafficState)state { - MWMButton *btn = (MWMButton *)self.view; - UIImageView *iv = btn.imageView; - switch (state) { - case MWMMapOverlayTrafficStateDisabled: - CHECK(false, ("Incorrect traffic manager state.")); - break; - case MWMMapOverlayTrafficStateEnabled: - btn.imageName = @"btn_traffic_on"; - break; - case MWMMapOverlayTrafficStateWaitingData: - iv.animationImages = imagesWithName(@"btn_traffic_update"); - iv.animationDuration = 0.8; - [iv startAnimating]; - break; - case MWMMapOverlayTrafficStateOutdated: - btn.imageName = @"btn_traffic_outdated"; - break; - case MWMMapOverlayTrafficStateNoData: - btn.imageName = @"btn_traffic_on"; - [[MWMToast toastWithText:L(@"traffic_data_unavailable")] show]; - break; - case MWMMapOverlayTrafficStateNetworkError: - [MWMMapOverlayManager setTrafficEnabled:NO]; - [[MWMAlertViewController activeAlertController] presentNoConnectionAlert]; - break; - case MWMMapOverlayTrafficStateExpiredData: - btn.imageName = @"btn_traffic_outdated"; - [[MWMToast toastWithText:L(@"traffic_update_maps_text")] show]; - break; - case MWMMapOverlayTrafficStateExpiredApp: - btn.imageName = @"btn_traffic_outdated"; - [[MWMToast toastWithText:L(@"traffic_update_app_message")] show]; - break; - } -} - -- (void)handleGuidesState:(MWMMapOverlayGuidesState)state { - switch (state) { - case MWMMapOverlayGuidesStateDisabled: - case MWMMapOverlayGuidesStateEnabled: - break; - case MWMMapOverlayGuidesStateHasData: - performOnce(^{ - [[MWMToast toastWithText:L(@"routes_layer_is_on_toast")] showWithAlignment:MWMToastAlignmentTop]; - }, @"routes_layer_is_on_toast"); - break; - case MWMMapOverlayGuidesStateNetworkError: - [[MWMToast toastWithText:L(@"connection_error_toast_guides")] show]; - break; - case MWMMapOverlayGuidesStateFatalNetworkError: - [MWMMapOverlayManager setGuidesEnabled:NO]; - [[MWMAlertViewController activeAlertController] presentNoConnectionAlert]; - break; - case MWMMapOverlayGuidesStateNoData: - [[MWMToast toastWithText:L(@"no_routes_in_the_area_toast")] show]; - break; - } -} - -- (void)handleIsolinesState:(MWMMapOverlayIsolinesState)state { - switch (state) { - case MWMMapOverlayIsolinesStateDisabled: - break; - case MWMMapOverlayIsolinesStateEnabled: - if (![MWMMapOverlayManager isolinesVisible]) { - [[MWMToast toastWithText:L(@"isolines_toast_zooms_1_10")] show]; - [Statistics logEvent:kStatMapToastShow withParameters:@{kStatType: kStatIsolines}]; - } - break; - case MWMMapOverlayIsolinesStateExpiredData: - [MWMAlertViewController.activeAlertController presentInfoAlert:L(@"isolines_activation_error_dialog")]; - [MWMMapOverlayManager setIsoLinesEnabled:NO]; - break; - case MWMMapOverlayIsolinesStateNoData: - [MWMAlertViewController.activeAlertController presentInfoAlert:L(@"isolines_location_error_dialog")]; - [MWMMapOverlayManager setIsoLinesEnabled:NO]; - break; - } -} - -- (void)applyTheme { - MWMButton *btn = static_cast(self.view); - UIImageView *iv = btn.imageView; - - // Traffic state machine: https://confluence.mail.ru/pages/viewpage.action?pageId=103680959 - [iv stopAnimating]; - if ([MWMMapOverlayManager trafficEnabled]) { - [self handleTrafficState:[MWMMapOverlayManager trafficState]]; - } else if ([MWMMapOverlayManager transitEnabled]) { - btn.imageName = @"btn_subway_on"; - if ([MWMMapOverlayManager transitState] == MWMMapOverlayTransitStateNoData) - [[MWMToast toastWithText:L(@"subway_data_unavailable")] show]; - } else if ([MWMMapOverlayManager isoLinesEnabled]) { - btn.imageName = @"btn_isoMap_on"; - [self handleIsolinesState:[MWMMapOverlayManager isolinesState]]; - } else if ([MWMMapOverlayManager guidesEnabled]) { - btn.imageName = @"btn_layers_off"; - [self handleGuidesState:[MWMMapOverlayManager guidesState]]; - } else { - btn.imageName = @"btn_layers"; - } -} - -- (IBAction)buttonTouchUpInside { - if ([MWMMapOverlayManager trafficEnabled]) { - [MWMMapOverlayManager setTrafficEnabled:NO]; - } else if ([MWMMapOverlayManager transitEnabled]) { - [MWMMapOverlayManager setTransitEnabled:NO]; - } else if ([MWMMapOverlayManager isoLinesEnabled]) { - [MWMMapOverlayManager setIsoLinesEnabled:NO]; - } else if ([MWMMapOverlayManager guidesEnabled]) { - [MWMMapOverlayManager setGuidesEnabled:NO]; - } else { - MWMMapViewControlsManager.manager.menuState = MWMBottomMenuStateLayers; - } -} - -+ (void)updateAvailableArea:(CGRect)frame { - auto controller = [self controller]; - if (CGRectEqualToRect(controller.availableArea, frame)) - return; - controller.availableArea = frame; - [controller refreshLayout]; -} - -#pragma mark - MWMMapOverlayManagerObserver - -- (void)onTrafficStateUpdated { - [self applyTheme]; -} -- (void)onTransitStateUpdated { - [self applyTheme]; -} -- (void)onIsoLinesStateUpdated { - [self applyTheme]; -} -- (void)onGuidesStateUpdated { - [self applyTheme]; -} - -@end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.swift b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.swift new file mode 100644 index 00000000000..9400a342f07 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.swift @@ -0,0 +1,165 @@ +final class TrafficButtonViewController: MWMViewController { + private enum Const { + static let lightAnimationImages = [UIImage(named: "btn_traffic_update_light_1")!, + UIImage(named: "btn_traffic_update_light_2")!, + UIImage(named: "btn_traffic_update_light_3")!] + static let darkAnimationImages = [UIImage(named: "btn_traffic_update_dark_1")!, + UIImage(named: "btn_traffic_update_dark_2")!, + UIImage(named: "btn_traffic_update_dark_3")!] + } + + typealias ShowMenuClosure = () -> Void + let showMenuHandler: ShowMenuClosure + + init(showMenuHandler: @escaping ShowMenuClosure) { + self.showMenuHandler = showMenuHandler + + super.init(nibName: nil, bundle: nil) + + MapOverlayManager.add(self) + StyleManager.shared.addListener(self) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + MapOverlayManager.remove(self) + StyleManager.shared.removeListener(self) + } + + override func viewDidLoad() { + super.viewDidLoad() + + applyTheme() + } + + @IBAction func onTrafficButton(_ sender: UIButton) { + if MapOverlayManager.trafficEnabled() { + MapOverlayManager.setTrafficEnabled(false) + } else if MapOverlayManager.transitEnabled() { + MapOverlayManager.setTransitEnabled(false) + } else if MapOverlayManager.isoLinesEnabled() { + MapOverlayManager.setIsoLinesEnabled(false) + } else if MapOverlayManager.guidesEnabled() { + MapOverlayManager.setGuidesEnabled(false) + } else { + showMenuHandler() + } + } + + private func handleTrafficState(_ state: MapOverlayTrafficState) { + let btn = self.view as! MWMButton + + switch state { + case .disabled: + fatalError("Incorrect traffic manager state.") + case .enabled: + btn.imageName = "btn_traffic_on"; + case .waitingData: + let iv = btn.imageView + iv?.animationImages = UIColor.isNightMode() ? Const.darkAnimationImages : Const.lightAnimationImages + iv?.animationDuration = 0.8 + iv?.startAnimating() + case .outdated: + btn.imageName = "btn_traffic_outdated"; + case .noData: + btn.imageName = "btn_traffic_on"; + Toast.toast(withText: "traffic_data_unavailable").show() + case .networkError: + MapOverlayManager.setTrafficEnabled(false) + MWMAlertViewController.activeAlert().presentNoConnectionAlert() + case .expiredData: + btn.imageName = "btn_traffic_outdated"; + Toast.toast(withText: "traffic_update_maps_text").show() + case .expiredApp: + btn.imageName = "btn_traffic_outdated"; + Toast.toast(withText: "traffic_update_app_message").show() + @unknown default: + fatalError() + } + } + + private func handleIsolinesState(_ state: MapOverlayIsolinesState) { + switch state { + case .disabled: + break + case .enabled: + if !MapOverlayManager.isolinesVisible() { + Toast.toast(withText: "isolines_toast_zooms_1_10").show() + Statistics.logEvent(kStatMapToastShow, withParameters: [kStatType: kStatIsolines]) + } + case .expiredData: + MWMAlertViewController.activeAlert().presentInfoAlert("isolines_activation_error_dialog") + MapOverlayManager.setIsoLinesEnabled(false) + case .noData: + MWMAlertViewController.activeAlert().presentInfoAlert("isolines_location_error_dialog") + MapOverlayManager.setIsoLinesEnabled(false) + @unknown default: + fatalError() + } + } + + private func hanldeGuidesState(_ state: MapOverlayGuidesState) { + switch state { + case .disabled, .enabled: + break + case .hasData: + performOnce({ + Toast.toast(withText: "routes_layer_is_on_toast").show(withAlignment: .top) + }, "routes_layer_is_on_toast") + case .networkError: + Toast.toast(withText: "connection_error_toast_guides").show() + case .fatalNetworkError: + MapOverlayManager.setGuidesEnabled(false) + MWMAlertViewController.activeAlert().presentNoConnectionAlert() + case .noData: + Toast.toast(withText: "no_routes_in_the_area_toast").show() + @unknown default: + fatalError() + } + } +} + +extension TrafficButtonViewController: MapOverlayManagerObserver { + func onTrafficStateUpdated() { + applyTheme() + } + + func onGuidesStateUpdated() { + applyTheme() + } + + func onTransitStateUpdated() { + applyTheme() + } + + func onIsoLinesStateUpdated() { + applyTheme() + } +} + +extension TrafficButtonViewController: ThemeListener { + override func applyTheme() { + let btn = self.view as! MWMButton + btn.imageView?.stopAnimating() + + if MapOverlayManager.trafficEnabled() { + handleTrafficState(MapOverlayManager.trafficState()) + } else if MapOverlayManager.transitEnabled() { + btn.imageName = "btn_subway_on"; + if MapOverlayManager.transitState() == .noData { + Toast.toast(withText: "subway_data_unavailable").show() + } + } else if MapOverlayManager.isoLinesEnabled() { + btn.imageName = "btn_isoMap_on"; + handleIsolinesState(MapOverlayManager.isolinesState()) + } else if MapOverlayManager.guidesEnabled() { + btn.imageName = "btn_layers_off"; + hanldeGuidesState(MapOverlayManager.guidesState()) + } else { + btn.imageName = "btn_layers"; + } + } +} diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.xib b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.xib similarity index 82% rename from iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.xib rename to iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.xib index 044bc865887..b7b64749fd5 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.xib +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/TrafficButtonViewController.xib @@ -1,16 +1,14 @@ - - - - + + - + - + @@ -18,15 +16,15 @@ diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsBuilder.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsBuilder.swift new file mode 100644 index 00000000000..934c279fb07 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsBuilder.swift @@ -0,0 +1,14 @@ +import Foundation + +@objc final class MapControlsBuilder: NSObject { + @objc static func build(bookmarksCoordinator: BookmarksCoordinator?) -> MapControlsViewController { + let mapViewController = MapViewController.shared()! + let viewController = mapViewController.storyboard!.instantiateViewController(ofType: MapControlsViewController.self) + bookmarksCoordinator?.mapControlsViewController = viewController + let interactor = MapControlsInteractor() + let router = MapControlsRouter(mapViewController, bookmarksCoordinator: bookmarksCoordinator) + let presenter = MapControlsPresenter(view: viewController, interactor: interactor, router: router) + viewController.presenter = presenter + return viewController + } +} diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsInteractor.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsInteractor.swift new file mode 100644 index 00000000000..159651abae5 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsInteractor.swift @@ -0,0 +1,24 @@ +final class MapControlsInteractor { +} + +extension MapControlsInteractor: IMapControlsInteractor { + func setPlacePageSelectedCallback(_ selected: @escaping MapObjectSelectedClosure, + deselectedCallback: @escaping MapObjectDeselectedClosure, + updatedCallback: @escaping MapObjectUpdatedClosure) { + FrameworkHelper.setPlacePageSelectedCallback(selected, + deselectedCallback: deselectedCallback, + updatedCallback: updatedCallback) + } + + func zoomIn() { + FrameworkHelper.zoomMap(.in) + } + + func zoomOut() { + FrameworkHelper.zoomMap(.out) + } + + func switchMyPositionMode() { + FrameworkHelper.switchMyPositionMode() + } +} diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsInterfaces.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsInterfaces.swift new file mode 100644 index 00000000000..f2615e89113 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsInterfaces.swift @@ -0,0 +1,48 @@ +protocol IMapControlsView: AnyObject { + func showMenu(_ mode: MapControlsMenuMode) + func showPlacePage() + func hidePlacePage() + func updatePlacePage() + func toggleControlsVisibility() +} + +protocol IMapControlsPresenter { + func viewDidLoad() + func zoomIn() + func zoomOut() + func switchMyPosition() + func search() + func route() + func discovery() + func bookmarks() + func menu() + func layers() + func hideMenu() +} + +typealias MapObjectSelectedClosure = () -> Void +typealias MapObjectDeselectedClosure = (Bool) -> Void +typealias MapObjectUpdatedClosure = () -> Void + +protocol IMapControlsInteractor { + func setPlacePageSelectedCallback(_ selected: @escaping MapObjectSelectedClosure, + deselectedCallback: @escaping MapObjectDeselectedClosure, + updatedCallback: @escaping MapObjectUpdatedClosure) + func zoomIn() + func zoomOut() + func switchMyPositionMode() +} + +protocol IMapControlsRouter { + func search() + func discovery() + func bookmarks() +} + +enum MapControlsMenuMode { + case full + case layers + case inactive + case hidden +} + diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsPresenter.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsPresenter.swift new file mode 100644 index 00000000000..16bc6dda299 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsPresenter.swift @@ -0,0 +1,96 @@ +final class MapControlsPresenter { + private unowned let view: IMapControlsView + private let interactor: IMapControlsInteractor + private let router: IMapControlsRouter + + private var menuMode: MapControlsMenuMode = .inactive + private var previousMenuMode: MapControlsMenuMode = .inactive + + init(view: IMapControlsView, interactor: IMapControlsInteractor, router: IMapControlsRouter) { + self.view = view + self.interactor = interactor + self.router = router + } +} + +extension MapControlsPresenter: IMapControlsPresenter { + func viewDidLoad() { + interactor.setPlacePageSelectedCallback { [weak self] in + self?.view.hidePlacePage() + NetworkPolicy.shared().callOnlineApi { _ in + self?.view.showPlacePage() + } + } deselectedCallback: { [weak self] switchFullScreen in + self?.view.hidePlacePage() + + let isSearchResult = MWMSearchManager.manager().state == .result + let isNavigationDashboardHidden = MWMNavigationDashboardManager.shared().state == .hidden + if isSearchResult { + if isNavigationDashboardHidden { + MWMSearchManager.manager().state = .mapSearch + } else { + MWMSearchManager.manager().state = .hidden + } + } + + if DeepLinkHandler.shared.isLaunchedByDeeplink || !switchFullScreen { + return + } + + let isSearchHidden = MWMSearchManager.manager().state == .hidden + if isSearchHidden && isNavigationDashboardHidden { + self?.view.toggleControlsVisibility() + } + } updatedCallback: { + + } + } + + func zoomIn() { + interactor.zoomIn() + } + + func zoomOut() { + interactor.zoomOut() + } + + func switchMyPosition() { + interactor.switchMyPositionMode() + } + + func search() { + router.search() + } + + func route() { + + } + + func discovery() { + router.discovery() + } + + func bookmarks() { + router.bookmarks() + } + + func menu() { + if menuMode == .inactive { + menuMode = .full + view.showMenu(.full) + } else { + menuMode = .inactive + view.showMenu(.inactive) + } + } + + func layers() { + menuMode = .layers + view.showMenu(.layers) + } + + func hideMenu() { + menuMode = previousMenuMode + view.showMenu(menuMode) + } +} diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsRouter.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsRouter.swift new file mode 100644 index 00000000000..ab5e4ac4ba1 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsRouter.swift @@ -0,0 +1,31 @@ +final class MapControlsRouter { + private let mapViewController: MapViewController + private weak var coordinator: BookmarksCoordinator? + private weak var searchManager = MWMSearchManager.manager() + + init(_ mapViewController: MapViewController, bookmarksCoordinator: BookmarksCoordinator?) { + self.mapViewController = mapViewController + self.coordinator = bookmarksCoordinator + } +} + +extension MapControlsRouter: IMapControlsRouter { + func search() { + if searchManager?.state == .hidden { + searchManager?.state = .default + } else { + searchManager?.state = .hidden + } + } + + func discovery() { + NetworkPolicy.shared().callOnlineApi { [weak self] canUseNetwork in + let vc = MWMDiscoveryController.instance(withConnection: canUseNetwork) + self?.mapViewController.navigationController?.pushViewController(vc!, animated: true) + } + } + + func bookmarks() { + coordinator?.open() + } +} diff --git a/iphone/Maps/Classes/MapControlsViewControls/MapControlsViewController.swift b/iphone/Maps/Classes/MapControlsViewControls/MapControlsViewController.swift new file mode 100644 index 00000000000..b4355924575 --- /dev/null +++ b/iphone/Maps/Classes/MapControlsViewControls/MapControlsViewController.swift @@ -0,0 +1,284 @@ +protocol MapOverlayViewProtocol { + var bottomView: UIView { get } +} + +final class MapControlsViewController: UIViewController { + var presenter: IMapControlsPresenter! + + @IBOutlet var mapButtonsView: TouchTransparentView! + @IBOutlet var placePageContainerView: TouchTransparentView! + @IBOutlet var guidesGalleryContainerView: TouchTransparentView! + @IBOutlet var guidesVisibleConstraint: NSLayoutConstraint! + @IBOutlet var guidesHiddenConstraint: NSLayoutConstraint! + @IBOutlet var mapButtonsBottomConstraint: NSLayoutConstraint! + @IBOutlet var tabBarContainerView: UIView! + @IBOutlet var layersButtonContainerView: UIView! + @IBOutlet var layersButtonVisibleConstraint: NSLayoutConstraint! + @IBOutlet var layersButtonHiddenConstraint: NSLayoutConstraint! + @IBOutlet var sideButtonsContainerView: UIView! + @IBOutlet var sideButtonsVisibleConstraint: NSLayoutConstraint! + @IBOutlet var sideButtonsHiddenConstraint: NSLayoutConstraint! + + + private var placePageViewController: PlacePageViewController? + private var guidesGalleryViewController: GuidesGalleryViewController? + private var guidesNavigationBar: GuidesNavigationBarViewController? + private var menuViewController: UIViewController? + + private lazy var tabBarViewController: BottomTabBarViewController = { + let contoller = BottomTabBarViewController() + contoller.delegate = self + return contoller + }() + + private lazy var trafficButtonViewController: TrafficButtonViewController = { + TrafficButtonViewController { [weak self] in + self?.presenter.layers() + } + }() + + override func viewDidLoad() { + super.viewDidLoad() + + tabBarContainerView.addSubview(tabBarViewController.view) + addChild(tabBarViewController) + tabBarViewController.didMove(toParent: self) + + layersButtonContainerView.addSubview(trafficButtonViewController.view) + trafficButtonViewController.view.alignToSuperview() + addChild(trafficButtonViewController) + trafficButtonViewController.didMove(toParent: self) + + presenter.viewDidLoad() + } + + private func showRegularPlacePage() { + placePageViewController = PlacePageBuilder.build() + placePageContainerView.isHidden = false + placePageContainerView.addSubview(placePageViewController!.view) + placePageViewController!.view.alignToSuperview() + addChild(placePageViewController!) + placePageViewController?.didMove(toParent: self) + bindBottomView(placePageViewController!) + } + + private func showGuidesGallery() { + guidesGalleryViewController = GuidesGalleryBuilder.build() + guidesGalleryContainerView.isHidden = false + guidesGalleryContainerView.addSubview(guidesGalleryViewController!.view) + guidesGalleryViewController!.view.alignToSuperview() + addChild(guidesGalleryViewController!) + guidesGalleryViewController!.didMove(toParent: self) + + guidesVisibleConstraint.priority = .defaultLow + guidesHiddenConstraint.priority = .defaultHigh + guidesGalleryContainerView.alpha = 0 + bindBottomView(guidesGalleryViewController!) + view.layoutIfNeeded() + UIView.animate(withDuration: kDefaultAnimationDuration) { [weak self] in + self?.guidesVisibleConstraint.priority = .defaultHigh + self?.guidesHiddenConstraint.priority = .defaultLow + self?.guidesGalleryContainerView.alpha = 1 + self?.view.layoutIfNeeded() + } + } + + private func hideGuidesGallery() { + guard let guidesGalleryViewController = guidesGalleryViewController else { return } + view.layoutIfNeeded() + UIView.animate(withDuration: kDefaultAnimationDuration) { [weak self] in + self?.guidesVisibleConstraint.priority = .defaultLow + self?.guidesHiddenConstraint.priority = .defaultHigh + self?.guidesGalleryContainerView.alpha = 0 + self?.view.layoutIfNeeded() + } completion: { [weak self] _ in + guidesGalleryViewController.view.removeFromSuperview() + guidesGalleryViewController.willMove(toParent: nil) + guidesGalleryViewController.removeFromParent() + self?.guidesGalleryViewController = nil + self?.guidesGalleryContainerView.isHidden = true + self?.guidesVisibleConstraint.constant = 48 + } + } + + func showGuidesNavigationBar(_ groupId: MWMMarkGroupID) { + guidesNavigationBar = GuidesNavigationBarViewController(categoryId: groupId) + view.addSubview(guidesNavigationBar!.view) + addChild(guidesNavigationBar!) + guidesNavigationBar!.didMove(toParent: self) +// guidesNavigationBar!.configLayout() + NSLayoutConstraint.activate([ + guidesNavigationBar!.view.topAnchor.constraint(equalTo: view.topAnchor), + guidesNavigationBar!.view.leftAnchor.constraint(equalTo: view.leftAnchor), + guidesNavigationBar!.view.rightAnchor.constraint(equalTo: view.rightAnchor) + ]) + +// self.menuState = MWMBottomMenuStateHidden; + } + + func hideGuidesNavigationBar() { + guard let guidesNavigationBar = guidesNavigationBar else { return } + guidesNavigationBar.view.removeFromSuperview() + guidesNavigationBar.willMove(toParent: nil) + guidesNavigationBar.removeFromParent() + self.guidesNavigationBar = nil + +// _guidesNavigationBarHidden = NO; +// self.menuState = _menuRestoreState; + + } + + private func bindBottomView(_ overlay: MapOverlayViewProtocol) { + let constraint = mapButtonsView.bottomAnchor.constraint(equalTo: overlay.bottomView.topAnchor) + constraint.priority = .defaultHigh + constraint.isActive = true + } + + @IBAction func onZoomIn(_ sender: UIButton) { + presenter.zoomIn() + } + + @IBAction func onZoomOut(_ sender: UIButton) { + presenter.zoomOut() + } + + @IBAction func onLocation(_ sender: UIButton) { + presenter.switchMyPosition() + } + + @IBAction func onGuidesGalleryPan(_ sender: UIPanGestureRecognizer) { + let originalConstraint: CGFloat = 48 + switch sender.state { + case .possible, .began: + break + case .changed: + let dy = sender.translation(in: guidesGalleryContainerView).y + sender.setTranslation(.zero, in: guidesGalleryContainerView) + let constant = min(guidesVisibleConstraint.constant - dy, originalConstraint) + guidesVisibleConstraint.constant = constant + guidesGalleryContainerView.alpha = (constant + guidesGalleryContainerView.frame.height) / (guidesGalleryContainerView.frame.height + originalConstraint) + case .ended, .cancelled, .failed: + let velocity = sender.velocity(in: guidesGalleryContainerView).y + if velocity < 0 || (velocity == 0 && guidesGalleryContainerView.alpha > 0.8) { + view.layoutIfNeeded() + UIView.animate(withDuration: kDefaultAnimationDuration) { [weak self] in + self?.guidesVisibleConstraint.constant = originalConstraint + self?.guidesGalleryContainerView.alpha = 1 + self?.view.layoutIfNeeded() + } + } else { + FrameworkHelper.deactivateMapSelection(notifyUI: true) + } + @unknown default: + fatalError() + } + } +} + +extension MapControlsViewController: IMapControlsView { + func showMenu(_ mode: MapControlsMenuMode) { + switch mode { + case .full: + guard menuViewController == nil else { fatalError() } + menuViewController = BottomMenuBuilder.buildMenu(mapViewController: MapViewController.shared(), delegate: self) + present(menuViewController!, animated: true) + case .layers: + guard menuViewController == nil else { fatalError() } + menuViewController = BottomMenuBuilder.buildLayers(mapViewController: MapViewController.shared(), delegate: self) + present(menuViewController!, animated: true) + case .inactive: + guard menuViewController != nil else { fatalError() } + dismiss(animated: true) + menuViewController = nil + case .hidden: + guard menuViewController != nil else { fatalError() } + dismiss(animated: true) + menuViewController = nil + } + } + + func showPlacePage() { + guard PlacePageData.hasData else { return } + + if PlacePageData.isGuide { + showGuidesGallery() + } else { + showRegularPlacePage() + } + } + + func hidePlacePage() { + guard let placePageViewController = placePageViewController else { + hideGuidesGallery() + return + } + placePageViewController.view.removeFromSuperview() + placePageViewController.willMove(toParent: nil) + placePageViewController.removeFromParent() + self.placePageViewController = nil + placePageContainerView.isHidden = true + } + + func updatePlacePage() { + + } + + func toggleControlsVisibility() { + view.layoutIfNeeded() + UIView.animate(withDuration: kDefaultAnimationDuration) { [weak self] in + guard let self = self else { return } + if self.layersButtonContainerView.alpha == 0 && self.sideButtonsContainerView.alpha == 0 { + self.layersButtonContainerView.alpha = 1 + self.sideButtonsContainerView.alpha = 1 + self.layersButtonVisibleConstraint.priority = .defaultHigh + self.layersButtonHiddenConstraint.priority = .defaultLow + self.sideButtonsVisibleConstraint.priority = .defaultHigh + self.sideButtonsHiddenConstraint.priority = .defaultLow + } else { + self.layersButtonContainerView.alpha = 0 + self.sideButtonsContainerView.alpha = 0 + self.layersButtonVisibleConstraint.priority = .defaultLow + self.layersButtonHiddenConstraint.priority = .defaultHigh + self.sideButtonsVisibleConstraint.priority = .defaultLow + self.sideButtonsHiddenConstraint.priority = .defaultHigh + } + self.view.layoutIfNeeded() + } + } +} + +extension MapControlsViewController: BottomTabBarViewControllerDelegate { + func search() { + presenter.search() + } + + func route() { + presenter.route() + } + + func discovery() { + presenter.discovery() + } + + func bookmarks() { + presenter.bookmarks() + } + + func menu() { + presenter.menu() + } +} + +extension MapControlsViewController: BottomMenuDelegate { + func addPlace() { + + } + + func didFinishAddingPlace() { + + } + + func didFinish() { + presenter.hideMenu() + } +} diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index d692bcef85e..b10b9ae1a3b 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -33,8 +33,6 @@ extern NSString *const kMap2FBLoginSegue = @"Map2FBLogin"; extern NSString *const kMap2GoogleLoginSegue = @"Map2GoogleLogin"; -typedef NS_ENUM(NSUInteger, UserTouchesAction) { UserTouchesActionNone, UserTouchesActionDrag, UserTouchesActionScale }; - namespace { NSString *const kDownloaderSegue = @"Map2MapDownloaderSegue"; NSString *const kEditorSegue = @"Map2EditorSegue"; @@ -79,8 +77,6 @@ @interface MapViewController () > *listeners; @@ -116,137 +113,10 @@ + (MapViewController *)sharedController { #pragma mark - Map Navigation -- (void)showRegularPlacePage { - self.placePageVC = [PlacePageBuilder build]; - self.placePageContainer.hidden = NO; - [self.placePageContainer addSubview:self.placePageVC.view]; - [self.view bringSubviewToFront:self.placePageContainer]; - [NSLayoutConstraint activateConstraints:@[ - [self.placePageVC.view.topAnchor constraintEqualToAnchor:self.placePageContainer.safeAreaLayoutGuide.topAnchor], - [self.placePageVC.view.leftAnchor constraintEqualToAnchor:self.placePageContainer.leftAnchor], - [self.placePageVC.view.bottomAnchor constraintEqualToAnchor:self.placePageContainer.bottomAnchor], - [self.placePageVC.view.rightAnchor constraintEqualToAnchor:self.placePageContainer.rightAnchor] - ]]; - self.placePageVC.view.translatesAutoresizingMaskIntoConstraints = NO; - [self addChildViewController:self.placePageVC]; - [self.placePageVC didMoveToParentViewController:self]; -} - -- (void)showGuidesGallery { - self.guidesGalleryVC = [MWMGuidesGalleryBuilder build]; - self.guidesCollectionContainer.hidden = NO; - [self.guidesCollectionContainer addSubview:self.guidesGalleryVC.view]; - [NSLayoutConstraint activateConstraints:@[ - [self.guidesGalleryVC.view.topAnchor constraintEqualToAnchor:self.guidesCollectionContainer.topAnchor], - [self.guidesGalleryVC.view.leftAnchor constraintEqualToAnchor:self.guidesCollectionContainer.leftAnchor], - [self.guidesGalleryVC.view.bottomAnchor constraintEqualToAnchor:self.guidesCollectionContainer.bottomAnchor], - [self.guidesGalleryVC.view.rightAnchor constraintEqualToAnchor:self.guidesCollectionContainer.rightAnchor] - ]]; - self.guidesGalleryVC.view.translatesAutoresizingMaskIntoConstraints = NO; - [self addChildViewController:self.guidesGalleryVC]; - [self.guidesGalleryVC didMoveToParentViewController:self]; - self.guidesVisibleConstraint.priority = UILayoutPriorityDefaultLow; - self.guidesHiddenConstraint.priority = UILayoutPriorityDefaultHigh; - self.guidesCollectionContainer.alpha = 0; - [self.view layoutIfNeeded]; - [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ - self.guidesVisibleConstraint.priority = UILayoutPriorityDefaultHigh; - self.guidesHiddenConstraint.priority = UILayoutPriorityDefaultLow; - [self.view layoutIfNeeded]; - self.guidesCollectionContainer.alpha = 1; - }]; - [self setPlacePageTopBound:self.view.height - self.guidesCollectionContainer.minY duration:kDefaultAnimationDuration]; -} - -- (void)showPlacePage { - if (!PlacePageData.hasData) { - return; - } - - self.controlsManager.trafficButtonHidden = YES; - if (PlacePageData.isGuide) { - [self showGuidesGallery]; - } else { - [self showRegularPlacePage]; - } -} - - (void)dismissPlacePage { GetFramework().DeactivateMapSelection(true); } -- (void)hideRegularPlacePage { - [self.placePageVC.view removeFromSuperview]; - [self.placePageVC willMoveToParentViewController:nil]; - [self.placePageVC removeFromParentViewController]; - self.placePageVC = nil; - self.placePageContainer.hidden = YES; - [self setPlacePageTopBound:0 duration:0]; -} - -- (void)hideGuidesGallery { - [self.view layoutIfNeeded]; - [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ - self.guidesVisibleConstraint.priority = UILayoutPriorityDefaultLow; - self.guidesHiddenConstraint.priority = UILayoutPriorityDefaultHigh; - [self.view layoutIfNeeded]; - self.guidesCollectionContainer.alpha = 0; - } completion:^(BOOL finished) { - [self.guidesGalleryVC.view removeFromSuperview]; - [self.guidesGalleryVC willMoveToParentViewController:nil]; - [self.guidesGalleryVC removeFromParentViewController]; - self.guidesGalleryVC = nil; - self.guidesCollectionContainer.hidden = YES; - self.guidesVisibleConstraint.constant = 48; - }]; - [self setPlacePageTopBound:0 duration:kDefaultAnimationDuration]; -} - -- (void)hidePlacePage { - if (self.placePageVC != nil) { - [self hideRegularPlacePage]; - } else if (self.guidesGalleryVC != nil) { - [self hideGuidesGallery]; - } - self.controlsManager.trafficButtonHidden = NO; -} - -- (void)onMapObjectDeselected:(bool)switchFullScreenMode { - [self hidePlacePage]; - - BOOL const isSearchResult = [MWMSearchManager manager].state == MWMSearchManagerStateResult; - BOOL const isNavigationDashboardHidden = [MWMNavigationDashboardManager sharedManager].state == MWMNavigationDashboardStateHidden; - if (isSearchResult) { - if (isNavigationDashboardHidden) { - [MWMSearchManager manager].state = MWMSearchManagerStateMapSearch; - } else { - [MWMSearchManager manager].state = MWMSearchManagerStateHidden; - } - } - - if (!switchFullScreenMode) - return; - - if (DeepLinkHandler.shared.isLaunchedByDeeplink) - return; - - BOOL const isSearchHidden = [MWMSearchManager manager].state == MWMSearchManagerStateHidden; - if (isSearchHidden && isNavigationDashboardHidden) { - self.controlsManager.hidden = !self.controlsManager.hidden; - } -} - -- (void)onMapObjectSelected { - [self hidePlacePage]; - [[MWMNetworkPolicy sharedPolicy] callOnlineApi:^(BOOL) { - [self showPlacePage]; - }]; -} - -- (void)onMapObjectUpdated { - // [self.controlsManager updatePlacePage]; -} - - (IBAction)onGudesGalleryPan:(UIPanGestureRecognizer *)sender { CGFloat originalConstant = 48; UIView *galleryView = self.guidesCollectionContainer; @@ -418,6 +288,19 @@ - (void)viewDidLoad { self.view.clipsToBounds = YES; [MWMKeyboard addObserver:self]; + + self.mapControlsViewController = [MapControlsBuilder buildWithBookmarksCoordinator:self.bookmarksCoordinator]; + self.mapControlsViewController.view.translatesAutoresizingMaskIntoConstraints = NO; + [self.view addSubview:self.mapControlsViewController.view]; + [NSLayoutConstraint activateConstraints:@[ + [self.mapControlsViewController.view.topAnchor constraintEqualToAnchor:self.view.topAnchor], + [self.mapControlsViewController.view.leftAnchor constraintEqualToAnchor:self.view.leftAnchor], + [self.mapControlsViewController.view.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor], + [self.mapControlsViewController.view.rightAnchor constraintEqualToAnchor:self.view.rightAnchor] + ]]; + [self addChildViewController:self.mapControlsViewController]; + [self.mapControlsViewController didMoveToParentViewController:self]; + self.welcomePageController = [MWMWelcomePageController controllerWithParent:self]; [self processMyPositionStateModeEvent:[MWMLocationManager isLocationProhibited] ? MWMMyPositionModeNotFollowNoPosition : MWMMyPositionModePendingPosition]; @@ -518,10 +401,6 @@ - (void)initialize { self.listeners = [NSHashTable> weakObjectsHashTable]; Framework &f = GetFramework(); // TODO: Review and improve this code. - f.SetPlacePageListeners([self]() { [self onMapObjectSelected]; }, - [self](bool switchFullScreen) { [self onMapObjectDeselected:switchFullScreen]; }, - [self]() { [self onMapObjectUpdated]; }); - // TODO: Review and improve this code. f.SetMyPositionModeListener([self](location::EMyPositionMode mode, bool routingActive) { // TODO: Two global listeners are subscribed to the same event from the core. // Probably it's better to subscribe only wnen needed and usubscribe in other cases. @@ -530,7 +409,6 @@ - (void)initialize { }); f.SetMyPositionPendingTimeoutListener([self] { [self processMyPositionPendingTimeout]; }); - self.userTouchesAction = UserTouchesActionNone; [[MWMBookmarksManager sharedManager] addObserver:self]; [[MWMBookmarksManager sharedManager] loadBookmarks]; [MWMFrameworkListener addObserver:self]; @@ -894,7 +772,6 @@ + (void)setViewport:(double)lat lon:(double)lon zoomLevel:(int)zoomLevel { - (BookmarksCoordinator *)bookmarksCoordinator { if (!_bookmarksCoordinator) _bookmarksCoordinator = [[BookmarksCoordinator alloc] initWithNavigationController:self.navigationController - controlsManager:self.controlsManager navigationManager:[MWMNavigationDashboardManager sharedManager]]; return _bookmarksCoordinator; } diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index e6fa170c57d..ee02bd8f9f6 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -545,7 +545,7 @@ - (void)showMap { - (void)updateApplicationIconBadgeNumber { auto const number = [self badgeNumber]; UIApplication.sharedApplication.applicationIconBadgeNumber = number; - BottomTabBarViewController.controller.isApplicationBadgeHidden = number == 0; +// BottomTabBarViewController.controller.isApplicationBadgeHidden = number == 0; } - (NSUInteger)badgeNumber { diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index fe0d1efbd70..227f3a12ab7 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -113,8 +113,7 @@ 345E8F4F1F83984500A826CC /* GoogleSignInDependencies.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 347D15C81F82362900E86251 /* GoogleSignInDependencies.framework */; }; 3462258F1DDC5DBA001E8752 /* MWMSearchNoResultsAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3462258D1DDC5DBA001E8752 /* MWMSearchNoResultsAlert.mm */; }; 346225921DDC5FBA001E8752 /* MWMSearchNoResultsAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = 346225901DDC5FBA001E8752 /* MWMSearchNoResultsAlert.xib */; }; - 3463BA671DE81DB90082417F /* MWMTrafficButtonViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3463BA641DE81DB90082417F /* MWMTrafficButtonViewController.mm */; }; - 3463BA691DE81DB90082417F /* MWMTrafficButtonViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3463BA651DE81DB90082417F /* MWMTrafficButtonViewController.xib */; }; + 3463BA691DE81DB90082417F /* TrafficButtonViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3463BA651DE81DB90082417F /* TrafficButtonViewController.xib */; }; 3467CEB2202C6EEE00D3C670 /* BMCNotificationsHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3467CEB1202C6EEE00D3C670 /* BMCNotificationsHeader.swift */; }; 3467CEB6202C6FA900D3C670 /* BMCNotificationsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3467CEB4202C6FA900D3C670 /* BMCNotificationsCell.swift */; }; 3467CEB7202C6FA900D3C670 /* BMCNotificationsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3467CEB5202C6FA900D3C670 /* BMCNotificationsCell.xib */; }; @@ -354,6 +353,11 @@ 474AC76C2139E4F2002F9BF9 /* RemoveAdsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474AC76A2139E4F2002F9BF9 /* RemoveAdsViewController.swift */; }; 474AC76D2139E4F2002F9BF9 /* RemoveAdsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 474AC76B2139E4F2002F9BF9 /* RemoveAdsViewController.xib */; }; 474C9F5A213FF75800369009 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 474C9F59213FF75800369009 /* StoreKit.framework */; }; + 4753645B254CFFAA00E92D13 /* MapControlsBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4753645A254CFFAA00E92D13 /* MapControlsBuilder.swift */; }; + 4753645D254CFFBE00E92D13 /* MapControlsInterfaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4753645C254CFFBE00E92D13 /* MapControlsInterfaces.swift */; }; + 4753645F254CFFE400E92D13 /* MapControlsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4753645E254CFFE400E92D13 /* MapControlsPresenter.swift */; }; + 47536461254CFFFF00E92D13 /* MapControlsInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47536460254CFFFF00E92D13 /* MapControlsInteractor.swift */; }; + 47536463254D04BD00E92D13 /* MapControlsRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47536462254D04BD00E92D13 /* MapControlsRouter.swift */; }; 4757D6212535BB6E0062364F /* BookmarksListInterfaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4757D6202535BB6E0062364F /* BookmarksListInterfaces.swift */; }; 475EC36D244EDE66003BC295 /* GuidesGalleryPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475EC36C244EDE66003BC295 /* GuidesGalleryPresenter.swift */; }; 475EC36F244EF7A9003BC295 /* GuidesGalleryBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475EC36E244EF7A9003BC295 /* GuidesGalleryBuilder.swift */; }; @@ -403,6 +407,7 @@ 47B9065321C7FA400079C85E /* MWMImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 47B9064A21C7FA3C0079C85E /* MWMImageCache.m */; }; 47B9065421C7FA400079C85E /* UIImageView+WebImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 47B9064F21C7FA3E0079C85E /* UIImageView+WebImage.m */; }; 47B9065521C7FA400079C85E /* NSString+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 47B9065021C7FA3F0079C85E /* NSString+MD5.m */; }; + 47BCC18E2540F08D009413A1 /* MapControlsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47BCC18D2540F08D009413A1 /* MapControlsViewController.swift */; }; 47C7F9732191E15A00C2760C /* InAppBilling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C7F9722191E15A00C2760C /* InAppBilling.swift */; }; 47C7F97521930F5300C2760C /* IInAppBilling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C7F97421930F5300C2760C /* IInAppBilling.swift */; }; 47C8789022DF525A00A772DA /* SubscriptionSuccessViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C8788E22DF525A00A772DA /* SubscriptionSuccessViewController.swift */; }; @@ -448,6 +453,7 @@ 47E6CB0B2178BA3600EA102B /* SearchBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E6CB092178BA3600EA102B /* SearchBannerCell.swift */; }; 47E6CB0C2178BA3600EA102B /* SearchBannerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 47E6CB0A2178BA3600EA102B /* SearchBannerCell.xib */; }; 47E8163323B17734008FD836 /* MWMStorage+UI.m in Sources */ = {isa = PBXBuildFile; fileRef = 47E8163223B17734008FD836 /* MWMStorage+UI.m */; }; + 47E850E92553E63F00B890E1 /* TrafficButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E850E82553E63F00B890E1 /* TrafficButtonViewController.swift */; }; 47EF05B321504D8F00EAC269 /* RemoveAdsPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EF05B221504D8F00EAC269 /* RemoveAdsPresentationController.swift */; }; 47EF73FC247050E100D32AB8 /* GuidesGalleryRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EF73FB247050E100D32AB8 /* GuidesGalleryRouter.swift */; }; 47EF73FE247056A600D32AB8 /* GuidesGalleryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EF73FD247056A600D32AB8 /* GuidesGalleryCell.swift */; }; @@ -523,7 +529,6 @@ 6741AA1C1BF340DE002C974C /* MWMRoutingDisclaimerAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = F63774E91B59376F00BCF54D /* MWMRoutingDisclaimerAlert.m */; }; 6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = F64F19971AB81A00006EAF7E /* MWMDownloadTransitMapAlert.mm */; }; 6741AA281BF340DE002C974C /* MWMAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = F64F19861AB81A00006EAF7E /* MWMAlert.mm */; }; - 6741AA2B1BF340DE002C974C /* CircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB917C2B1E2003E7E92 /* CircleView.m */; }; 6741AA361BF340DE002C974C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 34570A3A1B13222600E6D4FD /* libz.dylib */; settings = {ATTRIBUTES = (Required, ); }; }; 6741AABD1BF356BA002C974C /* libagg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6741AAA21BF356B9002C974C /* libagg.a */; }; 6741AABE1BF356BA002C974C /* libalohalitics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6741AAA31BF356B9002C974C /* libalohalitics.a */; }; @@ -1118,9 +1123,7 @@ 3462258C1DDC5DB9001E8752 /* MWMSearchNoResultsAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchNoResultsAlert.h; sourceTree = ""; }; 3462258D1DDC5DBA001E8752 /* MWMSearchNoResultsAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMSearchNoResultsAlert.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 346225901DDC5FBA001E8752 /* MWMSearchNoResultsAlert.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMSearchNoResultsAlert.xib; sourceTree = ""; }; - 3463BA631DE81DB90082417F /* MWMTrafficButtonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMTrafficButtonViewController.h; sourceTree = ""; }; - 3463BA641DE81DB90082417F /* MWMTrafficButtonViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMTrafficButtonViewController.mm; sourceTree = ""; }; - 3463BA651DE81DB90082417F /* MWMTrafficButtonViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMTrafficButtonViewController.xib; sourceTree = ""; }; + 3463BA651DE81DB90082417F /* TrafficButtonViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TrafficButtonViewController.xib; sourceTree = ""; }; 3467CEB1202C6EEE00D3C670 /* BMCNotificationsHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMCNotificationsHeader.swift; sourceTree = ""; }; 3467CEB4202C6FA900D3C670 /* BMCNotificationsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMCNotificationsCell.swift; sourceTree = ""; }; 3467CEB5202C6FA900D3C670 /* BMCNotificationsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BMCNotificationsCell.xib; sourceTree = ""; }; @@ -1509,6 +1512,11 @@ 474AC76A2139E4F2002F9BF9 /* RemoveAdsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAdsViewController.swift; sourceTree = ""; }; 474AC76B2139E4F2002F9BF9 /* RemoveAdsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RemoveAdsViewController.xib; sourceTree = ""; }; 474C9F59213FF75800369009 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; + 4753645A254CFFAA00E92D13 /* MapControlsBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsBuilder.swift; sourceTree = ""; }; + 4753645C254CFFBE00E92D13 /* MapControlsInterfaces.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsInterfaces.swift; sourceTree = ""; }; + 4753645E254CFFE400E92D13 /* MapControlsPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsPresenter.swift; sourceTree = ""; }; + 47536460254CFFFF00E92D13 /* MapControlsInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsInteractor.swift; sourceTree = ""; }; + 47536462254D04BD00E92D13 /* MapControlsRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsRouter.swift; sourceTree = ""; }; 4757D6202535BB6E0062364F /* BookmarksListInterfaces.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksListInterfaces.swift; sourceTree = ""; }; 475EC36C244EDE66003BC295 /* GuidesGalleryPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuidesGalleryPresenter.swift; sourceTree = ""; }; 475EC36E244EF7A9003BC295 /* GuidesGalleryBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuidesGalleryBuilder.swift; sourceTree = ""; }; @@ -1566,6 +1574,7 @@ 47B9064F21C7FA3E0079C85E /* UIImageView+WebImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+WebImage.m"; sourceTree = ""; }; 47B9065021C7FA3F0079C85E /* NSString+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MD5.m"; sourceTree = ""; }; 47B9065121C7FA400079C85E /* IMWMImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMWMImageCache.h; sourceTree = ""; }; + 47BCC18D2540F08D009413A1 /* MapControlsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapControlsViewController.swift; sourceTree = ""; }; 47C7F9722191E15A00C2760C /* InAppBilling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppBilling.swift; sourceTree = ""; }; 47C7F97421930F5300C2760C /* IInAppBilling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IInAppBilling.swift; sourceTree = ""; }; 47C8788E22DF525A00A772DA /* SubscriptionSuccessViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionSuccessViewController.swift; sourceTree = ""; }; @@ -1609,6 +1618,7 @@ 47E6CB0A2178BA3600EA102B /* SearchBannerCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchBannerCell.xib; sourceTree = ""; }; 47E8163123B17734008FD836 /* MWMStorage+UI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMStorage+UI.h"; sourceTree = ""; }; 47E8163223B17734008FD836 /* MWMStorage+UI.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MWMStorage+UI.m"; sourceTree = ""; }; + 47E850E82553E63F00B890E1 /* TrafficButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrafficButtonViewController.swift; sourceTree = ""; }; 47EF05B221504D8F00EAC269 /* RemoveAdsPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAdsPresentationController.swift; sourceTree = ""; }; 47EF73FB247050E100D32AB8 /* GuidesGalleryRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuidesGalleryRouter.swift; sourceTree = ""; }; 47EF73FD247056A600D32AB8 /* GuidesGalleryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuidesGalleryCell.swift; sourceTree = ""; }; @@ -1965,8 +1975,6 @@ CDCA278C2248F34C00167D87 /* MWMRouterResultCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRouterResultCode.h; sourceTree = ""; }; CDCA278F2248F3B800167D87 /* MWMLocationModeListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMLocationModeListener.h; sourceTree = ""; }; CDE0F3AD225B8D45008BA5C3 /* MWMSpeedCameraManagerMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMSpeedCameraManagerMode.h; sourceTree = ""; }; - ED48BBB817C2B1E2003E7E92 /* CircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircleView.h; sourceTree = ""; }; - ED48BBB917C2B1E2003E7E92 /* CircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CircleView.m; sourceTree = ""; }; EE026F0511D6AC0D00645242 /* classificator.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = classificator.txt; path = ../../data/classificator.txt; sourceTree = SOURCE_ROOT; }; EE164810135CEE49003B8A3E /* 06_code2000.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 06_code2000.ttf; path = ../../data/06_code2000.ttf; sourceTree = SOURCE_ROOT; }; EE583CBA12F773F00042CBE3 /* unicode_blocks.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = unicode_blocks.txt; path = ../../data/unicode_blocks.txt; sourceTree = ""; }; @@ -2083,7 +2091,6 @@ F6E2FC261E097B9F0083EBEC /* MWMNoMapsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMNoMapsView.m; sourceTree = ""; }; F6E2FC271E097B9F0083EBEC /* MWMNoMapsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMNoMapsViewController.h; sourceTree = ""; }; F6E2FC281E097B9F0083EBEC /* MWMNoMapsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNoMapsViewController.mm; sourceTree = ""; }; - F6E2FC2A1E097B9F0083EBEC /* legacy_bookmark_colors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = legacy_bookmark_colors.h; sourceTree = ""; }; F6E2FC341E097B9F0083EBEC /* MWMEditorAdditionalNamesTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMEditorAdditionalNamesTableViewController.h; sourceTree = ""; }; F6E2FC351E097B9F0083EBEC /* MWMEditorAdditionalNamesTableViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMEditorAdditionalNamesTableViewController.mm; sourceTree = ""; }; F6E2FC371E097B9F0083EBEC /* MWMCuisineEditorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMCuisineEditorViewController.h; sourceTree = ""; }; @@ -2931,9 +2938,8 @@ 3463BA621DE81D760082417F /* TrafficButton */ = { isa = PBXGroup; children = ( - 3463BA631DE81DB90082417F /* MWMTrafficButtonViewController.h */, - 3463BA641DE81DB90082417F /* MWMTrafficButtonViewController.mm */, - 3463BA651DE81DB90082417F /* MWMTrafficButtonViewController.xib */, + 3463BA651DE81DB90082417F /* TrafficButtonViewController.xib */, + 47E850E82553E63F00B890E1 /* TrafficButtonViewController.swift */, ); path = TrafficButton; sourceTree = ""; @@ -3547,6 +3553,19 @@ path = Metrics; sourceTree = ""; }; + 47536459254CFF7000E92D13 /* MapControlsViewControls */ = { + isa = PBXGroup; + children = ( + 47BCC18D2540F08D009413A1 /* MapControlsViewController.swift */, + 4753645A254CFFAA00E92D13 /* MapControlsBuilder.swift */, + 4753645C254CFFBE00E92D13 /* MapControlsInterfaces.swift */, + 4753645E254CFFE400E92D13 /* MapControlsPresenter.swift */, + 47536460254CFFFF00E92D13 /* MapControlsInteractor.swift */, + 47536462254D04BD00E92D13 /* MapControlsRouter.swift */, + ); + path = MapControlsViewControls; + sourceTree = ""; + }; 47B06DEB21B6962D0094CCAD /* GeoTracker */ = { isa = PBXGroup; children = ( @@ -3687,8 +3706,6 @@ isa = PBXGroup; children = ( 995739022355CA5D0019AEE7 /* Pages */, - ED48BBB817C2B1E2003E7E92 /* CircleView.h */, - ED48BBB917C2B1E2003E7E92 /* CircleView.m */, 349A35741B53D4C9009677EE /* CircularProgress */, 34ABA60F1C2D17C200FE1BEC /* Login */, 34BC72091B0DECAE0012A34B /* MapViewControls */, @@ -4350,6 +4367,7 @@ F613FA741AB330AF002394D4 /* MapViewController */ = { isa = PBXGroup; children = ( + 47536459254CFF7000E92D13 /* MapControlsViewControls */, 46F8A2EB10EB63040045521A /* MapViewController.h */, EED10A4411F78D120095FAD4 /* MapViewController.mm */, ); @@ -4641,7 +4659,6 @@ F6E2FC291E097B9F0083EBEC /* EditBookmark */ = { isa = PBXGroup; children = ( - F6E2FC2A1E097B9F0083EBEC /* legacy_bookmark_colors.h */, 471A7BBF2481C82500A0D4C1 /* BookmarkTitleCell.swift */, 471A7BC12481C9B700A0D4C1 /* BookmarkTitleCell.xib */, 471A7BBD2481A3D000A0D4C1 /* EditBookmarkViewController.swift */, @@ -5359,7 +5376,7 @@ 346DB82B1E5C4F6700E3123E /* GalleryCell.xib in Resources */, F6E2FE2E1E097BA00083EBEC /* MWMStreetEditorEditTableViewCell.xib in Resources */, 47A13CAB24BE881000027D4F /* DatePickerViewController.xib in Resources */, - 3463BA691DE81DB90082417F /* MWMTrafficButtonViewController.xib in Resources */, + 3463BA691DE81DB90082417F /* TrafficButtonViewController.xib in Resources */, F623DA6C1C9C2731006A3436 /* opening_hours_how_to_edit.html in Resources */, 993ECBB424E40CEC00EA5DEF /* GuidesNavigationBarViewController.xib in Resources */, 47E6CB0C2178BA3600EA102B /* SearchBannerCell.xib in Resources */, @@ -5553,6 +5570,7 @@ 34D3AFF61E37A36A004100F9 /* UICollectionView+Cells.swift in Sources */, 4767CDA420AAF66B00BD8166 /* NSAttributedString+HTML.swift in Sources */, 47B06DFE21B965950094CCAD /* Geo.swift in Sources */, + 47BCC18E2540F08D009413A1 /* MapControlsViewController.swift in Sources */, 6741A9A91BF340DE002C974C /* MWMDefaultAlert.mm in Sources */, 990F33B624BC915200D0F426 /* SearchActionBarView.swift in Sources */, 3DBD7B9F242363E500ED9FE8 /* PartnerBannerViewController.swift in Sources */, @@ -5573,6 +5591,7 @@ 99C964292428C0F700E41723 /* PlacePageHeaderPresenter.swift in Sources */, F6E2FE101E097BA00083EBEC /* MWMOpeningHoursTableViewCell.mm in Sources */, 47C8789D22DF662700A772DA /* SubscriptionExpiredViewController.swift in Sources */, + 4753645B254CFFAA00E92D13 /* MapControlsBuilder.swift in Sources */, 6741A9B01BF340DE002C974C /* MapsAppDelegate.mm in Sources */, 996D108824E16E6F002DD0E2 /* BookmarksBannerViewController.swift in Sources */, 993DF12723F6BDB100AC231A /* Fonts.swift in Sources */, @@ -5587,6 +5606,7 @@ BB8123D62130427E00ADE512 /* MetalContextFactory.mm in Sources */, 99A906E823F6F7030005872B /* PlacePageReviewsViewController.swift in Sources */, 3467CEB2202C6EEE00D3C670 /* BMCNotificationsHeader.swift in Sources */, + 47E850E92553E63F00B890E1 /* TrafficButtonViewController.swift in Sources */, 34F4072F1E9E1AFF00E57AC0 /* BannersCache.swift in Sources */, 34D3B0211E389D05004100F9 /* MWMEditorAddAdditionalNameTableViewCell.m in Sources */, 99D363192358685300941BF4 /* SubscriptionGroupItem.swift in Sources */, @@ -5696,7 +5716,6 @@ 99A906E923F6F7030005872B /* WikiDescriptionViewController.swift in Sources */, 99A906DF23F6F7030005872B /* HotelFacilitiesViewController.swift in Sources */, 993DF11023F6BDB100AC231A /* MWMButtonRenderer.swift in Sources */, - 3463BA671DE81DB90082417F /* MWMTrafficButtonViewController.mm in Sources */, 993DF10323F6BDB100AC231A /* MainTheme.swift in Sources */, 34AB66051FC5AA320078E451 /* MWMNavigationDashboardManager+Entity.mm in Sources */, 993DF12A23F6BDB100AC231A /* Style.swift in Sources */, @@ -5942,6 +5961,7 @@ 34AB66591FC5AA330078E451 /* TransportTransitFlowLayout.swift in Sources */, 99CB34962369C281001D28AD /* FirstLaunchBuilder.swift in Sources */, 3486B5191E27AD3B0069C126 /* MWMFrameworkListener.mm in Sources */, + 47536461254CFFFF00E92D13 /* MapControlsInteractor.swift in Sources */, 3404756B1E081A4600C92850 /* MWMSearch+CoreSpotlight.mm in Sources */, CD9AD96C2281B56900EC174A /* CPViewPortState.swift in Sources */, F653CE121C6DEC8E00A453F1 /* MWMDropDown.m in Sources */, @@ -5949,6 +5969,7 @@ 3454D7BC1E07F045004AF2AD /* CLLocation+Mercator.mm in Sources */, 47E3C7272111E5A8008B3B27 /* AlertPresentationController.swift in Sources */, F6E2FF4E1E097BA00083EBEC /* MWMAboutController.m in Sources */, + 4753645D254CFFBE00E92D13 /* MapControlsInterfaces.swift in Sources */, 993F5512237C622700545511 /* DeepLinkFileStrategy.swift in Sources */, 47EF73FE247056A600D32AB8 /* GuidesGalleryCell.swift in Sources */, 47B06DF921B95F5E0094CCAD /* IGeoTracker.swift in Sources */, @@ -6054,6 +6075,7 @@ 9917D17D2396793A00A7E06E /* PaidRoutesSubscriptionCampaign.swift in Sources */, 3404165C1E7C29AE00E2B6D6 /* PhotosInteractionAnimator.swift in Sources */, 470B3630244E2DB400C0EA9E /* GuidesGalleryViewController.swift in Sources */, + 4753645F254CFFE400E92D13 /* MapControlsPresenter.swift in Sources */, 993F550E237C622700545511 /* DeepLinkCataloguePathStrategy.swift in Sources */, 3404756E1E081A4600C92850 /* MWMSearch.mm in Sources */, 6741AA191BF340DE002C974C /* MWMDownloaderDialogCell.m in Sources */, @@ -6130,7 +6152,6 @@ 340416441E7BED3900E2B6D6 /* PhotosTransitionAnimator.swift in Sources */, 34AB66261FC5AA330078E451 /* RouteManagerDimView.swift in Sources */, 993F5514237C622700545511 /* DeepLinkStrategyFactory.swift in Sources */, - 6741AA2B1BF340DE002C974C /* CircleView.m in Sources */, 99CB34982369C291001D28AD /* FirstLaunchPresenter.swift in Sources */, CD08887422B7ABB400C1368D /* MWMDiscoveryCollectionView.mm in Sources */, 4788739220EE326500F6826B /* VerticallyAlignedButton.swift in Sources */, @@ -6156,6 +6177,7 @@ F5BD29FF26AD58255766C51A /* DiscoverySpinnerCell.swift in Sources */, 47E3C72B2111E62A008B3B27 /* FadeOutAnimatedTransitioning.swift in Sources */, F5BD255A0838E70EC012748E /* DiscoverySearchCell.swift in Sources */, + 47536463254D04BD00E92D13 /* MapControlsRouter.swift in Sources */, 47C7F9732191E15A00C2760C /* InAppBilling.swift in Sources */, F5BD2CA4DBEFACBC48195F39 /* DiscoveryCollectionHolderCell.swift in Sources */, 4796037524482E3900F3BDD0 /* KeychainStorage.swift in Sources */, diff --git a/iphone/Maps/UI/AvailableArea/GuidesNavigationBarArea.swift b/iphone/Maps/UI/AvailableArea/GuidesNavigationBarArea.swift index 50fca02f197..4c326816cfd 100644 --- a/iphone/Maps/UI/AvailableArea/GuidesNavigationBarArea.swift +++ b/iphone/Maps/UI/AvailableArea/GuidesNavigationBarArea.swift @@ -12,7 +12,7 @@ final class GuidesNavigationBarArea: AvailableArea { } override func notifyObserver() { - GuidesNavigationBarViewController.updateAvailableArea(areaFrame) +// GuidesNavigationBarViewController.updateAvailableArea(areaFrame) } } diff --git a/iphone/Maps/UI/AvailableArea/TabBarArea.swift b/iphone/Maps/UI/AvailableArea/TabBarArea.swift index 1bef98ac039..9ab36e6fefe 100644 --- a/iphone/Maps/UI/AvailableArea/TabBarArea.swift +++ b/iphone/Maps/UI/AvailableArea/TabBarArea.swift @@ -14,7 +14,7 @@ final class TabBarArea: AvailableArea { } override func notifyObserver() { - BottomTabBarViewController.updateAvailableArea(areaFrame) +// BottomTabBarViewController.updateAvailableArea(areaFrame) } } diff --git a/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift b/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift index 8747e23f455..f5da63c78cb 100644 --- a/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift +++ b/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift @@ -10,7 +10,7 @@ final class TrafficButtonArea: AvailableArea { } override func notifyObserver() { - MWMTrafficButtonViewController.updateAvailableArea(areaFrame) +// MWMTrafficButtonViewController.updateAvailableArea(areaFrame) } } diff --git a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuBuilder.swift b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuBuilder.swift index 1424425ed15..b25e2420b2f 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuBuilder.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuBuilder.swift @@ -1,33 +1,27 @@ @objc class BottomMenuBuilder: NSObject { @objc static func buildMenu(mapViewController: MapViewController, - controlsManager: MWMMapViewControlsManager, delegate: BottomMenuDelegate) -> UIViewController { return BottomMenuBuilder.build(mapViewController: mapViewController, - controlsManager: controlsManager, delegate: delegate, sections: [.layers, .items], source: kStatMenu) } @objc static func buildLayers(mapViewController: MapViewController, - controlsManager: MWMMapViewControlsManager, delegate: BottomMenuDelegate) -> UIViewController { return BottomMenuBuilder.build(mapViewController: mapViewController, - controlsManager: controlsManager, delegate: delegate, sections: [.layers], source: kStatMap) } private static func build(mapViewController: MapViewController, - controlsManager: MWMMapViewControlsManager, delegate: BottomMenuDelegate, sections: [BottomMenuPresenter.Sections], source: String) -> UIViewController { let viewController = BottomMenuViewController(nibName: nil, bundle: nil) let interactor = BottomMenuInteractor(viewController: viewController, mapViewController: mapViewController, - controlsManager: controlsManager, delegate: delegate) let presenter = BottomMenuPresenter(view: viewController, interactor: interactor, sections: sections, source: source) diff --git a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift index c9b439b80f6..5d01d9b217b 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/BottomMenuInteractor.swift @@ -8,9 +8,9 @@ protocol BottomMenuInteractorProtocol: class { } @objc protocol BottomMenuDelegate { - func actionDownloadMaps(_ mode: MWMMapDownloaderMode) func addPlace() func didFinishAddingPlace() + func didFinish() } class BottomMenuInteractor { @@ -18,26 +18,27 @@ class BottomMenuInteractor { private weak var viewController: UIViewController? private weak var mapViewController: MapViewController? private weak var delegate: BottomMenuDelegate? - private weak var controlsManager: MWMMapViewControlsManager? +// private weak var controlsManager: MWMMapViewControlsManager? init(viewController: UIViewController, mapViewController: MapViewController, - controlsManager: MWMMapViewControlsManager, +// controlsManager: MWMMapViewControlsManager, delegate: BottomMenuDelegate) { self.viewController = viewController self.mapViewController = mapViewController self.delegate = delegate - self.controlsManager = controlsManager +// self.controlsManager = controlsManager } } extension BottomMenuInteractor: BottomMenuInteractorProtocol { func close() { - if controlsManager?.guidesNavigationBarHidden == false { - controlsManager?.menuState = .inactive - } else { - controlsManager?.menuState = .hidden - } + delegate?.didFinish() +// if controlsManager?.guidesNavigationBarHidden == false { +// controlsManager?.menuState = .inactive +// } else { +// controlsManager?.menuState = .hidden +// } } func addPlace() { @@ -54,7 +55,7 @@ extension BottomMenuInteractor: BottomMenuInteractorProtocol { func downloadMaps() { Statistics.logEvent(kStatToolbarClick, withParameters: [kStatItem : kStatDownloadMaps]) close() - self.delegate?.actionDownloadMaps(.downloaded) + mapViewController?.openMapsDownloader(.downloaded) } func openSettings() { diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarBuilder.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarBuilder.swift index 39695b5aa70..6f5d9b95935 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarBuilder.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarBuilder.swift @@ -1,14 +1,6 @@ @objc class BottomTabBarBuilder: NSObject { @objc static func build(mapViewController: MapViewController, controlsManager: MWMMapViewControlsManager) -> BottomTabBarViewController { let viewController = BottomTabBarViewController(nibName: nil, bundle: nil) - let interactor = BottomTabBarInteractor(viewController: viewController, - mapViewController: mapViewController, - controlsManager: controlsManager) - let presenter = BottomTabBarPresenter(view: viewController, interactor: interactor) - - interactor.presenter = presenter - viewController.presenter = presenter - return viewController } } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift index e9ebc98531b..ced403b2258 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift @@ -16,7 +16,11 @@ class BottomTabBarInteractor { private var isPoint2PointSelected = false - + init(viewController: UIViewController, + mapViewController: MapViewController) { + self.viewController = viewController + self.mapViewController = mapViewController + } init(viewController: UIViewController, mapViewController: MapViewController, diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift index 254064878ce..4df3224661d 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift @@ -1,12 +1,21 @@ protocol BottomTabBarViewProtocol: class { - var presenter: BottomTabBarPresenterProtocol! { get set } +// var presenter: BottomTabBarPresenterProtocol! { get set } var isHidden: Bool { get } var isLayersBadgeHidden: Bool { get set } var isApplicationBadgeHidden: Bool { get set } } -class BottomTabBarViewController: UIViewController { - var presenter: BottomTabBarPresenterProtocol! +protocol BottomTabBarViewControllerDelegate: AnyObject { + func search() + func route() + func discovery() + func bookmarks() + func menu() +} + +final class BottomTabBarViewController: UIViewController { +// var presenter: BottomTabBarPresenterProtocol! + var delegate: BottomTabBarViewControllerDelegate? @IBOutlet var searchButton: MWMButton! @IBOutlet var routeButton: MWMButton! @@ -15,36 +24,40 @@ class BottomTabBarViewController: UIViewController { @IBOutlet var moreButton: MWMButton! @IBOutlet var downloadBadge: UIView! - private var avaliableArea = CGRect.zero - @objc var isHidden: Bool = false { - didSet { - updateFrame(animated: true) - } - } +// private var avaliableArea = CGRect.zero +// @objc var isHidden: Bool = false { +// didSet { +// updateFrame(animated: true) +// } +// } + var isLayersBadgeHidden: Bool = true { didSet { updateBadge() } } - @objc var isApplicationBadgeHidden: Bool = true { + + var isApplicationBadgeHidden: Bool = true { didSet { updateBadge() } } + var tabBarView: BottomTabBarView { return view as! BottomTabBarView } - @objc static var controller: BottomTabBarViewController? { - return MWMMapViewControlsManager.manager()?.tabBarController - } + +// @objc static var controller: BottomTabBarViewController? { +// return MWMMapViewControlsManager.manager()?.tabBarController +// } override func viewDidLoad() { super.viewDidLoad() - presenter.configure() +// presenter.configure() updateBadge() MWMSearchManager.add(self) - MWMNavigationDashboardManager.add(self) +// MWMNavigationDashboardManager.add(self) } override func viewDidAppear(_ animated: Bool) { @@ -53,80 +66,85 @@ class BottomTabBarViewController: UIViewController { deinit { MWMSearchManager.remove(self) - MWMNavigationDashboardManager.remove(self) +// MWMNavigationDashboardManager.remove(self) } - static func updateAvailableArea(_ frame: CGRect) { - BottomTabBarViewController.controller?.updateAvailableArea(frame) - } +// static func updateAvailableArea(_ frame: CGRect) { +// BottomTabBarViewController.controller?.updateAvailableArea(frame) +// } @IBAction func onSearchButtonPressed(_ sender: Any) { - presenter.onSearchButtonPressed() + delegate?.search() +// presenter.onSearchButtonPressed() } @IBAction func onPoint2PointButtonPressed(_ sender: Any) { - presenter.onPoint2PointButtonPressed() + delegate?.route() +// presenter.onPoint2PointButtonPressed() } @IBAction func onDiscoveryButtonPressed(_ sender: Any) { - presenter.onDiscoveryButtonPressed() + delegate?.discovery() +// presenter.onDiscoveryButtonPressed() } @IBAction func onBookmarksButtonPressed(_ sender: Any) { - presenter.onBookmarksButtonPressed() + delegate?.bookmarks() +// presenter.onBookmarksButtonPressed() } @IBAction func onMenuButtonPressed(_ sender: Any) { - presenter.onMenuButtonPressed() - } - - - private func updateAvailableArea(_ frame:CGRect) { - avaliableArea = frame - updateFrame(animated: false) - self.view.layoutIfNeeded() - } - - private func updateFrame(animated: Bool) { - if avaliableArea == .zero { - return - } - let newFrame = CGRect(x: avaliableArea.minX, - y: isHidden ? avaliableArea.minY + avaliableArea.height : avaliableArea.minY, - width: avaliableArea.width, - height: avaliableArea.height) - let alpha:CGFloat = isHidden ? 0 : 1 - if animated { - UIView.animate(withDuration: kDefaultAnimationDuration, - delay: 0, - options: [.beginFromCurrentState], - animations: { - self.view.frame = newFrame - self.view.alpha = alpha - }, completion: nil) - } else { - self.view.frame = newFrame - self.view.alpha = alpha - } - } + delegate?.menu() +// presenter.onMenuButtonPressed() + } + +// +// private func updateAvailableArea(_ frame:CGRect) { +// avaliableArea = frame +// updateFrame(animated: false) +// self.view.layoutIfNeeded() +// } +// +// private func updateFrame(animated: Bool) { +// if avaliableArea == .zero { +// return +// } +// let newFrame = CGRect(x: avaliableArea.minX, +// y: isHidden ? avaliableArea.minY + avaliableArea.height : avaliableArea.minY, +// width: avaliableArea.width, +// height: avaliableArea.height) +// let alpha:CGFloat = isHidden ? 0 : 1 +// if animated { +// UIView.animate(withDuration: kDefaultAnimationDuration, +// delay: 0, +// options: [.beginFromCurrentState], +// animations: { +// self.view.frame = newFrame +// self.view.alpha = alpha +// }, completion: nil) +// } else { +// self.view.frame = newFrame +// self.view.alpha = alpha +// } +// } private func updateBadge() { downloadBadge.isHidden = isApplicationBadgeHidden && isLayersBadgeHidden } } -extension BottomTabBarViewController: BottomTabBarViewProtocol { - -} - +//extension BottomTabBarViewController: BottomTabBarViewProtocol { +// +//} +// // MARK: - MWMNavigationDashboardObserver -extension BottomTabBarViewController: MWMNavigationDashboardObserver { - func onNavigationDashboardStateChanged() { - let state = MWMNavigationDashboardManager.shared().state - self.isHidden = state != .hidden; - } -} +//extension BottomTabBarViewController: MWMNavigationDashboardObserver { +// func onNavigationDashboardStateChanged() { +// let state = MWMNavigationDashboardManager.shared().state +// self.isHidden = state != .hidden; +// } +//} // MARK: - MWMSearchManagerObserver diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib index 4ea2ffbf010..0ef840c0754 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -20,17 +20,10 @@ - - + + - - - - - - - @@ -104,7 +97,6 @@ - @@ -130,12 +122,9 @@ + - - - - @@ -144,7 +133,6 @@ - diff --git a/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h b/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h deleted file mode 100644 index 73649714b7a..00000000000 --- a/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h +++ /dev/null @@ -1,58 +0,0 @@ -#import "CircleView.h" - -#include "kml/types.hpp" - -namespace ios_bookmark_ui_helper -{ -inline UIColor * UIColorForRGB(int red, int green, int blue) -{ - return [UIColor colorWithRed:red/255.f green:green/255.f blue:blue/255.f alpha:0.8]; -} - -inline UIColor * UIColorForBookmarkColor(kml::PredefinedColor color) -{ - switch (color) - { - case kml::PredefinedColor::Red: return UIColorForRGB(229, 27, 35); - case kml::PredefinedColor::Pink: return UIColorForRGB(255, 65, 130); - case kml::PredefinedColor::Purple: return UIColorForRGB(155, 36, 178); - case kml::PredefinedColor::DeepPurple: return UIColorForRGB(102, 57, 191); - case kml::PredefinedColor::Blue: return UIColorForRGB(0, 102, 204); - case kml::PredefinedColor::LightBlue: return UIColorForRGB(36, 156, 242); - case kml::PredefinedColor::Cyan: return UIColorForRGB(20, 190, 205); - case kml::PredefinedColor::Teal: return UIColorForRGB(0, 165, 140); - case kml::PredefinedColor::Green: return UIColorForRGB(60, 140, 60); - case kml::PredefinedColor::Lime: return UIColorForRGB(147, 191, 57); - case kml::PredefinedColor::Yellow: return UIColorForRGB(255, 200, 0); - case kml::PredefinedColor::Orange: return UIColorForRGB(255, 150, 0); - case kml::PredefinedColor::DeepOrange: return UIColorForRGB(240, 100, 50); - case kml::PredefinedColor::Brown: return UIColorForRGB(128, 70, 51); - case kml::PredefinedColor::Gray: return UIColorForRGB(115, 115, 115); - case kml::PredefinedColor::BlueGray: return UIColorForRGB(89, 115, 128); - case kml::PredefinedColor::None: - case kml::PredefinedColor::Count: return UIColorForBookmarkColor(kml::PredefinedColor::Red); - } -} - -inline UIImage * ImageForBookmark(kml::PredefinedColor color, kml::BookmarkIcon icon) -{ - CGFloat const kPinDiameter = 22; - - NSString *imageName = [NSString stringWithFormat:@"%@%@", @"ic_bm_", [@(kml::ToString(icon).c_str()) lowercaseString]]; - - return [CircleView createCircleImageWithDiameter:kPinDiameter - andColor:UIColorForBookmarkColor(color) - andImageName:imageName]; -} - -inline UIImage * ImageForTrack(float red, float green, float blue) -{ - CGFloat const kPinDiameter = 22; - return [CircleView createCircleImageWithDiameter:kPinDiameter - andColor:[UIColor colorWithRed:red - green:green - blue:blue - alpha:1.f]]; -} -} // namespace ios_bookmark_ui_helper - diff --git a/iphone/Maps/UI/PlacePage/Components/GuidesGallery/GuidesGalleryViewController.swift b/iphone/Maps/UI/PlacePage/Components/GuidesGallery/GuidesGalleryViewController.swift index 57217d40fec..ec5b53357ef 100644 --- a/iphone/Maps/UI/PlacePage/Components/GuidesGallery/GuidesGalleryViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/GuidesGallery/GuidesGalleryViewController.swift @@ -142,3 +142,9 @@ fileprivate final class RoutesGalleryLayout: UICollectionViewFlowLayout { return CGPoint(x: adjustedIndex * pageWidth, y: 0) } } + +extension GuidesGalleryViewController: MapOverlayViewProtocol { + var bottomView: UIView { + view + } +} diff --git a/iphone/Maps/UI/PlacePage/PlacePageBuilder.swift b/iphone/Maps/UI/PlacePage/PlacePageBuilder.swift index d8fbf84e8ce..4d92e989ba6 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageBuilder.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageBuilder.swift @@ -1,5 +1,5 @@ @objc class PlacePageBuilder: NSObject { - @objc static func build() -> UIViewController { + @objc static func build() -> PlacePageViewController { let storyboard = UIStoryboard.instance(.placePage) guard let viewController = storyboard.instantiateInitialViewController() as? PlacePageViewController else { fatalError() diff --git a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift index df9c53cc2a8..1c3f07e7af1 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift @@ -345,3 +345,9 @@ extension PlacePageViewController: UIScrollViewDelegate { } } } + +extension PlacePageViewController: MapOverlayViewProtocol { + var bottomView: UIView { + stackView + } +} diff --git a/iphone/Maps/UI/Storyboard/Main.storyboard b/iphone/Maps/UI/Storyboard/Main.storyboard index 54701f2fc76..84433e9755a 100644 --- a/iphone/Maps/UI/Storyboard/Main.storyboard +++ b/iphone/Maps/UI/Storyboard/Main.storyboard @@ -1,10 +1,11 @@ - + + @@ -13,29 +14,29 @@ - + - + - - + - + @@ -155,7 +156,7 @@ - + @@ -320,7 +321,233 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -337,14 +564,14 @@ - + - + @@ -364,7 +591,7 @@ - + @@ -380,7 +607,7 @@ - + @@ -406,11 +633,11 @@ - + - + @@ -421,10 +648,10 @@ - + - + @@ -441,7 +668,7 @@ - + @@ -450,7 +677,7 @@ - + @@ -459,7 +686,7 @@ - + @@ -468,7 +695,7 @@ - + @@ -477,10 +704,10 @@ - + - + - + @@ -503,7 +730,7 @@ - + @@ -512,7 +739,7 @@ - + @@ -609,7 +836,7 @@ - + @@ -677,26 +904,26 @@ - + - + - + - + @@ -766,7 +993,7 @@ - + @@ -811,11 +1038,11 @@ - + - + @@ -826,7 +1053,7 @@ - + @@ -837,7 +1064,7 @@ - + @@ -881,11 +1108,11 @@ - + - + @@ -897,7 +1124,7 @@ - + @@ -908,7 +1135,7 @@ - + @@ -918,13 +1145,13 @@ - + @@ -971,27 +1198,27 @@ - + - + - + - + - + - + @@ -999,7 +1226,7 @@