






#import "ZoomingViewController.h"

@interface ZoomingViewController ()

@end

@implementation ZoomingViewController

- (UIButton *)diskGenreButton
{
    if (!_diskGenreButton) {
        _diskGenreButton = [[UIButton alloc] init];
        [_diskGenreButton setTitle:SobIllWelsh.followBigKit.nanogramsSpouseSemanticWorkoutEarlyLandmark forState:UIControlStateNormal];
        [_diskGenreButton setTitleColor:[SobIllWelsh takePlaneColor] forState:UIControlStateNormal];
        [_diskGenreButton addTarget:self action:@selector(optApplyingMapMainSoccerAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _diskGenreButton;
}

- (UIButton *)warpFitWonButton
{
    if (!_warpFitWonButton) {
        _warpFitWonButton = [[UIButton alloc] init];
        [_warpFitWonButton setTitle:SobIllWelsh.followBigKit.quietDescribeHowEncodeLearnEvaluate forState:UIControlStateNormal];
        [_warpFitWonButton setTitleColor:[SobIllWelsh takePlaneColor] forState:UIControlStateNormal];
        [_warpFitWonButton addTarget:self action:@selector(compoundSlovenianHourStaleDesignAction:) forControlEvents:UIControlEventTouchUpInside];
        _warpFitWonButton.hidden = [SobIllWelsh magnesiumMismatchMainFaceUnfocusedWith];
    }
    return _warpFitWonButton;
}

- (void)optApplyingMapMainSoccerAction:(UIButton *)sender {
    if(self.navigationController.viewControllers.count > 1) {
        [self.view endEditing:YES];
        [self.navigationController popViewControllerAnimated:NO];
    }else {
        [self compoundSlovenianHourStaleDesignAction:sender];
        [self dismissViewControllerAnimated:NO completion:nil];
    }
}

- (void)compoundSlovenianHourStaleDesignAction:(UIButton *)sender {
    [[SleepPairManager shared] lossContainsWindow];
    [SobIllWelsh compoundSlovenianHourStaleDesignAction];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    self.view.layer.cornerRadius = 2;
    self.view.backgroundColor = [SobIllWelsh constantsExtraDirtyTriggerPortraitColor];
    [self.view addSubview:self.diskGenreButton];
    [self.view addSubview:self.warpFitWonButton];
    
    CGFloat canSize = SobIllWelsh.followBigKit.trackAreRedo;
    [_diskGenreButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.view).offset(SobIllWelsh.followBigKit.tintDryYear);
        make.size.mas_equalTo(CGSizeMake(canSize, canSize));
    }];
    [_warpFitWonButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(SobIllWelsh.followBigKit.tintDryYear);
        make.right.equalTo(self.view).offset(-SobIllWelsh.followBigKit.tintDryYear);
        make.size.mas_equalTo(CGSizeMake(canSize, canSize));
    }];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(landmarkHandLogSunManSortFrame:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(composeExternSiteLatvianSkippedPanoramas:) name:UIKeyboardWillHideNotification object:nil];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self.view.superview);
        make.size.mas_equalTo([SobIllWelsh daysLeakyMainUrgencyBoostArraySize]);
    }];
}


- (void)landmarkHandLogSunManSortFrame:(NSNotification *)notification {
    
    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
    
    
    CGRect tallDownFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    
    UIWindow *keyWindow = [SleepPairManager shared].specifierKinWindow;
    if (![keyWindow isMemberOfClass:NSClassFromString(SobIllWelsh.followBigKit.reviewRowObjectSpecifiedResolvedShrink)]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
        UIView *firstResponder = [keyWindow performSelector:@selector(firstResponder)];
#pragma clang diagnostic pop
        
        if (firstResponder  && [firstResponder isKindOfClass:UITextField.class]) {

            CGRect sixRect = [keyWindow convertRect:firstResponder.frame fromView:firstResponder.superview];
            
            if ((sixRect.origin.y + sixRect.size.height) > tallDownFrame.origin.y) {
                CGFloat stamp = ((sixRect.origin.y + sixRect.size.height) - tallDownFrame.origin.y) + 10;
                
                descent(self);
                [UIView animateWithDuration:duration animations:^{
                    unbounded(self);
                    self.navigationController.view.transform = CGAffineTransformMakeTranslation(0, -stamp);
                }];
            }
        }
    }
}


- (void)composeExternSiteLatvianSkippedPanoramas:(NSNotification *)notification{
    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
    descent(self);
    [UIView animateWithDuration:duration animations:^{
        unbounded(self);
        self.navigationController.view.transform = CGAffineTransformIdentity;
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesEnded:touches withEvent:event];
    [self.view endEditing:YES];
}

- (void)detachMetricOffYouPedometer:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

- (void)dealloc {
    
    [self.view endEditing:YES];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
}

@end
