






#import "PolicyLinkFoodViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+AdoptPeer.h"
#import "NSString+ArtClaimAir.h"

@interface PolicyLinkFoodViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *alpineHighNeedControl;
@property (nonatomic, strong) UIView * maleAskShapeVolatileEscape;
@property (nonatomic, strong) UIView * smoothedIssueNegateTapContact;

@property (nonatomic, strong) UIScrollView * yearMarathiView;

@end

@implementation PolicyLinkFoodViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.endTaggingButton.hidden = YES;
    self.valueRingButton.hidden = YES;
    
    UISegmentedControl *cornersView = [[UISegmentedControl alloc] initWithItems:@[MusicLowPen.mailCanSkinMid.helloDateRepublicEnergyMouthOutcome,MusicLowPen.mailCanSkinMid.dependingRetainElderSymptomExemplarStore]];
    cornersView.layer.masksToBounds = YES; 
    cornersView.layer.cornerRadius = 2;    
    [cornersView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MusicLowPen markupOddColor]} forState:UIControlStateSelected];
    [cornersView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MusicLowPen markupOddColor]} forState:UIControlStateNormal];
    [self.view addSubview:cornersView];
    [cornersView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(MusicLowPen.artBehaveMay.chunkyReady);
    }];
    [cornersView addTarget:self action:@selector(searchWebpage:) forControlEvents:UIControlEventValueChanged];
    self.alpineHighNeedControl = cornersView;
    
    _yearMarathiView = [[UIScrollView alloc]init];
    _yearMarathiView.pagingEnabled = YES;
    _yearMarathiView.delegate = self;
    [self.view addSubview:_yearMarathiView];
    [_yearMarathiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(MusicLowPen.artBehaveMay.heapBuiltRun);
        make.right.equalTo(self.view).offset(-MusicLowPen.artBehaveMay.heapBuiltRun);
        make.top.equalTo(self.view).offset(MusicLowPen.artBehaveMay.areMillDatum);
        make.bottom.equalTo(self.view).offset(-MusicLowPen.artBehaveMay.allergyPatch);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.yearMarathiView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.yearMarathiView);
        make.height.equalTo(_yearMarathiView);
    }];
    
    UIView * userProgress = [self lawArcheryView:[MusicLowPen brotherBurnCutSegmentedRejection]];
    [containerView addSubview:userProgress];
    [userProgress mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.yearMarathiView);
    }];
    self.maleAskShapeVolatileEscape = userProgress;
    
    UIView * dayGrandaunt = [self lawArcheryView:[MusicLowPen alarmWeightsVisitViewMatting]];
    [containerView addSubview:dayGrandaunt];
    [dayGrandaunt mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(userProgress.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.yearMarathiView);
    }];
    self.smoothedIssueNegateTapContact = dayGrandaunt;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(dayGrandaunt.mas_right);
    }];
    
    if (![self.lookPairKey boolValue]) {
        UIButton *denyAskButton = [MusicLowPen filenameNoteTelephotoLanguagesNegativeColor:MusicLowPen.mailCanSkinMid.topSpherical];
        [denyAskButton setBackgroundImage:[UIImage homeRadialHardColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [denyAskButton addTarget:self action:@selector(builderOnlineLabelIntegerHertzThousands:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:denyAskButton];
        [denyAskButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-MusicLowPen.artBehaveMay.widgetHeavy);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(MusicLowPen.artBehaveMay.topUnitQuick);
        }];
    }
    
    UIButton *hormoneButton =  [MusicLowPen filenameNoteTelephotoLanguagesNegativeColor:MusicLowPen.mailCanSkinMid.goalPrefix];
    [hormoneButton addTarget:self action:@selector(mainAchievedNotSkipLemmaTrusted:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:hormoneButton];
    [hormoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-MusicLowPen.artBehaveMay.widgetHeavy);
        make.centerX.equalTo(self.view).multipliedBy(![self.lookPairKey boolValue]?1.35:1);
        make.height.mas_equalTo(MusicLowPen.artBehaveMay.topUnitQuick);
    }];
    
    cornersView.selectedSegmentIndex = 0;
    [self searchWebpage:cornersView];
}

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

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

- (void)fourteenFullEarMetalPetiteText:(NSInteger)type {
    NSString *expandCert = nil;
    UIView *contentView = nil;
    expandCert = type == 0 ? [MusicLowPen brotherBurnCutSegmentedRejection]:[MusicLowPen alarmWeightsVisitViewMatting];
    contentView = type == 0 ? self.maleAskShapeVolatileEscape:self.smoothedIssueNegateTapContact;
    
    if (expandCert.jobKindDutch) {
        return;
    }
    
    if ([[expandCert pathExtension] containsString:MusicLowPen.artBehaveMay.sinNanogramsEarSoundUpper]) {
        UITextView *wasView = (UITextView *)contentView;
        if (wasView.text.length > 0) {
            return;
        }

        
        [AdjustsSixView fourExactnessView:contentView];

        
        NSURL *url = [NSURL URLWithString:expandCert];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [AdjustsSixView clickClearFlipStepperHeadphoneView:contentView];
                
                if (error || data.length == 0) {
                    
                    wasView.text = MusicLowPen.mailCanSkinMid.irishButCreditsCaptureRunAuxiliary;
                    return;
                }
                
                
                NSString *boxPassiveArt = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                wasView.text = boxPassiveArt ?: MusicLowPen.mailCanSkinMid.readerCopticSyntaxFitRowsAdverbAnimator;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *winEar = (WKWebView *)contentView;
        if (!winEar.isLoading && winEar.estimatedProgress == 1) {
            [AdjustsSixView clickClearFlipStepperHeadphoneView:contentView];
            return;
        }
        [AdjustsSixView fourExactnessView:contentView];
        NSString *prettyOwn =  [expandCert.hashDisappearSeasonFormBeenPing stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:prettyOwn];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [winEar loadRequest:request];
    }
}

- (void)builderOnlineLabelIntegerHertzThousands:(id)sender {
    [self filenamesUnfocusedRotateFurlongsHallAction:nil];
    if (self.directBankLexicalTipConstant) {
        self.directBankLexicalTipConstant(NO);
    }
}

- (void)mainAchievedNotSkipLemmaTrusted:(id)sender {
    [self filenamesUnfocusedRotateFurlongsHallAction:nil];
    if (self.directBankLexicalTipConstant) {
        self.directBankLexicalTipConstant(YES);
    }
}

- (UIView *)lawArcheryView:(NSString *)string {
    UIView *rearSaySwap = nil;
    if ([[string pathExtension] containsString:MusicLowPen.artBehaveMay.sinNanogramsEarSoundUpper]) {
        UITextView * ownBlack = [UITextView new];
        ownBlack.editable = NO;
        ownBlack.backgroundColor = UIColor.whiteColor;
        ownBlack.textColor = UIColor.grayColor;
        rearSaySwap = ownBlack;
    }else {
        WKWebView *hisPauseKit = [[WKWebView alloc] initWithFrame:CGRectZero];
        hisPauseKit.backgroundColor = UIColor.clearColor;
        hisPauseKit.scrollView.backgroundColor = UIColor.lightGrayColor;
        hisPauseKit.opaque = YES;
        hisPauseKit.scrollView.bounces =NO;
        hisPauseKit.scrollView.showsVerticalScrollIndicator = NO;
        hisPauseKit.scrollView.showsHorizontalScrollIndicator = NO;
        hisPauseKit.navigationDelegate = self;
        rearSaySwap = hisPauseKit;
    }
    return rearSaySwap;
}

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

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

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

@end
