






#import "AreaPatchReadyViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+Receiving.h"
#import "NSString+PutEraLease.h"

@interface AreaPatchReadyViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *anyLowUsageMaxControl;
@property (nonatomic, strong) UIView * trustedCaretFixtureSendCombining;
@property (nonatomic, strong) UIView * dissolveJumpIllPackBetween;

@property (nonatomic, strong) UIScrollView * zeroKinRaceView;

@end

@implementation AreaPatchReadyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.visualPintButton.hidden = YES;
    self.negotiateButton.hidden = YES;
    
    UISegmentedControl *prepTryView = [[UISegmentedControl alloc] initWithItems:@[LambdaPatch.returnThatMode.floatingLeaseScaleCookieNicknameMultiply,LambdaPatch.returnThatMode.packEpisodeResetNepaliGatheringAgent]];
    prepTryView.layer.masksToBounds = YES; 
    prepTryView.layer.cornerRadius = 2;    
    [prepTryView setTitleTextAttributes:@{NSForegroundColorAttributeName:[LambdaPatch menstrualColor]} forState:UIControlStateSelected];
    [prepTryView setTitleTextAttributes:@{NSForegroundColorAttributeName:[LambdaPatch menstrualColor]} forState:UIControlStateNormal];
    [self.view addSubview:prepTryView];
    [prepTryView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(LambdaPatch.faxChildBend.signBusBoth);
    }];
    [prepTryView addTarget:self action:@selector(freeExchanges:) forControlEvents:UIControlEventValueChanged];
    self.anyLowUsageMaxControl = prepTryView;
    
    _zeroKinRaceView = [[UIScrollView alloc]init];
    _zeroKinRaceView.pagingEnabled = YES;
    _zeroKinRaceView.delegate = self;
    [self.view addSubview:_zeroKinRaceView];
    [_zeroKinRaceView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(LambdaPatch.faxChildBend.scalarKitIll);
        make.right.equalTo(self.view).offset(-LambdaPatch.faxChildBend.scalarKitIll);
        make.top.equalTo(self.view).offset(LambdaPatch.faxChildBend.ouncesUpdate);
        make.bottom.equalTo(self.view).offset(-LambdaPatch.faxChildBend.clickStopDry);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.zeroKinRaceView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.zeroKinRaceView);
        make.height.equalTo(_zeroKinRaceView);
    }];
    
    UIView * speakMayFeed = [self zipPublishView:[LambdaPatch twoZipTelephonyMethodReport]];
    [containerView addSubview:speakMayFeed];
    [speakMayFeed mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.zeroKinRaceView);
    }];
    self.trustedCaretFixtureSendCombining = speakMayFeed;
    
    UIView * pingAgentBig = [self zipPublishView:[LambdaPatch persistMultiplyMoireFadeBarrier]];
    [containerView addSubview:pingAgentBig];
    [pingAgentBig mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(speakMayFeed.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.zeroKinRaceView);
    }];
    self.dissolveJumpIllPackBetween = pingAgentBig;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(pingAgentBig.mas_right);
    }];
    
    if (![self.mostTipRest boolValue]) {
        UIButton *moreSobButton = [LambdaPatch keyOwnVowelFatFootColor:LambdaPatch.returnThatMode.constantsBig];
        [moreSobButton setBackgroundImage:[UIImage wonDenyTextFitColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [moreSobButton addTarget:self action:@selector(notWasGaspMaxOtherCanceling:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:moreSobButton];
        
        [moreSobButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-LambdaPatch.faxChildBend.sumCoulombs);
            make.left.equalTo(self.view).offset(LambdaPatch.faxChildBend.scalarKitIll);
            make.right.equalTo(self.view.mas_centerX).offset(-LambdaPatch.faxChildBend.rowSawInfer);
            make.height.mas_equalTo(LambdaPatch.faxChildBend.howStoryline);
        }];
    }

    UIButton *oldNineButton =  [LambdaPatch keyOwnVowelFatFootColor:LambdaPatch.returnThatMode.spaSeeForm];
    [oldNineButton addTarget:self action:@selector(valueAchievedFontCommandsGestureSpa:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:oldNineButton];
    BOOL briefButton = ![self.mostTipRest boolValue];
    [oldNineButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-LambdaPatch.faxChildBend.sumCoulombs);
        make.right.equalTo(self.view).offset(-LambdaPatch.faxChildBend.scalarKitIll);
        
        if (briefButton) {
            make.left.equalTo(self.view.mas_centerX).offset(LambdaPatch.faxChildBend.rowSawInfer);
        } else {
            make.left.equalTo(self.view).offset(LambdaPatch.faxChildBend.scalarKitIll);
        }
        make.height.mas_equalTo(LambdaPatch.faxChildBend.howStoryline);
    }];
    
    prepTryView.selectedSegmentIndex = 0;
    [self freeExchanges:prepTryView];
}

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

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

- (void)separateAndIncorrectMetricReceiveText:(NSInteger)type {
    NSString *lookSunIll = nil;
    UIView *contentView = nil;
    lookSunIll = type == 0 ? [LambdaPatch twoZipTelephonyMethodReport]:[LambdaPatch persistMultiplyMoireFadeBarrier];
    contentView = type == 0 ? self.trustedCaretFixtureSendCombining:self.dissolveJumpIllPackBetween;
    
    if (lookSunIll.whoPopManual) {
        return;
    }
    
    if ([[lookSunIll pathExtension] containsString:LambdaPatch.faxChildBend.rollMetadataPreventsSensorEdga]) {
        UITextView *badView = (UITextView *)contentView;
        if (badView.text.length > 0) {
            return;
        }

        
        [HalfTapOddView allGetRebuildView:contentView];

        
        NSURL *url = [NSURL URLWithString:lookSunIll];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [HalfTapOddView readFemaleDetachFileEditorialView:contentView];
                
                if (error || data.length == 0) {
                    
                    badView.text = LambdaPatch.returnThatMode.directoryPinTwistBookmarkSubsetSpine;
                    return;
                }
                
                
                NSString *hisSobTypeOpt = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                badView.text = hisSobTypeOpt ?: LambdaPatch.returnThatMode.appleBecomeSwahiliFourteenInstallsPolarStable;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *cutoff = (WKWebView *)contentView;
        if (!cutoff.isLoading && cutoff.estimatedProgress == 1) {
            [HalfTapOddView readFemaleDetachFileEditorialView:contentView];
            return;
        }
        [HalfTapOddView allGetRebuildView:contentView];
        NSString *movieCell =  [lookSunIll.hisWatchOnceSemaphoreColorColleague stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:movieCell];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [cutoff loadRequest:request];
    }
}

- (void)notWasGaspMaxOtherCanceling:(id)sender {
    [self fractionsChainContactsInventoryRunningAction:nil];
    if (self.footnoteTransportCombineYouNotify) {
        self.footnoteTransportCombineYouNotify(NO);
    }
}

- (void)valueAchievedFontCommandsGestureSpa:(id)sender {
    [self fractionsChainContactsInventoryRunningAction:nil];
    if (self.footnoteTransportCombineYouNotify) {
        self.footnoteTransportCombineYouNotify(YES);
    }
}

- (UIView *)zipPublishView:(NSString *)string {
    UIView *muteProvide = nil;
    if ([[string pathExtension] containsString:LambdaPatch.faxChildBend.rollMetadataPreventsSensorEdga]) {
        UITextView * addition = [UITextView new];
        addition.editable = NO;
        addition.backgroundColor = UIColor.whiteColor;
        addition.textColor = UIColor.grayColor;
        muteProvide = addition;
    }else {
        WKWebView *vibrancyCat = [[WKWebView alloc] initWithFrame:CGRectZero];
        vibrancyCat.backgroundColor = UIColor.clearColor;
        vibrancyCat.scrollView.backgroundColor = UIColor.lightGrayColor;
        vibrancyCat.opaque = YES;
        vibrancyCat.scrollView.bounces =NO;
        vibrancyCat.scrollView.showsVerticalScrollIndicator = NO;
        vibrancyCat.scrollView.showsHorizontalScrollIndicator = NO;
        vibrancyCat.navigationDelegate = self;
        muteProvide = vibrancyCat;
    }
    return muteProvide;
}

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

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

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

@end
