






#import "ColorProtectedViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+TowerNeed.h"
#import "NSString+RedExported.h"

@interface ColorProtectedViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *maySayStoodAskControl;
@property (nonatomic, strong) UIView * advisoryIntentsMixerUploadColleague;
@property (nonatomic, strong) UIView * femaleFalloffStopBreakingExport;

@property (nonatomic, strong) UIScrollView * bitSilencedView;

@end

@implementation ColorProtectedViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.redPanSlowButton.hidden = YES;
    self.ornamentsButton.hidden = YES;
    
    UISegmentedControl *wideRetView = [[UISegmentedControl alloc] initWithItems:@[BadMeanSame.bikeVeryIcyOne.capableMarginPictureMovementDoneOverlap,BadMeanSame.bikeVeryIcyOne.romanianDisappearNativeShiftDescribesMagnesium]];
    wideRetView.layer.masksToBounds = YES; 
    wideRetView.layer.cornerRadius = 2;    
    [wideRetView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BadMeanSame currentlyColor]} forState:UIControlStateSelected];
    [wideRetView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BadMeanSame currentlyColor]} forState:UIControlStateNormal];
    [self.view addSubview:wideRetView];
    [wideRetView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(BadMeanSame.clockwiseSun.alphaSyntax);
    }];
    [wideRetView addTarget:self action:@selector(maxBedLocales:) forControlEvents:UIControlEventValueChanged];
    self.maySayStoodAskControl = wideRetView;
    
    _bitSilencedView = [[UIScrollView alloc]init];
    _bitSilencedView.pagingEnabled = YES;
    _bitSilencedView.delegate = self;
    [self.view addSubview:_bitSilencedView];
    [_bitSilencedView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(BadMeanSame.clockwiseSun.controlsRest);
        make.right.equalTo(self.view).offset(-BadMeanSame.clockwiseSun.controlsRest);
        make.top.equalTo(self.view).offset(BadMeanSame.clockwiseSun.popIncorrect);
        make.bottom.equalTo(self.view).offset(-BadMeanSame.clockwiseSun.endDictation);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.bitSilencedView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bitSilencedView);
        make.height.equalTo(_bitSilencedView);
    }];
    
    UIView * mealAffected = [self mixCombineView:[BadMeanSame alternateEarRetCapSparse]];
    [containerView addSubview:mealAffected];
    [mealAffected mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.bitSilencedView);
    }];
    self.advisoryIntentsMixerUploadColleague = mealAffected;
    
    UIView * cleanFeedBox = [self mixCombineView:[BadMeanSame relevanceSplatAscendedTibetanOxygen]];
    [containerView addSubview:cleanFeedBox];
    [cleanFeedBox mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(mealAffected.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.bitSilencedView);
    }];
    self.femaleFalloffStopBreakingExport = cleanFeedBox;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(cleanFeedBox.mas_right);
    }];
    
    if (![self.burmeseFive boolValue]) {
        UIButton *holdNowButton = [BadMeanSame torqueBadRenewButtonFilenameColor:BadMeanSame.bikeVeryIcyOne.mayHandshake];
        [holdNowButton setBackgroundImage:[UIImage portGenderBusyColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [holdNowButton addTarget:self action:@selector(compactDeciliterTransposeDrawFormYou:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:holdNowButton];
        [holdNowButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-BadMeanSame.clockwiseSun.formatAgent);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(BadMeanSame.clockwiseSun.starThirdHue);
        }];
    }
    
    UIButton *hasPlanButton =  [BadMeanSame torqueBadRenewButtonFilenameColor:BadMeanSame.bikeVeryIcyOne.goalPinWon];
    [hasPlanButton addTarget:self action:@selector(unlikelyReversingFoodWrappingCallbacksMantissa:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:hasPlanButton];
    [hasPlanButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-BadMeanSame.clockwiseSun.formatAgent);
        make.centerX.equalTo(self.view).multipliedBy(![self.burmeseFive boolValue]?1.35:1);
        make.height.mas_equalTo(BadMeanSame.clockwiseSun.starThirdHue);
    }];
    
    wideRetView.selectedSegmentIndex = 0;
    [self maxBedLocales:wideRetView];
}

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

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

- (void)includesDeepDownNaturalDomainText:(NSInteger)type {
    NSString *literalHer = nil;
    UIView *contentView = nil;
    literalHer = type == 0 ? [BadMeanSame alternateEarRetCapSparse]:[BadMeanSame relevanceSplatAscendedTibetanOxygen];
    contentView = type == 0 ? self.advisoryIntentsMixerUploadColleague:self.femaleFalloffStopBreakingExport;
    
    if (literalHer.sayAreAcross) {
        return;
    }
    
    if ([[literalHer pathExtension] containsString:BadMeanSame.clockwiseSun.widthReasonVarianceScrollsWay]) {
        UITextView *itsView = (UITextView *)contentView;
        if (itsView.text.length > 0) {
            return;
        }

        
        [UserReturnView goldenCompileView:contentView];

        
        NSURL *url = [NSURL URLWithString:literalHer];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [UserReturnView locationsLogRunBuddyTreeView:contentView];
                
                if (error || data.length == 0) {
                    
                    itsView.text = BadMeanSame.bikeVeryIcyOne.extraMeanBlendSeasonSecurityFlat;
                    return;
                }
                
                
                NSString *failureDarker = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                itsView.text = failureDarker ?: BadMeanSame.bikeVeryIcyOne.greekBetterReduceLooperRebuildSplatHidden;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *dogEgg = (WKWebView *)contentView;
        if (!dogEgg.isLoading && dogEgg.estimatedProgress == 1) {
            [UserReturnView locationsLogRunBuddyTreeView:contentView];
            return;
        }
        [UserReturnView goldenCompileView:contentView];
        NSString *carbonKit =  [literalHer.declineExistentAttempterTipOfficialReferent stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:carbonKit];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [dogEgg loadRequest:request];
    }
}

- (void)compactDeciliterTransposeDrawFormYou:(id)sender {
    [self feedPeriodicPlusEngravedManualAction:nil];
    if (self.composeAsteriskMountNineteenName) {
        self.composeAsteriskMountNineteenName(NO);
    }
}

- (void)unlikelyReversingFoodWrappingCallbacksMantissa:(id)sender {
    [self feedPeriodicPlusEngravedManualAction:nil];
    if (self.composeAsteriskMountNineteenName) {
        self.composeAsteriskMountNineteenName(YES);
    }
}

- (UIView *)mixCombineView:(NSString *)string {
    UIView *exemplarBag = nil;
    if ([[string pathExtension] containsString:BadMeanSame.clockwiseSun.widthReasonVarianceScrollsWay]) {
        UITextView * armSolve = [UITextView new];
        armSolve.editable = NO;
        armSolve.backgroundColor = UIColor.whiteColor;
        armSolve.textColor = UIColor.grayColor;
        exemplarBag = armSolve;
    }else {
        WKWebView *theFaxPause = [[WKWebView alloc] initWithFrame:CGRectZero];
        theFaxPause.backgroundColor = UIColor.clearColor;
        theFaxPause.scrollView.backgroundColor = UIColor.lightGrayColor;
        theFaxPause.opaque = YES;
        theFaxPause.scrollView.bounces =NO;
        theFaxPause.scrollView.showsVerticalScrollIndicator = NO;
        theFaxPause.scrollView.showsHorizontalScrollIndicator = NO;
        theFaxPause.navigationDelegate = self;
        exemplarBag = theFaxPause;
    }
    return exemplarBag;
}

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

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

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

@end
