






#import "HowCycleNapWhoViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+SeedLabel.h"
#import "NSString+SplitHitEar.h"

@interface HowCycleNapWhoViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *boostShakeSortControl;
@property (nonatomic, strong) UIView * assistiveSwappedTallOperatorExpert;
@property (nonatomic, strong) UIView * fitMoreHueDestroyTouches;

@property (nonatomic, strong) UIScrollView * listenSolveView;

@end

@implementation HowCycleNapWhoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.veryCarMapButton.hidden = YES;
    self.lowerBeenButton.hidden = YES;
    
    UISegmentedControl *intentsView = [[UISegmentedControl alloc] initWithItems:@[RaceRateYou.maxSnapYearShe.integrityAreaVariablesArmpitZoomGathering,RaceRateYou.maxSnapYearShe.inviteeMapKitPhoneInitiallyCharge]];
    intentsView.layer.masksToBounds = YES; 
    intentsView.layer.cornerRadius = 2;    
    [intentsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[RaceRateYou ropeCauseColor]} forState:UIControlStateSelected];
    [intentsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[RaceRateYou ropeCauseColor]} forState:UIControlStateNormal];
    [self.view addSubview:intentsView];
    [intentsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(RaceRateYou.wristBoldNot.rateRowMath);
    }];
    [intentsView addTarget:self action:@selector(foodWinTooFar:) forControlEvents:UIControlEventValueChanged];
    self.boostShakeSortControl = intentsView;
    
    _listenSolveView = [[UIScrollView alloc]init];
    _listenSolveView.pagingEnabled = YES;
    _listenSolveView.delegate = self;
    [self.view addSubview:_listenSolveView];
    [_listenSolveView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(RaceRateYou.wristBoldNot.signalForNap);
        make.right.equalTo(self.view).offset(-RaceRateYou.wristBoldNot.signalForNap);
        make.top.equalTo(self.view).offset(RaceRateYou.wristBoldNot.tryQueueCard);
        make.bottom.equalTo(self.view).offset(-RaceRateYou.wristBoldNot.revertingFax);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.listenSolveView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.listenSolveView);
        make.height.equalTo(_listenSolveView);
    }];
    
    UIView * inheritedThe = [self airPeerDayView:[RaceRateYou hitDrivenPermittedPoolWas]];
    [containerView addSubview:inheritedThe];
    [inheritedThe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.listenSolveView);
    }];
    self.assistiveSwappedTallOperatorExpert = inheritedThe;
    
    UIView * legacyDidJob = [self airPeerDayView:[RaceRateYou speakerAdverbRadialDustStation]];
    [containerView addSubview:legacyDidJob];
    [legacyDidJob mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(inheritedThe.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.listenSolveView);
    }];
    self.fitMoreHueDestroyTouches = legacyDidJob;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(legacyDidJob.mas_right);
    }];
    
    if (![self.discreteTry boolValue]) {
        UIButton *lessRedButton = [RaceRateYou songLawWelshTriggerAlcoholColor:RaceRateYou.maxSnapYearShe.sayTildePart];
        [lessRedButton setBackgroundImage:[UIImage insetVoiceLastColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [lessRedButton addTarget:self action:@selector(detailConditionBatchFixingProduceOld:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:lessRedButton];
        [lessRedButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-RaceRateYou.wristBoldNot.bagTheTwist);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(RaceRateYou.wristBoldNot.deliverBrief);
        }];
    }
    
    UIButton *keysFaxButton =  [RaceRateYou songLawWelshTriggerAlcoholColor:RaceRateYou.maxSnapYearShe.elapsedCar];
    [keysFaxButton addTarget:self action:@selector(circleTertiaryUptimeDatabasesFunkRepeat:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:keysFaxButton];
    [keysFaxButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-RaceRateYou.wristBoldNot.bagTheTwist);
        make.centerX.equalTo(self.view).multipliedBy(![self.discreteTry boolValue]?1.35:1);
        make.height.mas_equalTo(RaceRateYou.wristBoldNot.deliverBrief);
    }];
    
    intentsView.selectedSegmentIndex = 0;
    [self foodWinTooFar:intentsView];
}

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    [self.boostShakeSortControl setSelectedSegmentIndex:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
    [self unlockedChromeKnowHostingMaskText:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
}

- (void)foodWinTooFar:(UISegmentedControl *)sender {
    [self unlockedChromeKnowHostingMaskText:sender.selectedSegmentIndex == 0?0:1];
    [self.listenSolveView setContentOffset:CGPointMake(sender.selectedSegmentIndex == 0?0:self.listenSolveView.frame.size.width, 0) animated:YES];
}

- (void)unlockedChromeKnowHostingMaskText:(NSInteger)type {
    NSString *bengaliJob = nil;
    UIView *contentView = nil;
    bengaliJob = type == 0 ? [RaceRateYou hitDrivenPermittedPoolWas]:[RaceRateYou speakerAdverbRadialDustStation];
    contentView = type == 0 ? self.assistiveSwappedTallOperatorExpert:self.fitMoreHueDestroyTouches;
    
    if (bengaliJob.mouseSegment) {
        return;
    }
    
    if ([[bengaliJob pathExtension] containsString:RaceRateYou.wristBoldNot.optimizedCatPlaybackKeepBar]) {
        UITextView *boxView = (UITextView *)contentView;
        if (boxView.text.length > 0) {
            return;
        }

        
        [WarpHexOurView arrayForceMapView:contentView];

        
        NSURL *url = [NSURL URLWithString:bengaliJob];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [WarpHexOurView preservedAmbienceStaticLettersDecayView:contentView];
                
                if (error || data.length == 0) {
                    
                    boxView.text = RaceRateYou.maxSnapYearShe.qualifierLookColleagueBeforeFilteringPreview;
                    return;
                }
                
                
                NSString *howHardTwoAre = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                boxView.text = howHardTwoAre ?: RaceRateYou.maxSnapYearShe.minimizeYiddishWorkDryKitDetectsVersion;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *andEnd = (WKWebView *)contentView;
        if (!andEnd.isLoading && andEnd.estimatedProgress == 1) {
            [WarpHexOurView preservedAmbienceStaticLettersDecayView:contentView];
            return;
        }
        [WarpHexOurView arrayForceMapView:contentView];
        NSString *outputHis =  [bengaliJob.tableSecretQuotesSoloAltimeterYou stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:outputHis];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [andEnd loadRequest:request];
    }
}

- (void)detailConditionBatchFixingProduceOld:(id)sender {
    [self wristBordersWasPreviewsScopeAction:nil];
    if (self.scannedLocaleEightTightHeartbeat) {
        self.scannedLocaleEightTightHeartbeat(NO);
    }
}

- (void)circleTertiaryUptimeDatabasesFunkRepeat:(id)sender {
    [self wristBordersWasPreviewsScopeAction:nil];
    if (self.scannedLocaleEightTightHeartbeat) {
        self.scannedLocaleEightTightHeartbeat(YES);
    }
}

- (UIView *)airPeerDayView:(NSString *)string {
    UIView *yetMidAllow = nil;
    if ([[string pathExtension] containsString:RaceRateYou.wristBoldNot.optimizedCatPlaybackKeepBar]) {
        UITextView * denseSay = [UITextView new];
        denseSay.editable = NO;
        denseSay.backgroundColor = UIColor.whiteColor;
        denseSay.textColor = UIColor.grayColor;
        yetMidAllow = denseSay;
    }else {
        WKWebView *videoSender = [[WKWebView alloc] initWithFrame:CGRectZero];
        videoSender.backgroundColor = UIColor.clearColor;
        videoSender.scrollView.backgroundColor = UIColor.lightGrayColor;
        videoSender.opaque = YES;
        videoSender.scrollView.bounces =NO;
        videoSender.scrollView.showsVerticalScrollIndicator = NO;
        videoSender.scrollView.showsHorizontalScrollIndicator = NO;
        videoSender.navigationDelegate = self;
        yetMidAllow = videoSender;
    }
    return yetMidAllow;
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
    [WarpHexOurView preservedAmbienceStaticLettersDecayView:webView];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    UIEdgeInsets notHueEdga = [[SeparatedManager shared] nordicBecomeWindow].safeAreaInsets;
    notHueEdga.top    += 10;
    notHueEdga.left   += 10;
    notHueEdga.bottom += 10;
    notHueEdga.right  += 10;

    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(notHueEdga);
    }];
}

@end
