<commit_before>#import "Common.h"
#import "EAGLView.h"
#import "MapsAppDelegate.h"
#import "MapViewController.h"
#import "MWMAddPlaceNavigationBar.h"
#import "MWMAlertViewController.h"
#import "MWMAPIBar.h"
#import "MWMAuthorizationCommon.h"
#import "MWMBottomMenuViewController.h"
#import "MWMButton.h"
#import "MWMObjectsCategorySelectorController.h"
#import "MWMFrameworkListener.h"
#import "MWMFrameworkObservers.h"
#import "MWMMapViewControlsManager.h"
#import "MWMPlacePageEntity.h"
#import "MWMPlacePageViewManager.h"
#import "MWMPlacePageViewManagerDelegate.h"
#import "MWMRoutePreview.h"
#import "MWMSearchManager.h"
#import "MWMSearchView.h"
#import "MWMZoomButtons.h"
#import "RouteState.h"
#import "Statistics.h"

#import "3party/Alohalytics/src/alohalytics_objc.h"

#include "Framework.h"

#include "platform/local_country_file_utils.hpp"

#include "storage/storage_helpers.hpp"

namespace
{
  NSString * const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
} // namespace

extern NSString * const kAlohalyticsTapEventKey;

@interface MWMMapViewControlsManager ()<
    MWMPlacePageViewManagerProtocol, MWMNavigationDashboardManagerProtocol,
    MWMSearchManagerProtocol, MWMSearchViewProtocol, MWMBottomMenuControllerProtocol,
    MWMRoutePreviewDataSource, MWMFrameworkRouteBuilderObserver>

@property (nonatomic) MWMZoomButtons * zoomButtons;
@property (nonatomic) MWMBottomMenuViewController * menuController;
@property (nonatomic) MWMPlacePageViewManager * placePageManager;
@property (nonatomic) MWMNavigationDashboardManager * navigationManager;
@property (nonatomic) MWMSearchManager * searchManager;

@property (weak, nonatomic) MapViewController * ownerController;

@property (nonatomic) BOOL disableStandbyOnRouteFollowing;
@property (nonatomic) MWMRoutePoint routeSource;
@property (nonatomic) MWMRoutePoint routeDestination;

@property (nonatomic) CGFloat topBound;
@property (nonatomic) CGFloat leftBound;

@end

@implementation MWMMapViewControlsManager

- (instancetype)initWithParentController:(MapViewController *)controller
{
  if (!controller)
    return nil;
  self = [super init];
  if (!self)
    return nil;
  self.ownerController = controller;
  self.zoomButtons = [[MWMZoomButtons alloc] initWithParentView:controller.view];
  self.menuController = [[MWMBottomMenuViewController alloc] initWithParentController:controller delegate:self];
  self.placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:controller delegate:self];
  self.navigationManager = [[MWMNavigationDashboardManager alloc] initWithParentView:controller.view delegate:self];
  self.searchManager = [[MWMSearchManager alloc] initWithParentView:controller.view delegate:self];
  self.hidden = NO;
  self.zoomHidden = NO;
  self.menuState = MWMBottomMenuStateInactive;
  [self configRoutePoints];
  [MWMFrameworkListener addObserver:self];
  return self;
}

- (void)configRoutePoints
{
  if ([Alohalytics isFirstSession])
  {
    self.routeSource = MWMRoutePoint::MWMRoutePointZero();
  }
  else
  {
    LocationManager * m = MapsAppDelegate.theApp.locationManager;
    self.routeSource = m.lastLocationIsValid ? MWMRoutePoint(m.lastLocation.mercator)
                                             : MWMRoutePoint::MWMRoutePointZero();
  }
  self.routeDestination = MWMRoutePoint::MWMRoutePointZero();
}

#pragma mark - MWMFrameworkRouteBuilderObserver

- (void)processRouteBuilderEvent:(routing::IRouter::ResultCode)code
                       countries:(storage::TCountriesVec const &)absentCountries
{
  switch (code)
  {
    case routing::IRouter::ResultCode::NoError:
    {
      [self.navigationManager setRouteBuilderProgress:100];
      self.searchHidden = YES;
      break;
    }
    case routing::IRouter::Cancelled:
      break;
    default:
      [self handleRoutingError];
      break;
  }
}

- (void)processRouteBuilderProgress:(CGFloat)progress
{
  [self.navigationManager setRouteBuilderProgress:progress];
}<commit_msg>[ios] Fixed routing's error handling when error is routing::IRouter::NeedMoreMaps.<commit_after>#import "Common.h"
#import "EAGLView.h"
#import "MapsAppDelegate.h"
#import "MapViewController.h"
#import "MWMAddPlaceNavigationBar.h"
#import "MWMAlertViewController.h"
#import "MWMAPIBar.h"
#import "MWMAuthorizationCommon.h"
#import "MWMBottomMenuViewController.h"
#import "MWMButton.h"
#import "MWMObjectsCategorySelectorController.h"
#import "MWMFrameworkListener.h"
#import "MWMFrameworkObservers.h"
#import "MWMMapViewControlsManager.h"
#import "MWMPlacePageEntity.h"
#import "MWMPlacePageViewManager.h"
#import "MWMPlacePageViewManagerDelegate.h"
#import "MWMRoutePreview.h"
#import "MWMSearchManager.h"
#import "MWMSearchView.h"
#import "MWMZoomButtons.h"
#import "RouteState.h"
#import "Statistics.h"

#import "3party/Alohalytics/src/alohalytics_objc.h"

#include "Framework.h"

#include "platform/local_country_file_utils.hpp"

#include "storage/storage_helpers.hpp"

namespace
{
  NSString * const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
} // namespace

extern NSString * const kAlohalyticsTapEventKey;

@interface MWMMapViewControlsManager ()<
    MWMPlacePageViewManagerProtocol, MWMNavigationDashboardManagerProtocol,
    MWMSearchManagerProtocol, MWMSearchViewProtocol, MWMBottomMenuControllerProtocol,
    MWMRoutePreviewDataSource, MWMFrameworkRouteBuilderObserver>

@property (nonatomic) MWMZoomButtons * zoomButtons;
@property (nonatomic) MWMBottomMenuViewController * menuController;
@property (nonatomic) MWMPlacePageViewManager * placePageManager;
@property (nonatomic) MWMNavigationDashboardManager * navigationManager;
@property (nonatomic) MWMSearchManager * searchManager;

@property (weak, nonatomic) MapViewController * ownerController;

@property (nonatomic) BOOL disableStandbyOnRouteFollowing;
@property (nonatomic) MWMRoutePoint routeSource;
@property (nonatomic) MWMRoutePoint routeDestination;

@property (nonatomic) CGFloat topBound;
@property (nonatomic) CGFloat leftBound;

@end

@implementation MWMMapViewControlsManager

- (instancetype)initWithParentController:(MapViewController *)controller
{
  if (!controller)
    return nil;
  self = [super init];
  if (!self)
    return nil;
  self.ownerController = controller;
  self.zoomButtons = [[MWMZoomButtons alloc] initWithParentView:controller.view];
  self.menuController = [[MWMBottomMenuViewController alloc] initWithParentController:controller delegate:self];
  self.placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:controller delegate:self];
  self.navigationManager = [[MWMNavigationDashboardManager alloc] initWithParentView:controller.view delegate:self];
  self.searchManager = [[MWMSearchManager alloc] initWithParentView:controller.view delegate:self];
  self.hidden = NO;
  self.zoomHidden = NO;
  self.menuState = MWMBottomMenuStateInactive;
  [self configRoutePoints];
  [MWMFrameworkListener addObserver:self];
  return self;
}

- (void)configRoutePoints
{
  if ([Alohalytics isFirstSession])
  {
    self.routeSource = MWMRoutePoint::MWMRoutePointZero();
  }
  else
  {
    LocationManager * m = MapsAppDelegate.theApp.locationManager;
    self.routeSource = m.lastLocationIsValid ? MWMRoutePoint(m.lastLocation.mercator)
                                             : MWMRoutePoint::MWMRoutePointZero();
  }
  self.routeDestination = MWMRoutePoint::MWMRoutePointZero();
}

#pragma mark - MWMFrameworkRouteBuilderObserver

- (void)processRouteBuilderEvent:(routing::IRouter::ResultCode)code
                       countries:(storage::TCountriesVec const &)absentCountries
{
  switch (code)
  {
    case routing::IRouter::ResultCode::NoError:
    {
      [self.navigationManager setRouteBuilderProgress:100];
      self.searchHidden = YES;
      break;
    }
    case routing::IRouter::Cancelled:
    case routing::IRouter::NeedMoreMaps:
      break;
    default:
      [self handleRoutingError];
      break;
  }
}

- (void)processRouteBuilderProgress:(CGFloat)progress
{
  [self.navigationManager setRouteBuilderProgress:progress];
}
{'fraction_non_alphanumeric': 0.09893247269116187, 'fraction_numerical': 0.0009930486593843098, 'mean_word_length': 6.155417406749556, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5530124', 'n_tokens_mistral': 2498, 'n_tokens_neox': 2392, 'n_words': 438}