






#import "FunkTakeOutWayViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+BoostTone.h"
#import "NSString+FiveWinRing.h"

@interface FunkTakeOutWayViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *beenMalaySpaceControl;
@property (nonatomic, strong) UIView * raiseThousandsAgeDismissedPrefers;
@property (nonatomic, strong) UIView * stiffnessCompileBoostTowerDown;

@property (nonatomic, strong) UIScrollView * insertFloatView;

@end

@implementation FunkTakeOutWayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.loudLegacyButton.hidden = YES;
    self.exclusiveButton.hidden = YES;
    
    UISegmentedControl *gestureView = [[UISegmentedControl alloc] initWithItems:@[SumWorkTrad.arrayLawAllTop.nineConsoleNeedUsesUptimeNepali,SumWorkTrad.arrayLawAllTop.encodingsFlushYardMayAggregatePlaying]];
    gestureView.layer.masksToBounds = YES; 
    gestureView.layer.cornerRadius = 2;    
    [gestureView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SumWorkTrad alphaPingColor]} forState:UIControlStateSelected];
    [gestureView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SumWorkTrad alphaPingColor]} forState:UIControlStateNormal];
    [self.view addSubview:gestureView];
    [gestureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(SumWorkTrad.fastAgeWidth.kinTwoBrand);
    }];
    [gestureView addTarget:self action:@selector(spellStillWho:) forControlEvents:UIControlEventValueChanged];
    self.beenMalaySpaceControl = gestureView;
    
    _insertFloatView = [[UIScrollView alloc]init];
    _insertFloatView.pagingEnabled = YES;
    _insertFloatView.delegate = self;
    [self.view addSubview:_insertFloatView];
    [_insertFloatView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(SumWorkTrad.fastAgeWidth.panTenPrefer);
        make.right.equalTo(self.view).offset(-SumWorkTrad.fastAgeWidth.panTenPrefer);
        make.top.equalTo(self.view).offset(SumWorkTrad.fastAgeWidth.funLoudGiven);
        make.bottom.equalTo(self.view).offset(-SumWorkTrad.fastAgeWidth.oceanResting);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.insertFloatView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.insertFloatView);
        make.height.equalTo(_insertFloatView);
    }];
    
    UIView * getCallbacks = [self passAssumeView:[SumWorkTrad turkmenSaturateSayMegabytesTurn]];
    [containerView addSubview:getCallbacks];
    [getCallbacks mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.insertFloatView);
    }];
    self.raiseThousandsAgeDismissedPrefers = getCallbacks;
    
    UIView * mainEveryEye = [self passAssumeView:[SumWorkTrad rawNoneAdditionsDisableMatrix]];
    [containerView addSubview:mainEveryEye];
    [mainEveryEye mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(getCallbacks.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.insertFloatView);
    }];
    self.stiffnessCompileBoostTowerDown = mainEveryEye;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(mainEveryEye.mas_right);
    }];
    
    if (![self.shelfWhoBus boolValue]) {
        UIButton *sexLoopButton = [SumWorkTrad mandatoryTakeNonceSearchUniqueColor:SumWorkTrad.arrayLawAllTop.figureTabFit];
        [sexLoopButton setBackgroundImage:[UIImage popRaceSaltGetColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [sexLoopButton addTarget:self action:@selector(repeatSugarEnablingExtentUnlikelySex:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:sexLoopButton];
        [sexLoopButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-SumWorkTrad.fastAgeWidth.manWinFinal);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(SumWorkTrad.fastAgeWidth.armWetKelvin);
        }];
    }
    
    UIButton *curlOurButton =  [SumWorkTrad mandatoryTakeNonceSearchUniqueColor:SumWorkTrad.arrayLawAllTop.browseLazy];
    [curlOurButton addTarget:self action:@selector(injectionForbidDescendHexSolveObserve:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:curlOurButton];
    [curlOurButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-SumWorkTrad.fastAgeWidth.manWinFinal);
        make.centerX.equalTo(self.view).multipliedBy(![self.shelfWhoBus boolValue]?1.35:1);
        make.height.mas_equalTo(SumWorkTrad.fastAgeWidth.armWetKelvin);
    }];
    
    gestureView.selectedSegmentIndex = 0;
    [self spellStillWho:gestureView];
}

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

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

- (void)costSonSuggestedSelectingAffiliateText:(NSInteger)type {
    NSString *opticalTen = nil;
    UIView *contentView = nil;
    opticalTen = type == 0 ? [SumWorkTrad turkmenSaturateSayMegabytesTurn]:[SumWorkTrad rawNoneAdditionsDisableMatrix];
    contentView = type == 0 ? self.raiseThousandsAgeDismissedPrefers:self.stiffnessCompileBoostTowerDown;
    
    if (opticalTen.seeBecomeThe) {
        return;
    }
    
    if ([[opticalTen pathExtension] containsString:SumWorkTrad.fastAgeWidth.storylineEffectWasWindowBatch]) {
        UITextView *wonView = (UITextView *)contentView;
        if (wonView.text.length > 0) {
            return;
        }

        
        [TurkmenOddView flashRetLimitView:contentView];

        
        NSURL *url = [NSURL URLWithString:opticalTen];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [TurkmenOddView authorityDustCommandSixProposedView:contentView];
                
                if (error || data.length == 0) {
                    
                    wonView.text = SumWorkTrad.arrayLawAllTop.sidebarElevationIntersectSchedulerCalciumUnplugged;
                    return;
                }
                
                
                NSString *itsUnionSugar = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                wonView.text = itsUnionSugar ?: SumWorkTrad.arrayLawAllTop.sumBlusteryHerCityKeyEpisodeLambda;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *arabic = (WKWebView *)contentView;
        if (!arabic.isLoading && arabic.estimatedProgress == 1) {
            [TurkmenOddView authorityDustCommandSixProposedView:contentView];
            return;
        }
        [TurkmenOddView flashRetLimitView:contentView];
        NSString *dueInvert =  [opticalTen.warnLateProfilesIntervalBrushCentrals stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:dueInvert];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [arabic loadRequest:request];
    }
}

- (void)repeatSugarEnablingExtentUnlikelySex:(id)sender {
    [self alpineOperateOrdinalsSeeBasicAction:nil];
    if (self.hitBedDecayNetBackward) {
        self.hitBedDecayNetBackward(NO);
    }
}

- (void)injectionForbidDescendHexSolveObserve:(id)sender {
    [self alpineOperateOrdinalsSeeBasicAction:nil];
    if (self.hitBedDecayNetBackward) {
        self.hitBedDecayNetBackward(YES);
    }
}

- (UIView *)passAssumeView:(NSString *)string {
    UIView *coastOddSon = nil;
    if ([[string pathExtension] containsString:SumWorkTrad.fastAgeWidth.storylineEffectWasWindowBatch]) {
        UITextView * trackToo = [UITextView new];
        trackToo.editable = NO;
        trackToo.backgroundColor = UIColor.whiteColor;
        trackToo.textColor = UIColor.grayColor;
        coastOddSon = trackToo;
    }else {
        WKWebView *tryOffFully = [[WKWebView alloc] initWithFrame:CGRectZero];
        tryOffFully.backgroundColor = UIColor.clearColor;
        tryOffFully.scrollView.backgroundColor = UIColor.lightGrayColor;
        tryOffFully.opaque = YES;
        tryOffFully.scrollView.bounces =NO;
        tryOffFully.scrollView.showsVerticalScrollIndicator = NO;
        tryOffFully.scrollView.showsHorizontalScrollIndicator = NO;
        tryOffFully.navigationDelegate = self;
        coastOddSon = tryOffFully;
    }
    return coastOddSon;
}

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

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

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

@end
