






#import "RedVarianceViewController.h"
#import "SDWebImageManager.h"
#import "AgeToast.h"
#import "NSString+MathStyle.h"

@interface RedVarianceViewController ()

@property (nonatomic, strong) UIImageView *mayAirBlockImageView;
@property (nonatomic, strong) UITextField *readerTagTextField;
@property (nonatomic, strong) UITextField *rowsFileFixTextField;

@end

@implementation RedVarianceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.sunTreeIllButton.hidden = [self.endOnlyCall[0] boolValue];
    
    CGFloat decigramsGreatSlashSnapCatalyst = WinSubAbove.swipeFlagDay.herAssistive;
    
    UILabel *funLabel = [WinSubAbove entropySayClaimSoftnessEncrypt:WinSubAbove.resourcesCanon.decoderLinkMotionThiaminTop];
    funLabel.numberOfLines = 0;
    [self.view addSubview:funLabel];
    [funLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(WinSubAbove.swipeFlagDay.faeroeseFail);
        make.left.mas_equalTo(WinSubAbove.swipeFlagDay.hangWaistBox);
        make.right.mas_equalTo(-WinSubAbove.swipeFlagDay.hangWaistBox);
    }];
    
    
    self.readerTagTextField = [WinSubAbove penOldWristField:WinSubAbove.resourcesCanon.redoneOnceDecideManLatvianCompact isSecure:NO];
    [self.view addSubview:self.readerTagTextField];
    [self.readerTagTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(funLabel.mas_bottom).offset(decigramsGreatSlashSnapCatalyst);
        make.left.mas_equalTo(WinSubAbove.swipeFlagDay.buildCityJob);
        make.right.mas_equalTo(-WinSubAbove.swipeFlagDay.buildCityJob);
        make.height.mas_equalTo(WinSubAbove.swipeFlagDay.dueGrowUnion);
    }];
    
    
    self.rowsFileFixTextField = [WinSubAbove penOldWristField:WinSubAbove.resourcesCanon.producingDependingAllocatorFontSlovakEnd isSecure:NO];;
    [self.view addSubview:self.rowsFileFixTextField];
    [self.rowsFileFixTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.readerTagTextField.mas_bottom).offset(decigramsGreatSlashSnapCatalyst);
        make.left.right.equalTo(self.readerTagTextField);
        make.height.mas_equalTo(WinSubAbove.swipeFlagDay.dueGrowUnion);
    }];
    
    
    UIImageView *activeImageView = nil;
    if ([self.endOnlyCall[1] length] > 0) {
        
        activeImageView = [[UIImageView alloc] init];
        activeImageView.backgroundColor = UIColor.lightGrayColor;
        activeImageView.contentMode = UIViewContentModeScaleAspectFit;
        [self.view addSubview:activeImageView];
        [activeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.rowsFileFixTextField.mas_bottom).offset(decigramsGreatSlashSnapCatalyst);
            make.width.mas_equalTo(self.rowsFileFixTextField);
            make.centerX.mas_equalTo(0);
        }];
        self.mayAirBlockImageView = activeImageView;
        
        [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:self.endOnlyCall[1]] options:0 progress:nil completed:^(UIImage * _Nullable image2, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
            dispatch_async(dispatch_get_main_queue(), ^{
                activeImageView.image = image2;
                CGFloat ratio = image2.size.height / image2.size.width;
                [activeImageView mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.height.mas_equalTo((WinSubAbove.swipeFlagDay.intrinsicSexFormWriteMaxWidth -WinSubAbove.swipeFlagDay.buildCityJob*2)*ratio);
                }];
                [self.view layoutIfNeeded];
                
                [self.view mas_remakeConstraints:^(MASConstraintMaker *make) {
                    make.center.mas_equalTo(0);
                    CGFloat height = self.mayAirBlockImageView ? self.mayAirBlockImageView.frame.size.height + WinSubAbove.swipeFlagDay.herAssistive +WinSubAbove.swipeFlagDay.balticDialogLogBadmintonUnitFix : WinSubAbove.swipeFlagDay.balticDialogLogBadmintonUnitFix;
                    
                    make.size.mas_equalTo(CGSizeMake(WinSubAbove.swipeFlagDay.intrinsicSexFormWriteMaxWidth, MIN(height, UIScreen.mainScreen.bounds.size.height)));
                    if (height > UIScreen.mainScreen.bounds.size.height) {
                        [self.mayAirBlockImageView mas_updateConstraints:^(MASConstraintMaker *make) {
                            make.height.mas_equalTo(self.mayAirBlockImageView.frame.size.height-(height-UIScreen.mainScreen.bounds.size.height));
                        }];
                    }
                }];
            });
        }];
    }
    
    
    UIButton *forChromeButton = [WinSubAbove transposePipeAddCurlOurColor:WinSubAbove.resourcesCanon.adjustingQuoteLookArgumentsTen];
    [forChromeButton addTarget:self action:@selector(inuitOpaqueButterflyCardDecisionSpecial:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:forChromeButton];
    [forChromeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-WinSubAbove.swipeFlagDay.yellowUnsafe);
        make.left.right.equalTo(self.readerTagTextField);
        make.height.mas_equalTo(WinSubAbove.swipeFlagDay.civilNearBad);
    }];
    
}

- (void)inuitOpaqueButterflyCardDecisionSpecial:(id)sender {
if (self.readerTagTextField.text.tagPositions || self.rowsFileFixTextField.text.tagPositions) {
        [ItsAlertView phasePromisedToolAndRefreshedRepeats:WinSubAbove.resourcesCanon.daughters message:WinSubAbove.resourcesCanon.sectionHexKitSortLexiconDescent completion:nil];
        return;
    }
    if ([self.mayCutSampler respondsToSelector:@selector(readerMustWrappingLogNarrativeThirdWithName:itsSum:completion:)]) {
        [RespondHowView discardedBoldWindow];
        [self.mayCutSampler readerMustWrappingLogNarrativeThirdWithName:self.readerTagTextField.text itsSum:self.rowsFileFixTextField.text completion:^(id object) {
            [RespondHowView cycleStairRingMagentaCommittedWindow];
            if ([object boolValue]) {
                [[AutoIntroManager shared] fullHertzKeyWindow];
                [AgeToast exitsTower:WinSubAbove.resourcesCanon.portInitialComponentTapTapsMalay];
            }
        }];
    }
}

@end
