[iOS] add routes downloaded popup

This commit is contained in:
Aleksey Belouosv 2018-08-01 18:03:59 +03:00 committed by Aleksey Belousov
parent 0e5d915879
commit ded49f413f
39 changed files with 447 additions and 160 deletions

View file

@ -0,0 +1,23 @@
class BookmarksLoadedViewController: UIViewController {
private let transitioning = AlertTransitioning()
@objc var onViewBlock: MWMVoidBlock?
@objc var onCancelBlock: MWMVoidBlock?
@IBAction func onViewMap(_ sender: UIButton) {
onViewBlock?()
}
@IBAction func onNotNow(_ sender: UIButton) {
onCancelBlock?()
}
override var transitioningDelegate: UIViewControllerTransitioningDelegate? {
get { return transitioning }
set { }
}
override var modalPresentationStyle: UIModalPresentationStyle {
get { return .custom }
set { }
}
}

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BookmarksLoadedViewController" customModule="maps_me" customModuleProvider="target">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="260" height="260"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="05b-mP-kFB">
<rect key="frame" x="28" y="28" width="204" height="43"/>
<string key="text">Bookmarks were
succesfully downloaded</string>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" white="0.0" alpha="0.86124785958904104" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmarks_downloaded_title"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium18"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="749" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2MR-ae-0PS">
<rect key="frame" x="28" y="79" width="204" height="51"/>
<string key="text">Press View on map to explore
new places from the list</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.0" alpha="0.54045376712328763" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="bookmarks_downloaded_subtitle"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rBj-dl-R2V">
<rect key="frame" x="35" y="154" width="190" height="45"/>
<color key="backgroundColor" red="0.11767578125" green="0.58980089430000004" blue="0.94108072916666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="EAx-L2-t3K"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="View on map"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="search_show_on_map"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium16"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundHighlightedColorName" value="linkBlueHighlighted"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="onViewMap:" destination="-1" eventType="touchUpInside" id="XDB-72-rMm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="azM-lz-wDm">
<rect key="frame" x="35" y="207" width="190" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="LMT-F8-gcD"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="Not now">
<color key="titleColor" white="0.0" alpha="0.37976241438356162" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium16"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="not_now"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="blackHintText"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="onNotNow:" destination="-1" eventType="touchUpInside" id="YAU-5T-vzd"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="rBj-dl-R2V" secondAttribute="trailing" constant="35" id="08C-xb-KOi"/>
<constraint firstItem="rBj-dl-R2V" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="35" id="31r-32-KLm"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="azM-lz-wDm" secondAttribute="trailing" constant="35" id="86N-0a-3m4"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="2MR-ae-0PS" secondAttribute="trailing" constant="28" id="AqE-HU-M7I"/>
<constraint firstItem="05b-mP-kFB" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="28" id="MPt-49-wRT"/>
<constraint firstItem="2MR-ae-0PS" firstAttribute="top" secondItem="05b-mP-kFB" secondAttribute="bottom" constant="8" id="P0v-Ra-Imd"/>
<constraint firstItem="rBj-dl-R2V" firstAttribute="top" secondItem="2MR-ae-0PS" secondAttribute="bottom" constant="24" id="Rp4-4q-aUZ"/>
<constraint firstItem="2MR-ae-0PS" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="28" id="d8E-z5-Lrq"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="azM-lz-wDm" secondAttribute="bottom" constant="8" id="gcg-uo-A1D"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="05b-mP-kFB" secondAttribute="trailing" constant="28" id="iPe-VG-L5O"/>
<constraint firstItem="azM-lz-wDm" firstAttribute="top" secondItem="rBj-dl-R2V" secondAttribute="bottom" constant="8" id="laD-0o-w4h"/>
<constraint firstItem="05b-mP-kFB" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="28" id="mWe-UG-NkH"/>
<constraint firstItem="azM-lz-wDm" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="35" id="uOR-0e-lei"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="-24" y="148"/>
</view>
</objects>
</document>

View file

@ -138,7 +138,7 @@ final class CatalogWebViewController: WebViewController {
MWMBookmarksManager.downloadItem(withId: id, name: name, progress: { [weak self] (progress) in
self?.updateProgress()
}) { [weak self] (error) in
}) { [weak self] (categoryId, error) in
if let error = error as NSError? {
if error.code == kCategoryDownloadFailedCode {
guard let statusCode = error.userInfo[kCategoryDownloadStatusKey] as? NSNumber else {
@ -166,7 +166,9 @@ final class CatalogWebViewController: WebViewController {
self?.showImportError()
}
} else {
Toast.toast(withText: L("bookmarks_webview_success_toast")).show()
if MWMBookmarksManager.getCatalogDownloadsCount() == 0 {
MapViewController.shared().showBookmarksLoadedAlert(categoryId)
}
}
self?.updateProgress()
}

View file

@ -15,7 +15,7 @@
- (void)mwm_refreshUI
{
[self.navigationController.navigationBar mwm_refreshUI];
MapViewController * mapViewController = [MapViewController controller];
MapViewController * mapViewController = [MapViewController sharedController];
for (UIViewController * vc in self.navigationController.viewControllers.reverseObjectEnumerator)
{
if (![vc isEqual:mapViewController])

View file

@ -22,7 +22,7 @@
- (void)mwm_refreshUI
{
[self.navigationController.navigationBar mwm_refreshUI];
MapViewController * mapViewController = [MapViewController controller];
MapViewController * mapViewController = [MapViewController sharedController];
for (UIViewController * vc in self.navigationController.viewControllers.reverseObjectEnumerator)
{
if (![vc isEqual:mapViewController])

View file

@ -34,7 +34,7 @@
[self.navigationController.navigationBar mwm_refreshUI];
[self.view mwm_refreshUI];
if (![self isKindOfClass:[MapViewController class]])
[[MapViewController controller] mwm_refreshUI];
[[MapViewController sharedController] mwm_refreshUI];
}
- (void)viewDidLoad

View file

@ -0,0 +1,16 @@
final class AlertDismissalAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let fromVC = transitionContext.viewController(forKey: .from) else { return }
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
fromVC.view.alpha = 0
}) { finished in
fromVC.view.removeFromSuperview()
transitionContext.completeTransition(finished)
}
}
}

View file

@ -0,0 +1,22 @@
final class AlertPresentationAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let toVC = transitionContext.viewController(forKey: .to) else { return }
let containerView = transitionContext.containerView
let finalFrame = transitionContext.finalFrame(for: toVC)
containerView.addSubview(toVC.view)
toVC.view.alpha = 0
toVC.view.center = containerView.center
toVC.view.frame = finalFrame
toVC.view.autoresizingMask = [.flexibleLeftMargin, .flexibleTopMargin, .flexibleRightMargin, .flexibleBottomMargin]
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
toVC.view.alpha = 1
}) { transitionContext.completeTransition($0) }
}
}

View file

@ -0,0 +1,14 @@
final class AlertPresentationController: DimmedModalPresentationController {
override var frameOfPresentedViewInContainerView: CGRect {
let f = super.frameOfPresentedViewInContainerView
let s = presentedViewController.view.systemLayoutSizeFitting(UILayoutFittingCompressedSize)
let r = CGRect(x: 0, y: 0, width: s.width, height: s.height)
return r.offsetBy(dx: (f.width - r.width) / 2, dy: (f.height - r.height) / 2)
}
override func presentationTransitionWillBegin() {
super.presentationTransitionWillBegin()
presentedViewController.view.layer.cornerRadius = 12
presentedViewController.view.clipsToBounds = true
}
}

View file

@ -0,0 +1,17 @@
class AlertTransitioning: NSObject, UIViewControllerTransitioningDelegate {
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return AlertPresentationAnimator()
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return AlertDismissalAnimator()
}
func presentationController(forPresented presented: UIViewController,
presenting: UIViewController?,
source: UIViewController) -> UIPresentationController? {
return AlertPresentationController(presentedViewController: presented, presenting: presenting)
}
}

View file

@ -0,0 +1,21 @@
final class CoverVerticalDismissalAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let fromVC = transitionContext.viewController(forKey: .from),
let toVC = transitionContext.viewController(forKey: .to)
else { return }
let originFrame = transitionContext.finalFrame(for: toVC)
let finalFrame = originFrame.offsetBy(dx: 0, dy: originFrame.height)
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
fromVC.view.frame = finalFrame
}) { finished in
fromVC.view.removeFromSuperview()
transitionContext.completeTransition(finished)
}
}
}

View file

@ -0,0 +1,35 @@
final class CoverVerticalModalTransitioning: NSObject, UIViewControllerTransitioningDelegate {
private var height: CGFloat
init(presentationHeight: CGFloat) {
height = presentationHeight
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return CoverVerticalPresentationAnimator()
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return CoverVerticalDismissalAnimator()
}
func presentationController(forPresented presented: UIViewController,
presenting: UIViewController?,
source: UIViewController) -> UIPresentationController? {
return PresentationController(presentedViewController: presented, presenting: presenting, presentationHeight: height)
}
}
fileprivate final class PresentationController: DimmedModalPresentationController {
private var height: CGFloat
init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?, presentationHeight: CGFloat) {
height = presentationHeight
super.init(presentedViewController: presentedViewController, presenting: presentingViewController)
}
override var frameOfPresentedViewInContainerView: CGRect {
let f = super.frameOfPresentedViewInContainerView
return CGRect(x: 0, y: f.height - height, width: f.width, height: height)
}
}

View file

@ -0,0 +1,21 @@
final class CoverVerticalPresentationAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let toVC = transitionContext.viewController(forKey: .to) else { return }
let containerView = transitionContext.containerView
let finalFrame = transitionContext.finalFrame(for: toVC)
let originFrame = finalFrame.offsetBy(dx: 0, dy: finalFrame.height)
containerView.addSubview(toVC.view)
toVC.view.frame = originFrame
toVC.view.autoresizingMask = [.flexibleWidth, .flexibleTopMargin]
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
toVC.view.frame = finalFrame
}) { transitionContext.completeTransition($0) }
}
}

View file

@ -0,0 +1,41 @@
class DimmedModalPresentationController: UIPresentationController {
private lazy var onTapGr: UITapGestureRecognizer = {
return UITapGestureRecognizer(target: self, action: #selector(onTap))
}()
private lazy var dimView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.blackStatusBarBackground()
view.addGestureRecognizer(onTapGr)
return view
}()
@objc private func onTap() {
presentingViewController.dismiss(animated: true, completion: nil)
}
override func presentationTransitionWillBegin() {
guard let containerView = containerView else { return }
containerView.addSubview(dimView)
dimView.frame = containerView.bounds
dimView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
dimView.alpha = 0
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
self.dimView.alpha = 1
})
}
override func presentationTransitionDidEnd(_ completed: Bool) {
if !completed { dimView.removeFromSuperview() }
}
override func dismissalTransitionWillBegin() {
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
self.dimView.alpha = 0
})
}
override func dismissalTransitionDidEnd(_ completed: Bool) {
if completed { dimView.removeFromSuperview() }
}
}

View file

@ -53,7 +53,7 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
- (void)presentRateAlert { [self displayAlert:[MWMAlert rateAlert]]; }
- (void)presentLocationAlert
{
if (![MapViewController controller].welcomePageController)
if (![MapViewController sharedController].welcomePageController)
[self displayAlert:[MWMAlert locationAlert]];
}
- (void)presentPoint2PointAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock

View file

@ -1,4 +1,5 @@
final class LayersViewController: MWMViewController {
private let transitioning = CoverVerticalModalTransitioning(presentationHeight: 150)
@IBOutlet weak var trafficButton: VerticallyAlignedButton! {
didSet {
@ -21,7 +22,12 @@ final class LayersViewController: MWMViewController {
}
override var transitioningDelegate: UIViewControllerTransitioningDelegate? {
get { return ModalTransitioning() }
get { return transitioning }
set { }
}
override var modalPresentationStyle: UIModalPresentationStyle {
get { return .custom }
set { }
}

View file

@ -1,111 +0,0 @@
final class ModalTransitioning: NSObject, UIViewControllerTransitioningDelegate {
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return PresentationAnimator()
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return DismissalAnimator()
}
func presentationController(forPresented presented: UIViewController,
presenting: UIViewController?,
source: UIViewController) -> UIPresentationController? {
return PresentationController(presentedViewController: presented, presenting: presenting)
}
}
fileprivate final class PresentationController: UIPresentationController {
private lazy var onTapGr: UITapGestureRecognizer = {
return UITapGestureRecognizer(target: self, action: #selector(onTap))
}()
private lazy var dimView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.blackStatusBarBackground()
view.addGestureRecognizer(onTapGr)
return view
}()
@objc private func onTap() {
presentingViewController.dismiss(animated: true, completion: nil)
}
override var frameOfPresentedViewInContainerView: CGRect {
let f = super.frameOfPresentedViewInContainerView
let h: CGFloat = 150;
return CGRect(x: 0, y: f.height - h, width: f.width, height: h)
}
override func presentationTransitionWillBegin() {
guard let containerView = containerView else { return }
containerView.addSubview(dimView)
dimView.frame = containerView.bounds
dimView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
dimView.alpha = 0
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
self.dimView.alpha = 1
})
}
override func presentationTransitionDidEnd(_ completed: Bool) {
if !completed {
dimView.removeFromSuperview()
}
}
override func dismissalTransitionWillBegin() {
presentingViewController.transitionCoordinator?.animate(alongsideTransition: { _ in
self.dimView.alpha = 0
})
}
override func dismissalTransitionDidEnd(_ completed: Bool) {
if completed { dimView.removeFromSuperview() }
}
}
fileprivate final class PresentationAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let toVC = transitionContext.viewController(forKey: .to) else { return }
let containerView = transitionContext.containerView
let finalFrame = transitionContext.finalFrame(for: toVC)
let originFrame = finalFrame.offsetBy(dx: 0, dy: finalFrame.height)
containerView.addSubview(toVC.view)
toVC.view.frame = originFrame
toVC.view.autoresizingMask = [.flexibleWidth, .flexibleTopMargin]
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
toVC.view.frame = finalFrame
}) { transitionContext.completeTransition($0) }
}
}
fileprivate final class DismissalAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return kDefaultAnimationDuration
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let fromVC = transitionContext.viewController(forKey: .from),
let toVC = transitionContext.viewController(forKey: .to)
else { return }
let originFrame = transitionContext.finalFrame(for: toVC)
let finalFrame = originFrame.offsetBy(dx: 0, dy: originFrame.height)
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: {
fromVC.view.frame = finalFrame
}) { finished in
fromVC.view.removeFromSuperview()
transitionContext.completeTransition(finished)
}
}
}

View file

@ -45,7 +45,7 @@ extern NSString * const kAlohalyticsTapEventKey;
@implementation MWMMapViewControlsManager
+ (MWMMapViewControlsManager *)manager { return [MapViewController controller].controlsManager; }
+ (MWMMapViewControlsManager *)manager { return [MapViewController sharedController].controlsManager; }
- (instancetype)initWithParentController:(MapViewController *)controller
{
if (!controller)

View file

@ -52,7 +52,7 @@ NSArray<UIImage *> * imagesWithName(NSString * name)
self = [super init];
if (self)
{
MapViewController * ovc = [MapViewController controller];
MapViewController * ovc = [MapViewController sharedController];
[ovc addChildViewController:self];
[ovc.view addSubview:self.view];
[self configLayout];
@ -161,8 +161,7 @@ NSArray<UIImage *> * imagesWithName(NSString * name)
else
{
auto layersVC = [[LayersViewController alloc] init];
layersVC.modalPresentationStyle = UIModalPresentationCustom;
[[MapViewController controller] presentViewController:layersVC animated:YES completion:nil];
[[MapViewController sharedController] presentViewController:layersVC animated:YES completion:nil];
}
}

View file

@ -193,7 +193,7 @@ using Observers = NSHashTable<Observer>;
return;
if (!Platform::IsConnected())
{
[[MapViewController controller].alertController presentNoConnectionAlert];
[[MapViewController sharedController].alertController presentNoConnectionAlert];
[self onRouteError:L(@"dialog_taxi_offline")];
return;
}
@ -267,7 +267,7 @@ using Observers = NSHashTable<Observer>;
self.routeManagerTransitioningManager = [[MWMRouteManagerTransitioningManager alloc] init];
}
routeManager.transitioningDelegate = self.routeManagerTransitioningManager;
[[MapViewController controller] presentViewController:routeManager animated:YES completion:nil];
[[MapViewController sharedController] presentViewController:routeManager animated:YES completion:nil];
}
#pragma mark - MWMNavigationControlView
@ -290,7 +290,7 @@ using Observers = NSHashTable<Observer>;
{
[Statistics logEvent:kStatMenu withParameters:@{kStatButton : kStatSettings}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsAndMore"];
[[MapViewController controller] performSegueWithIdentifier:@"Map2Settings" sender:nil];
[[MapViewController sharedController] performSegueWithIdentifier:@"Map2Settings" sender:nil];
}
- (IBAction)stopRoutingButtonAction
@ -383,7 +383,7 @@ using Observers = NSHashTable<Observer>;
case MWMNavigationDashboardStateNavigation: [self stateNavigation]; break;
}
_state = state;
[[MapViewController controller] updateStatusBarStyle];
[[MapViewController sharedController] updateStatusBarStyle];
[self onNavigationDashboardStateChanged];
}

View file

@ -47,7 +47,7 @@ map<NavigationSearchState, NSString *> const kSearchButtonRequest{
BOOL defaultOrientation(CGSize const & size)
{
CGSize const & mapViewSize = [MapViewController controller].view.frame.size;
CGSize const & mapViewSize = [MapViewController sharedController].view.frame.size;
CGFloat const minWidth = MIN(mapViewSize.width, mapViewSize.height);
return IPAD || (size.height > size.width && size.width >= minWidth);
}
@ -235,7 +235,7 @@ BOOL defaultOrientation(CGSize const & size)
withParameters:@{
kStatMode: (isOnRoute ? kStatRoutingModeOnRoute : kStatRoutingModePlanning)
}];
[[MapViewController controller] openBookmarks];
[[MapViewController sharedController] openBookmarks];
}
- (void)collapseSearchOnTimer

View file

@ -8,7 +8,7 @@
@interface MapViewController : MWMViewController
+ (MapViewController *)controller;
+ (MapViewController *)sharedController;
// called when app is terminated by system
- (void)onTerminate;
@ -25,6 +25,7 @@
- (void)openHotelFacilities;
- (void)openBookmarkEditorWithData:(MWMPlacePageData *)data;
- (void)showUGCAuth;
- (void)showBookmarksLoadedAlert:(UInt64)categoryId;
- (void)setPlacePageTopBound:(CGFloat)bound;

View file

@ -100,7 +100,7 @@ BOOL gIsFirstMyPositionMode = YES;
@implementation MapViewController
+ (MapViewController *)controller { return [MapsAppDelegate theApp].mapViewController; }
+ (MapViewController *)sharedController { return [MapsAppDelegate theApp].mapViewController; }
#pragma mark - Map Navigation
- (void)dismissPlacePage { [self.controlsManager dismissPlacePage]; }
@ -421,6 +421,29 @@ BOOL gIsFirstMyPositionMode = YES;
[self presentViewController:controller animated:YES completion:nil];
}
- (void)showBookmarksLoadedAlert:(UInt64)categoryId
{
for (UIViewController * vc in self.navigationController.viewControllers)
{
if ([vc isMemberOfClass:MWMBookmarksTabViewController.class])
{
auto alert = [[BookmarksLoadedViewController alloc] init];
alert.onViewBlock = ^{
[self dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popToRootViewControllerAnimated:YES];
GetFramework().ShowBookmarkCategory(categoryId);
};
alert.onCancelBlock = ^{
[self dismissViewControllerAnimated:YES completion:nil];
};
[self presentViewController:alert animated:YES completion:nil];
return;
}
}
if (![MWMRouter isOnRoute])
[[MWMToast toastWithText:L(@"bookmarks_webview_success_toast")] show];
}
- (void)processMyPositionStateModeEvent:(MWMMyPositionMode)mode
{
[MWMLocationManager setMyPositionMode:mode];

View file

@ -416,7 +416,7 @@ using namespace osm_auth_ios;
performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
auto onTap = ^{
MapViewController * mapViewController = [MapViewController controller];
MapViewController * mapViewController = [MapViewController sharedController];
[mapViewController.navigationController popToRootViewControllerAnimated:NO];
[mapViewController showUGCAuth];
};

View file

@ -16,7 +16,7 @@
+ (MWMMapWidgets *)widgetsManager
{
return ((EAGLView *)[MapViewController controller].view).widgetsManager;
return ((EAGLView *)[MapViewController sharedController].view).widgetsManager;
}
- (void)setupWidgets:(Framework::DrapeCreationParams &)p
@ -46,8 +46,8 @@
return;
gui::TWidgetsLayoutInfo layout;
auto const vs = self.visualScale;
auto const viewHeight = [MapViewController controller].view.height;
auto const viewWidth = [MapViewController controller].view.width;
auto const viewHeight = [MapViewController sharedController].view.height;
auto const viewWidth = [MapViewController sharedController].view.width;
auto const rulerOffset =
m2::PointF(frame.origin.x * vs, (frame.origin.y + frame.size.height - viewHeight) * vs);
auto const compassOffset =

View file

@ -495,7 +495,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
auto observer = [MWMBookmarksManager manager].catalogObservers[@(serverCatId.c_str())];
if (observer)
{
[observer onImportCompleteSuccessful:successful];
[observer onImportCompleteSuccessful:successful forCategoryId:categoryId];
[[MWMBookmarksManager manager].catalogObservers removeObjectForKey:observer.categoryId];
}
};

View file

@ -22,5 +22,5 @@ static NSInteger const kCategoryImportFailedCode = -11;
static NSString * const kCategoryDownloadStatusKey = @"kCategoryDownloadStatusKey";
typedef void (^ProgressBlock)(MWMCategoryProgress progress);
typedef void (^CompletionBlock)(NSError * error);
typedef void (^CompletionBlock)(UInt64 categoryId, NSError * error);

View file

@ -11,6 +11,6 @@
- (void)onDownloadStart;
- (void)onDownloadComplete:(platform::RemoteFile::Status)status;
- (void)onImportStart;
- (void)onImportCompleteSuccessful:(BOOL)success;
- (void)onImportCompleteSuccessful:(BOOL)success forCategoryId:(UInt64)categoryId;
@end

View file

@ -31,9 +31,9 @@
break;
}
if (self.completionBlock)
self.completionBlock([[NSError alloc] initWithDomain:kCatalogErrorDomain
code:kCategoryDownloadFailedCode
userInfo:@{kCategoryDownloadStatusKey : @(downloadStatus)}]);
self.completionBlock(0, [[NSError alloc] initWithDomain:kCatalogErrorDomain
code:kCategoryDownloadFailedCode
userInfo:@{kCategoryDownloadStatusKey : @(downloadStatus)}]);
}
- (void)onImportStart
@ -42,13 +42,13 @@
self.progressBlock(MWMCategoryProgressImportStarted);
}
- (void)onImportCompleteSuccessful:(BOOL)success
- (void)onImportCompleteSuccessful:(BOOL)success forCategoryId:(UInt64)categoryId
{
if (self.completionBlock) {
NSError * error = success ? nil : [[NSError alloc] initWithDomain:kCatalogErrorDomain
code:kCategoryImportFailedCode
userInfo:nil];
self.completionBlock(error);
self.completionBlock(categoryId, error);
}
}

View file

@ -20,7 +20,7 @@
+ (void)setVisibleViewport:(CGRect)rect
{
CGFloat const scale = [MapViewController controller].view.contentScaleFactor;
CGFloat const scale = [MapViewController sharedController].view.contentScaleFactor;
CGFloat const x0 = rect.origin.x * scale;
CGFloat const y0 = rect.origin.y * scale;
CGFloat const x1 = x0 + rect.size.width * scale;

View file

@ -92,7 +92,7 @@ using namespace storage;
if ([userInfo[kDownloadMapActionKey] isEqualToString:kDownloadMapActionName])
{
[Statistics logEvent:@"'Download Map' Notification Clicked"];
MapViewController * mapViewController = [MapViewController controller];
MapViewController * mapViewController = [MapViewController sharedController];
[mapViewController.navigationController popToRootViewControllerAnimated:NO];
NSString * notificationCountryId = userInfo[kDownloadMapCountryId];

View file

@ -697,7 +697,7 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType)
[activeAlertController presentRoutingMigrationAlertWithOkBlock:^{
[Statistics logEvent:kStatDownloaderMigrationDialogue
withParameters:@{kStatFrom : kStatRouting}];
[[MapViewController controller] openMigration];
[[MapViewController sharedController] openMigration];
}];
}
else if (!countries.empty())

View file

@ -352,7 +352,16 @@
4788738F20EE30B300F6826B /* LayersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4788738D20EE30B300F6826B /* LayersViewController.swift */; };
4788739020EE30B300F6826B /* LayersViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4788738E20EE30B300F6826B /* LayersViewController.xib */; };
4788739220EE326500F6826B /* VerticallyAlignedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4788739120EE326400F6826B /* VerticallyAlignedButton.swift */; };
4788739420EE350E00F6826B /* ModalTransitioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4788739320EE350E00F6826B /* ModalTransitioning.swift */; };
47E3C72121108E9F008B3B27 /* BookmarksLoadedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C71F21108E9F008B3B27 /* BookmarksLoadedViewController.swift */; };
47E3C72221108E9F008B3B27 /* BookmarksLoadedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 47E3C72021108E9F008B3B27 /* BookmarksLoadedViewController.xib */; };
47E3C7252111E41B008B3B27 /* DimmedModalPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7242111E41B008B3B27 /* DimmedModalPresentationController.swift */; };
47E3C7272111E5A8008B3B27 /* AlertPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7262111E5A8008B3B27 /* AlertPresentationController.swift */; };
47E3C7292111E614008B3B27 /* AlertPresentationAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7282111E614008B3B27 /* AlertPresentationAnimator.swift */; };
47E3C72B2111E62A008B3B27 /* AlertDismissalAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C72A2111E62A008B3B27 /* AlertDismissalAnimator.swift */; };
47E3C72D2111E6A2008B3B27 /* AlertTransitioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C72C2111E6A2008B3B27 /* AlertTransitioning.swift */; };
47E3C72F2111F472008B3B27 /* CoverVerticalModalTransitioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C72E2111F472008B3B27 /* CoverVerticalModalTransitioning.swift */; };
47E3C7312111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7302111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift */; };
47E3C7332111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E3C7322111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift */; };
47F86CFF20C936FC00FEE291 /* TabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47F86CFE20C936FC00FEE291 /* TabView.swift */; };
47F86D0120C93D8D00FEE291 /* TabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47F86D0020C93D8D00FEE291 /* TabViewController.swift */; };
4A300ED51C6DCFD400140018 /* countries-strings in Resources */ = {isa = PBXBuildFile; fileRef = 4A300ED31C6DCFD400140018 /* countries-strings */; };
@ -1304,7 +1313,16 @@
4788738D20EE30B300F6826B /* LayersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayersViewController.swift; sourceTree = "<group>"; };
4788738E20EE30B300F6826B /* LayersViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LayersViewController.xib; sourceTree = "<group>"; };
4788739120EE326400F6826B /* VerticallyAlignedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticallyAlignedButton.swift; sourceTree = "<group>"; };
4788739320EE350E00F6826B /* ModalTransitioning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalTransitioning.swift; sourceTree = "<group>"; };
47E3C71F21108E9F008B3B27 /* BookmarksLoadedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksLoadedViewController.swift; sourceTree = "<group>"; };
47E3C72021108E9F008B3B27 /* BookmarksLoadedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksLoadedViewController.xib; sourceTree = "<group>"; };
47E3C7242111E41B008B3B27 /* DimmedModalPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DimmedModalPresentationController.swift; sourceTree = "<group>"; };
47E3C7262111E5A8008B3B27 /* AlertPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertPresentationController.swift; sourceTree = "<group>"; };
47E3C7282111E614008B3B27 /* AlertPresentationAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertPresentationAnimator.swift; sourceTree = "<group>"; };
47E3C72A2111E62A008B3B27 /* AlertDismissalAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDismissalAnimator.swift; sourceTree = "<group>"; };
47E3C72C2111E6A2008B3B27 /* AlertTransitioning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertTransitioning.swift; sourceTree = "<group>"; };
47E3C72E2111F472008B3B27 /* CoverVerticalModalTransitioning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverVerticalModalTransitioning.swift; sourceTree = "<group>"; };
47E3C7302111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverVerticalPresentationAnimator.swift; sourceTree = "<group>"; };
47E3C7322111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverVerticalDismissalAnimator.swift; sourceTree = "<group>"; };
47F86CFE20C936FC00FEE291 /* TabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabView.swift; sourceTree = "<group>"; };
47F86D0020C93D8D00FEE291 /* TabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabViewController.swift; sourceTree = "<group>"; };
4A00DBDE1AB704C400113624 /* drules_proto_dark.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = drules_proto_dark.bin; path = ../../data/drules_proto_dark.bin; sourceTree = "<group>"; };
@ -2586,6 +2604,7 @@
346EDAD81B9F0E15004F8DB5 /* Components */ = {
isa = PBXGroup;
children = (
47E3C7232111E2F8008B3B27 /* Modal */,
47F86CFD20C936B300FEE291 /* TabView */,
F653CE131C71F5DC00A453F1 /* AddPlace NavigationBar */,
3470402E1EA6470700038379 /* BorderedButton.swift */,
@ -3110,11 +3129,25 @@
children = (
4788738D20EE30B300F6826B /* LayersViewController.swift */,
4788738E20EE30B300F6826B /* LayersViewController.xib */,
4788739320EE350E00F6826B /* ModalTransitioning.swift */,
);
path = Layers;
sourceTree = "<group>";
};
47E3C7232111E2F8008B3B27 /* Modal */ = {
isa = PBXGroup;
children = (
47E3C7242111E41B008B3B27 /* DimmedModalPresentationController.swift */,
47E3C7262111E5A8008B3B27 /* AlertPresentationController.swift */,
47E3C7282111E614008B3B27 /* AlertPresentationAnimator.swift */,
47E3C72A2111E62A008B3B27 /* AlertDismissalAnimator.swift */,
47E3C72C2111E6A2008B3B27 /* AlertTransitioning.swift */,
47E3C72E2111F472008B3B27 /* CoverVerticalModalTransitioning.swift */,
47E3C7302111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift */,
47E3C7322111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift */,
);
path = Modal;
sourceTree = "<group>";
};
47F86CFD20C936B300FEE291 /* TabView */ = {
isa = PBXGroup;
children = (
@ -3152,6 +3185,8 @@
B366130620D5DD2300E7DC3E /* MWMCatalogCategory+Convenience.mm */,
B366130820D5E2E000E7DC3E /* CatalogCategoryCell.swift */,
B366130920D5E2E000E7DC3E /* CatalogCategoryCell.xib */,
47E3C71F21108E9F008B3B27 /* BookmarksLoadedViewController.swift */,
47E3C72021108E9F008B3B27 /* BookmarksLoadedViewController.xib */,
);
path = Catalog;
sourceTree = "<group>";
@ -4355,6 +4390,7 @@
F6E2FE851E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */,
F6E2FE941E097BA00083EBEC /* PlacePageTaxiCell.xib in Resources */,
F6E2FEA61E097BA00083EBEC /* MWMPPView.xib in Resources */,
47E3C72221108E9F008B3B27 /* BookmarksLoadedViewController.xib in Resources */,
6741A9811BF340DE002C974C /* MWMRateAlert.xib in Resources */,
6741A9601BF340DE002C974C /* MWMRoutingDisclaimerAlert.xib in Resources */,
B3E3B4FD20D463B700DA8C13 /* BMCCategoriesHeader.xib in Resources */,
@ -4584,8 +4620,10 @@
F6E2FEE51E097BA00083EBEC /* MWMSearchNoResults.mm in Sources */,
F6E2FF631E097BA00083EBEC /* MWMTTSLanguageViewController.mm in Sources */,
342EE4121C43DAA7009F6A49 /* MWMAuthorizationWebViewLoginViewController.mm in Sources */,
47E3C7292111E614008B3B27 /* AlertPresentationAnimator.swift in Sources */,
34AB667D1FC5AA330078E451 /* MWMRoutePreview.mm in Sources */,
B33D21AC20DA515800BAD749 /* MWMCategoryInfoCell.mm in Sources */,
47E3C72D2111E6A2008B3B27 /* AlertTransitioning.swift in Sources */,
34845DAF1E1649F6003D55B9 /* DownloaderNoResultsEmbedViewController.swift in Sources */,
F6791B141C43DF0B007A8A6E /* MWMStartButton.mm in Sources */,
F6E2FEDF1E097BA00083EBEC /* MWMSearchManager+Layout.mm in Sources */,
@ -4737,7 +4775,9 @@
F6E2FE821E097BA00083EBEC /* MWMPlacePageOpeningHoursDayView.mm in Sources */,
340FDC092031C39E00F140AD /* BMCPermissionsPendingCell.swift in Sources */,
F6E2FD6B1E097BA00083EBEC /* MWMMapDownloaderSubplaceTableViewCell.mm in Sources */,
47E3C7252111E41B008B3B27 /* DimmedModalPresentationController.swift in Sources */,
3409D50B1FC6D8D2000F9B3E /* FilterCheckCell.swift in Sources */,
47E3C72121108E9F008B3B27 /* BookmarksLoadedViewController.swift in Sources */,
3472B5CB200F43EF00DC6CD5 /* BackgroundFetchScheduler.swift in Sources */,
34FE5A6F1F18F30F00BCA729 /* TrafficButtonArea.swift in Sources */,
F6E2FF691E097BA00083EBEC /* MWMUnitsController.mm in Sources */,
@ -4759,13 +4799,13 @@
F653CE121C6DEC8E00A453F1 /* MWMDropDown.mm in Sources */,
3404755C1E081A4600C92850 /* MWMLocationManager.mm in Sources */,
3454D7BC1E07F045004AF2AD /* CLLocation+Mercator.mm in Sources */,
47E3C7272111E5A8008B3B27 /* AlertPresentationController.swift in Sources */,
F6E2FF4E1E097BA00083EBEC /* MWMAboutController.mm in Sources */,
34F407381E9E1AFF00E57AC0 /* FacebookBanner.swift in Sources */,
34F5E0D41E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */,
6741AA0B1BF340DE002C974C /* MWMMapViewControlsManager.mm in Sources */,
F6E2FED91E097BA00083EBEC /* MWMSearchContentView.mm in Sources */,
F6E2FD891E097BA00083EBEC /* MWMMapDownloaderViewController.mm in Sources */,
4788739420EE350E00F6826B /* ModalTransitioning.swift in Sources */,
F6BD1D211CA412920047B8E8 /* MWMOsmAuthAlert.mm in Sources */,
34AB66321FC5AA330078E451 /* RouteManagerHeaderView.swift in Sources */,
347040301EA6470700038379 /* BorderedButton.swift in Sources */,
@ -4807,6 +4847,7 @@
F6E2FD921E097BA00083EBEC /* MWMBookmarkColorViewController.mm in Sources */,
F63AF5061EA6162400A1DB98 /* FilterTypeCell.swift in Sources */,
347752881F725002000D46A3 /* UGCAddReviewRatingCell.swift in Sources */,
47E3C7332111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift in Sources */,
34AB661A1FC5AA330078E451 /* MWMTaxiCollectionLayout.mm in Sources */,
345C2F8A1F86361B009DB8B4 /* MWMUGCViewModel.mm in Sources */,
34AB66861FC5AA330078E451 /* MWMNavigationInfoView.mm in Sources */,
@ -4845,6 +4886,7 @@
34EF94291C05A6F30050B714 /* MWMSegue.mm in Sources */,
3430291D1F87BF4400D0A07C /* ReviewsViewController.swift in Sources */,
F6E2FE731E097BA00083EBEC /* MWMOpeningHours.mm in Sources */,
47E3C7312111F4C2008B3B27 /* CoverVerticalPresentationAnimator.swift in Sources */,
F6D67CDC2062B9C00032FD38 /* BCCreateCategoryAlert.swift in Sources */,
F6E2FF601E097BA00083EBEC /* MWMSettingsViewController.mm in Sources */,
F6E2FE2B1E097BA00083EBEC /* MWMStreetEditorEditTableViewCell.mm in Sources */,
@ -4857,6 +4899,7 @@
34B924431DC8A29C0008D971 /* MWMMailViewController.mm in Sources */,
340475651E081A4600C92850 /* MWMRouter.mm in Sources */,
F6E2FF181E097BA00083EBEC /* MWMSearchTabbedCollectionViewCell.mm in Sources */,
47E3C72F2111F472008B3B27 /* CoverVerticalModalTransitioning.swift in Sources */,
346DB83D1E5C4F6700E3123E /* GalleryModel.swift in Sources */,
34E776101F14B165003040B3 /* VisibleArea.swift in Sources */,
34C0A69D1F4C1B380007CE5B /* GoogleNativeBanner.swift in Sources */,
@ -4890,6 +4933,7 @@
34845DB31E165E24003D55B9 /* SearchNoResultsViewController.swift in Sources */,
34AB660B1FC5AA320078E451 /* MWMNavigationDashboardEntity.mm in Sources */,
F5BD29FF26AD58255766C51A /* DiscoverySpinnerCell.swift in Sources */,
47E3C72B2111E62A008B3B27 /* AlertDismissalAnimator.swift in Sources */,
F5BD255A0838E70EC012748E /* DiscoverySearchCell.swift in Sources */,
F5BD2CA4DBEFACBC48195F39 /* DiscoveryCollectionHolderCell.swift in Sources */,
);

View file

@ -305,7 +305,7 @@ void registerCellsForTableView(vector<MWMEditorCellType> const & cells, UITableV
- (void)showDropDown
{
MWMDropDown * dd = [[MWMDropDown alloc] initWithSuperview:[MapViewController controller].view];
MWMDropDown * dd = [[MWMDropDown alloc] initWithSuperview:[MapViewController sharedController].view];
[dd showWithMessage:L(@"editor_edits_sent_message")];
}

View file

@ -563,7 +563,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
return referenceViewWhenDismissingHandler([galleryModel.items indexOfObject:photo]);
};
[[MapViewController controller] presentViewController:photoVC animated:YES completion:nil];
[[MapViewController sharedController] presentViewController:photoVC animated:YES completion:nil];
}
- (void)showGallery
@ -574,7 +574,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
logSponsoredEvent(self.data, kStatPlacePageHotelGallery);
auto galleryModel = [[MWMGalleryModel alloc] initWithTitle:self.hotelName items:data.photos];
auto galleryVc = [MWMGalleryViewController instanceWithModel:galleryModel];
[[MapViewController controller].navigationController pushViewController:galleryVc animated:YES];
[[MapViewController sharedController].navigationController pushViewController:galleryVc animated:YES];
}
- (void)showUGCAddReview:(MWMRatingSummaryViewValueType)value fromPreview:(BOOL)fromPreview
@ -610,7 +610,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
}
[data setUGCUpdateFrom:model];
}];
[[MapViewController controller].navigationController pushViewController:ugcVC animated:YES];
[[MapViewController sharedController].navigationController pushViewController:ugcVC animated:YES];
}
- (void)searchSimilar
@ -683,7 +683,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
- (void)openReviews:(id<MWMReviewsViewModelProtocol> _Nonnull)reviewsViewModel
{
auto reviewsVC = [[MWMReviewsViewController alloc] initWithViewModel:reviewsViewModel];
[[MapViewController controller].navigationController pushViewController:reviewsVC animated:YES];
[[MapViewController sharedController].navigationController pushViewController:reviewsVC animated:YES];
}
#pragma mark - AvailableArea / PlacePageArea
@ -705,6 +705,6 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
#pragma mark - Ownerfacilities
- (MapViewController *)ownerViewController { return [MapViewController controller]; }
- (MapViewController *)ownerViewController { return [MapViewController sharedController]; }
@end

View file

@ -241,7 +241,7 @@
NSString * title = isTitleNotEmpty ? [data title] : [data subtitle];
NSString * subtitle = isTitleNotEmpty ? [data subtitle] : nil;
UIViewController * vc = static_cast<UIViewController *>([MapViewController controller]);
UIViewController * vc = static_cast<UIViewController *>([MapViewController sharedController]);
NSMutableArray<NSString *> * titles = [@[] mutableCopy];
for (auto const buttonType : m_additionalButtons)
{

View file

@ -125,7 +125,7 @@
NSString * scheme = URL.scheme;
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])
{
[[MapViewController controller] openUrl:URL];
[[MapViewController sharedController] openUrl:URL];
return NO;
}
return YES;

View file

@ -603,7 +603,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
if (!cell)
return;
auto taxiBottom = CGPointMake(cell.width / 2, cell.height);
auto mainView = [MapViewController controller].view;
auto mainView = [MapViewController sharedController].view;
auto actionBar = self.actionBar;
BOOL const isInMainView =
[mainView pointInside:[cell convertPoint:taxiBottom toView:mainView] withEvent:nil];

View file

@ -485,7 +485,7 @@ using Observers = NSHashTable<Observer>;
}
[self onSearchManagerStateChanged];
[self.changeModeView updateForState:state];
[[MapViewController controller] updateStatusBarStyle];
[[MapViewController sharedController] updateStatusBarStyle];
}
- (void)viewHidden:(BOOL)hidden
@ -560,5 +560,5 @@ using Observers = NSHashTable<Observer>;
}
}
- (UIViewController *)ownerController { return [MapViewController controller]; }
- (UIViewController *)ownerController { return [MapViewController sharedController]; }
@end