<commit_before>#import "MWMBottomMenuViewController.h"
#import "MWMActivityViewController.h"
#import "MWMBottomMenuCollectionViewCell.h"
#import "MWMBottomMenuControllerProtocol.h"
#import "MWMBottomMenuLayout.h"
#import "MWMButton.h"
#import "MWMCommon.h"
#import "MWMDiscoveryController.h"
#import "MWMMapViewControlsManager.h"
#import "MWMNetworkPolicy.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "Statistics.h"
#import "Statistics+ConnectionTypeLogging.h"
#import "SwiftBridge.h"

#include "Framework.h"

#include "platform/platform.hpp"

extern NSString * const kAlohalyticsTapEventKey;
extern NSString * const kSearchStateKey;

namespace
{
CGFloat constexpr kLayoutThreshold = 420.0;
}  // namespace

typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
  MWMBottomMenuViewCellAddPlace,
  MWMBottomMenuViewCellDownload,
  MWMBottomMenuViewCellSettings,
  MWMBottomMenuViewCellShare,
  MWMBottomMenuViewCellCount
};

@interface MWMMapViewControlsManager ()

@property(nonatomic) MWMBottomMenuViewController * menuController;

@end

@interface MWMBottomMenuViewController ()<UICollectionViewDataSource, UICollectionViewDelegate,
                                          MWMNavigationDashboardObserver, MWMSearchManagerObserver>

@property(nonatomic) MWMBottomMenuState restoreState;
@property(nonatomic) MWMDimBackground * dimBackground;
@property(nonatomic, readonly) NSUInteger additionalButtonsCount;
@property(weak, nonatomic) IBOutlet MWMButton * searchButton;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * mainButtonsHeight;
@property(weak, nonatomic) IBOutlet UICollectionView * additionalButtons;
@property(weak, nonatomic) IBOutlet UIView * downloadBadge;
@property(weak, nonatomic) MapViewController * controller;
@property(weak, nonatomic) id<MWMBottomMenuControllerProtocol> delegate;

@end

@implementation MWMBottomMenuViewController

+ (MWMBottomMenuViewController *)controller
{
  return [MWMMapViewControlsManager manager].menuController;
}

+ (void)updateAvailableArea:(CGRect)frame
{
  auto view = static_cast<MWMBottomMenuView *>([self controller].view);
  [view updateAvailableArea:frame];
}

- (instancetype)initWithParentController:(MapViewController *)controller
                                delegate:(id<MWMBottomMenuControllerProtocol>)delegate
{
  self = [super init];
  if (self)
  {
    _controller = controller;
    _delegate = delegate;
    [controller addChildViewController:self];
    [controller.view addSubview:self.view];
  }
  return self;
}

- (void)dealloc { [NSNotificationCenter.defaultCenter removeObserver:self]; }
- (void)viewDidLoad
{<commit_msg>[iphonex] [ios] Added initial bottom menu layout.<commit_after>#import "MWMBottomMenuViewController.h"
#import "MWMActivityViewController.h"
#import "MWMBottomMenuCollectionViewCell.h"
#import "MWMBottomMenuControllerProtocol.h"
#import "MWMBottomMenuLayout.h"
#import "MWMButton.h"
#import "MWMCommon.h"
#import "MWMDiscoveryController.h"
#import "MWMMapViewControlsManager.h"
#import "MWMNetworkPolicy.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "Statistics.h"
#import "Statistics+ConnectionTypeLogging.h"
#import "SwiftBridge.h"

#include "Framework.h"

#include "platform/platform.hpp"

extern NSString * const kAlohalyticsTapEventKey;
extern NSString * const kSearchStateKey;

namespace
{
CGFloat constexpr kLayoutThreshold = 420.0;
}  // namespace

typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
  MWMBottomMenuViewCellAddPlace,
  MWMBottomMenuViewCellDownload,
  MWMBottomMenuViewCellSettings,
  MWMBottomMenuViewCellShare,
  MWMBottomMenuViewCellCount
};

@interface MWMMapViewControlsManager ()

@property(nonatomic) MWMBottomMenuViewController * menuController;

@end

@interface MWMBottomMenuViewController ()<UICollectionViewDataSource, UICollectionViewDelegate,
                                          MWMNavigationDashboardObserver, MWMSearchManagerObserver>

@property(nonatomic) MWMBottomMenuState restoreState;
@property(nonatomic) MWMDimBackground * dimBackground;
@property(nonatomic, readonly) NSUInteger additionalButtonsCount;
@property(weak, nonatomic) IBOutlet MWMButton * searchButton;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * mainButtonsHeight;
@property(weak, nonatomic) IBOutlet UICollectionView * additionalButtons;
@property(weak, nonatomic) IBOutlet UIView * downloadBadge;
@property(weak, nonatomic) MapViewController * controller;
@property(weak, nonatomic) id<MWMBottomMenuControllerProtocol> delegate;

@end

@implementation MWMBottomMenuViewController

+ (MWMBottomMenuViewController *)controller
{
  return [MWMMapViewControlsManager manager].menuController;
}

+ (void)updateAvailableArea:(CGRect)frame
{
  auto view = static_cast<MWMBottomMenuView *>([self controller].view);
  [view updateAvailableArea:frame];
}

- (instancetype)initWithParentController:(MapViewController *)controller
                                delegate:(id<MWMBottomMenuControllerProtocol>)delegate
{
  self = [super init];
  if (self)
  {
    _controller = controller;
    _delegate = delegate;
    [controller addChildViewController:self];
    [controller.view addSubview:self.view];
    [controller.view layoutIfNeeded];
  }
  return self;
}

- (void)dealloc { [NSNotificationCenter.defaultCenter removeObserver:self]; }
- (void)viewDidLoad
{
{'fraction_non_alphanumeric': 0.09412425149700598, 'fraction_numerical': 0.0014970059880239522, 'mean_word_length': 6.668579626972741, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7317536', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1564, 'n_words': 296}