






#import "CapsOffViewController.h"

@interface CapsOffViewController ()

@end

@implementation CapsOffViewController

- (UIButton *)protocolsButton
{
    if (!_protocolsButton) {
        _protocolsButton = [[UIButton alloc] init];
        [_protocolsButton setTitle:ForHueAfter.grayGradient.attachFailBrandCatLaunchBin forState:UIControlStateNormal];
        [_protocolsButton setTitleColor:[ForHueAfter detachSpaColor] forState:UIControlStateNormal];
        [_protocolsButton addTarget:self action:@selector(overHoursShadowRaceRunAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _protocolsButton;
}

- (UIButton *)fourMinderButton
{
    if (!_fourMinderButton) {
        _fourMinderButton = [[UIButton alloc] init];
        [_fourMinderButton setTitle:ForHueAfter.grayGradient.draftTradWayKerningCentralsDegraded forState:UIControlStateNormal];
        [_fourMinderButton setTitleColor:[ForHueAfter detachSpaColor] forState:UIControlStateNormal];
        [_fourMinderButton addTarget:self action:@selector(initialEraTwelveHealthFatalAction:) forControlEvents:UIControlEventTouchUpInside];
        _fourMinderButton.hidden = [ForHueAfter collisionSinMaskFatDimensionIndoor];
    }
    return _fourMinderButton;
}

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

- (void)initialEraTwelveHealthFatalAction:(UIButton *)sender {
    [[EarColumnManager shared] decodeDigestWindow];
    [ForHueAfter initialEraTwelveHealthFatalAction];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    self.view.layer.cornerRadius = 2;
    self.view.backgroundColor = [ForHueAfter reloadSpellCheckoutArePrivacyColor];
    [self.view addSubview:self.protocolsButton];
    [self.view addSubview:self.fourMinderButton];
    
    CGFloat napSize = ForHueAfter.grayGradient.napEndpoints;
    [_protocolsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.view).offset(ForHueAfter.grayGradient.nowNineteen);
        make.size.mas_equalTo(CGSizeMake(napSize, napSize));
    }];
    [_fourMinderButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(ForHueAfter.grayGradient.nowNineteen);
        make.right.equalTo(self.view).offset(-ForHueAfter.grayGradient.nowNineteen);
        make.size.mas_equalTo(CGSizeMake(napSize, napSize));
    }];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(waitingHealthEarlyStylisticBackCourseFrame:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(teethBelowModifiedRootTensionSound:) 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([ForHueAfter performedIncrementAdditionPanelAdobeSuchSize]);
    }];
}


- (void)waitingHealthEarlyStylisticBackCourseFrame:(NSNotification *)notification {
    
    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
    
    
    CGRect catalystFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    
    UIWindow *keyWindow = [EarColumnManager shared].indicatorFarWindow;
    if (![keyWindow isMemberOfClass:NSClassFromString(ForHueAfter.grayGradient.bitsAudiencesFailingAtomUnlockArguments)]) {
#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 runRect = [keyWindow convertRect:firstResponder.frame fromView:firstResponder.superview];
            
            if ((runRect.origin.y + runRect.size.height) > catalystFrame.origin.y) {
                CGFloat occur = ((runRect.origin.y + runRect.size.height) - catalystFrame.origin.y) + 10;
                
                needSin(self);
                [UIView animateWithDuration:duration animations:^{
                    upsideMid(self);
                    self.navigationController.view.transform = CGAffineTransformMakeTranslation(0, -occur);
                }];
            }
        }
    }
}


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

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

- (void)bankConcludeMagneticOffsetRemainder:(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
