






#import "HourAudioThirdViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+Receiving.h"
#import "NSString+ReservedSub.h"

@interface HourAudioThirdViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *proxyStartKeepControl;
@property (nonatomic, strong) UIView * observersTallMinimizeTapCarbon;
@property (nonatomic, strong) UIView * tintSettingDerivePaperBank;

@property (nonatomic, strong) UIScrollView * unableCloudView;

@end

@implementation HourAudioThirdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.topMaleOurButton.hidden = YES;
    self.superiorsButton.hidden = YES;
    
    UISegmentedControl *ticketsView = [[UISegmentedControl alloc] initWithItems:@[SafeWaxSort.oldBothLogStop.remainderGaspHighlightMonotonicWeightContains,SafeWaxSort.oldBothLogStop.toneOrderingMalayStaticOperatingCoast]];
    ticketsView.layer.masksToBounds = YES; 
    ticketsView.layer.cornerRadius = 2;    
    [ticketsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SafeWaxSort teluguDidColor]} forState:UIControlStateSelected];
    [ticketsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SafeWaxSort teluguDidColor]} forState:UIControlStateNormal];
    [self.view addSubview:ticketsView];
    [ticketsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(SafeWaxSort.sinLaunchCut.lostTreeEar);
    }];
    [ticketsView addTarget:self action:@selector(recognizeSeed:) forControlEvents:UIControlEventValueChanged];
    self.proxyStartKeepControl = ticketsView;
    
    _unableCloudView = [[UIScrollView alloc]init];
    _unableCloudView.pagingEnabled = YES;
    _unableCloudView.delegate = self;
    [self.view addSubview:_unableCloudView];
    [_unableCloudView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(SafeWaxSort.sinLaunchCut.trialAutoWay);
        make.right.equalTo(self.view).offset(-SafeWaxSort.sinLaunchCut.trialAutoWay);
        make.top.equalTo(self.view).offset(SafeWaxSort.sinLaunchCut.halftoneJoin);
        make.bottom.equalTo(self.view).offset(-SafeWaxSort.sinLaunchCut.busOcclusion);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.unableCloudView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.unableCloudView);
        make.height.equalTo(_unableCloudView);
    }];
    
    UIView * wordScrolled = [self sectionAirView:[SafeWaxSort providerPenEditorialNanogramsDownhill]];
    [containerView addSubview:wordScrolled];
    [wordScrolled mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.unableCloudView);
    }];
    self.observersTallMinimizeTapCarbon = wordScrolled;
    
    UIView * wordPortrait = [self sectionAirView:[SafeWaxSort maleGigabytesMostCursorsCause]];
    [containerView addSubview:wordPortrait];
    [wordPortrait mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(wordScrolled.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.unableCloudView);
    }];
    self.tintSettingDerivePaperBank = wordPortrait;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(wordPortrait.mas_right);
    }];
    
    if (![self.tooStairTap boolValue]) {
        UIButton *showArmButton = [SafeWaxSort uniformBarrierWillGainSignalColor:SafeWaxSort.oldBothLogStop.advancedAuto];
        [showArmButton setBackgroundImage:[UIImage focusingNiacinColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [showArmButton addTarget:self action:@selector(scanLowFixAlbanianBouncePlate:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:showArmButton];
        
        [showArmButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-SafeWaxSort.sinLaunchCut.welshEraYou);
            make.left.equalTo(self.view).offset(SafeWaxSort.sinLaunchCut.trialAutoWay);
            make.right.equalTo(self.view.mas_centerX).offset(-SafeWaxSort.sinLaunchCut.boxRoomFeed);
            make.height.mas_equalTo(SafeWaxSort.sinLaunchCut.autoFunction);
        }];
    }

    UIButton *appearsButton =  [SafeWaxSort uniformBarrierWillGainSignalColor:SafeWaxSort.oldBothLogStop.resetSpace];
    [appearsButton addTarget:self action:@selector(caffeineRedirectsReturnTwoIdenticalIts:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:appearsButton];
    BOOL guideButton = ![self.tooStairTap boolValue];
    [appearsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-SafeWaxSort.sinLaunchCut.welshEraYou);
        make.right.equalTo(self.view).offset(-SafeWaxSort.sinLaunchCut.trialAutoWay);
        
        if (guideButton) {
            make.left.equalTo(self.view.mas_centerX).offset(SafeWaxSort.sinLaunchCut.boxRoomFeed);
        } else {
            make.left.equalTo(self.view).offset(SafeWaxSort.sinLaunchCut.trialAutoWay);
        }
        make.height.mas_equalTo(SafeWaxSort.sinLaunchCut.autoFunction);
    }];
    
    ticketsView.selectedSegmentIndex = 0;
    [self recognizeSeed:ticketsView];
}

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

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

- (void)tropicalDialogRootUnableSumText:(NSInteger)type {
    NSString *viewSawSay = nil;
    UIView *contentView = nil;
    viewSawSay = type == 0 ? [SafeWaxSort providerPenEditorialNanogramsDownhill]:[SafeWaxSort maleGigabytesMostCursorsCause];
    contentView = type == 0 ? self.observersTallMinimizeTapCarbon:self.tintSettingDerivePaperBank;
    
    if (viewSawSay.shareParsing) {
        return;
    }
    
    if ([[viewSawSay pathExtension] containsString:SafeWaxSort.sinLaunchCut.hourUndoJouleGrayPacket]) {
        UITextView *artView = (UITextView *)contentView;
        if (artView.text.length > 0) {
            return;
        }

        
        [RankSobHowView auxiliaryWrapView:contentView];

        
        NSURL *url = [NSURL URLWithString:viewSawSay];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [RankSobHowView anyCalorieLongerBringScriptsView:contentView];
                
                if (error || data.length == 0) {
                    
                    artView.text = SafeWaxSort.oldBothLogStop.reductionOriginsImmutableAndMaximumRotate;
                    return;
                }
                
                
                NSString *mathTalkBuild = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                artView.text = mathTalkBuild ?: SafeWaxSort.oldBothLogStop.weekPassivelyRightEditorialCycleOverLeap;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *remote = (WKWebView *)contentView;
        if (!remote.isLoading && remote.estimatedProgress == 1) {
            [RankSobHowView anyCalorieLongerBringScriptsView:contentView];
            return;
        }
        [RankSobHowView auxiliaryWrapView:contentView];
        NSString *sensorPan =  [viewSawSay.findRetRespectsPermittedBlockerNotifying stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:sensorPan];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [remote loadRequest:request];
    }
}

- (void)scanLowFixAlbanianBouncePlate:(id)sender {
    [self armCallingPhoneFiveRecursiveAction:nil];
    if (self.campaignKitReadyHostDistance) {
        self.campaignKitReadyHostDistance(NO);
    }
}

- (void)caffeineRedirectsReturnTwoIdenticalIts:(id)sender {
    [self armCallingPhoneFiveRecursiveAction:nil];
    if (self.campaignKitReadyHostDistance) {
        self.campaignKitReadyHostDistance(YES);
    }
}

- (UIView *)sectionAirView:(NSString *)string {
    UIView *tagGeorgian = nil;
    if ([[string pathExtension] containsString:SafeWaxSort.sinLaunchCut.hourUndoJouleGrayPacket]) {
        UITextView * clickFit = [UITextView new];
        clickFit.editable = NO;
        clickFit.backgroundColor = UIColor.whiteColor;
        clickFit.textColor = UIColor.grayColor;
        tagGeorgian = clickFit;
    }else {
        WKWebView *gaspJumpArm = [[WKWebView alloc] initWithFrame:CGRectZero];
        gaspJumpArm.backgroundColor = UIColor.clearColor;
        gaspJumpArm.scrollView.backgroundColor = UIColor.lightGrayColor;
        gaspJumpArm.opaque = YES;
        gaspJumpArm.scrollView.bounces =NO;
        gaspJumpArm.scrollView.showsVerticalScrollIndicator = NO;
        gaspJumpArm.scrollView.showsHorizontalScrollIndicator = NO;
        gaspJumpArm.navigationDelegate = self;
        tagGeorgian = gaspJumpArm;
    }
    return tagGeorgian;
}

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

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

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

@end
