






#import "BitsGainJobSawViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+ExternYet.h"
#import "NSString+ReaderAgent.h"

@interface BitsGainJobSawViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *northPrimeGrayControl;
@property (nonatomic, strong) UIView * bookIntegersTopGetHello;
@property (nonatomic, strong) UIView * exclusionReadableBoundaryArrangedNear;

@property (nonatomic, strong) UIScrollView * redFitTrustView;

@end

@implementation BitsGainJobSawViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.fitFunLeadButton.hidden = YES;
    self.personTenButton.hidden = YES;
    
    UISegmentedControl *surfaceView = [[UISegmentedControl alloc] initWithItems:@[MapSheFocus.catBlackPopMay.decryptCapTwoAllowableRedirectsTree,MapSheFocus.catBlackPopMay.duplicateGeorgianStorylineNetInputInserted]];
    surfaceView.layer.masksToBounds = YES; 
    surfaceView.layer.cornerRadius = 2;    
    [surfaceView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MapSheFocus mayBundleColor]} forState:UIControlStateSelected];
    [surfaceView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MapSheFocus mayBundleColor]} forState:UIControlStateNormal];
    [self.view addSubview:surfaceView];
    [surfaceView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(MapSheFocus.ownerQuality.unionReject);
    }];
    [surfaceView addTarget:self action:@selector(clangManyEach:) forControlEvents:UIControlEventValueChanged];
    self.northPrimeGrayControl = surfaceView;
    
    _redFitTrustView = [[UIScrollView alloc]init];
    _redFitTrustView.pagingEnabled = YES;
    _redFitTrustView.delegate = self;
    [self.view addSubview:_redFitTrustView];
    [_redFitTrustView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(MapSheFocus.ownerQuality.microPintDue);
        make.right.equalTo(self.view).offset(-MapSheFocus.ownerQuality.microPintDue);
        make.top.equalTo(self.view).offset(MapSheFocus.ownerQuality.packReverses);
        make.bottom.equalTo(self.view).offset(-MapSheFocus.ownerQuality.usesHueFiber);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.redFitTrustView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.redFitTrustView);
        make.height.equalTo(_redFitTrustView);
    }];
    
    UIView * midCollector = [self retCleanupView:[MapSheFocus standPointFullyRepliesVitamin]];
    [containerView addSubview:midCollector];
    [midCollector mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.redFitTrustView);
    }];
    self.bookIntegersTopGetHello = midCollector;
    
    UIView * runInsertion = [self retCleanupView:[MapSheFocus sentencesFastBoyfriendBeenResolving]];
    [containerView addSubview:runInsertion];
    [runInsertion mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(midCollector.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.redFitTrustView);
    }];
    self.exclusionReadableBoundaryArrangedNear = runInsertion;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(runInsertion.mas_right);
    }];
    
    if (![self.assertCross boolValue]) {
        UIButton *backCanButton = [MapSheFocus zipPinchGlobalCalorieInferColor:MapSheFocus.catBlackPopMay.hueShakeGain];
        [backCanButton setBackgroundImage:[UIImage keyTryWelshSeeColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [backCanButton addTarget:self action:@selector(earDebuggerWebpageShotWrongPool:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:backCanButton];
        [backCanButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-MapSheFocus.ownerQuality.slavicDense);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(MapSheFocus.ownerQuality.solveFailing);
        }];
    }
    
    UIButton *redBondButton =  [MapSheFocus zipPinchGlobalCalorieInferColor:MapSheFocus.catBlackPopMay.atomicWeek];
    [redBondButton addTarget:self action:@selector(americanAbsentResignLanguagesCatalanAltitude:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:redBondButton];
    [redBondButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-MapSheFocus.ownerQuality.slavicDense);
        make.centerX.equalTo(self.view).multipliedBy(![self.assertCross boolValue]?1.35:1);
        make.height.mas_equalTo(MapSheFocus.ownerQuality.solveFailing);
    }];
    
    surfaceView.selectedSegmentIndex = 0;
    [self clangManyEach:surfaceView];
}

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

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

- (void)outlineSimulatesNewsstandPanoramasStripText:(NSInteger)type {
    NSString *personMark = nil;
    UIView *contentView = nil;
    personMark = type == 0 ? [MapSheFocus standPointFullyRepliesVitamin]:[MapSheFocus sentencesFastBoyfriendBeenResolving];
    contentView = type == 0 ? self.bookIntegersTopGetHello:self.exclusionReadableBoundaryArrangedNear;
    
    if (personMark.exportedMean) {
        return;
    }
    
    if ([[personMark pathExtension] containsString:MapSheFocus.ownerQuality.physicalDecimalAirborneRenewingIteration]) {
        UITextView *logView = (UITextView *)contentView;
        if (logView.text.length > 0) {
            return;
        }

        
        [SobConvertView pullPullPhotoView:contentView];

        
        NSURL *url = [NSURL URLWithString:personMark];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [SobConvertView affinityValidatesRestoringViabilityStrokeView:contentView];
                
                if (error || data.length == 0) {
                    
                    logView.text = MapSheFocus.catBlackPopMay.formCentersAllParallelDistanceSections;
                    return;
                }
                
                
                NSString *musicWillSite = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                logView.text = musicWillSite ?: MapSheFocus.catBlackPopMay.youTwoProvideResetPrincipalBurnHandle;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *topEar = (WKWebView *)contentView;
        if (!topEar.isLoading && topEar.estimatedProgress == 1) {
            [SobConvertView affinityValidatesRestoringViabilityStrokeView:contentView];
            return;
        }
        [SobConvertView pullPullPhotoView:contentView];
        NSString *tabCommit =  [personMark.sunKernelsHiddenTildeBurnContact stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:tabCommit];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [topEar loadRequest:request];
    }
}

- (void)earDebuggerWebpageShotWrongPool:(id)sender {
    [self eightNewtonsBasqueSessionLawAction:nil];
    if (self.voiceKnowExpandIndirectAbnormal) {
        self.voiceKnowExpandIndirectAbnormal(NO);
    }
}

- (void)americanAbsentResignLanguagesCatalanAltitude:(id)sender {
    [self eightNewtonsBasqueSessionLawAction:nil];
    if (self.voiceKnowExpandIndirectAbnormal) {
        self.voiceKnowExpandIndirectAbnormal(YES);
    }
}

- (UIView *)retCleanupView:(NSString *)string {
    UIView *rateCleared = nil;
    if ([[string pathExtension] containsString:MapSheFocus.ownerQuality.physicalDecimalAirborneRenewingIteration]) {
        UITextView * unlocked = [UITextView new];
        unlocked.editable = NO;
        unlocked.backgroundColor = UIColor.whiteColor;
        unlocked.textColor = UIColor.grayColor;
        rateCleared = unlocked;
    }else {
        WKWebView *helloRunOdd = [[WKWebView alloc] initWithFrame:CGRectZero];
        helloRunOdd.backgroundColor = UIColor.clearColor;
        helloRunOdd.scrollView.backgroundColor = UIColor.lightGrayColor;
        helloRunOdd.opaque = YES;
        helloRunOdd.scrollView.bounces =NO;
        helloRunOdd.scrollView.showsVerticalScrollIndicator = NO;
        helloRunOdd.scrollView.showsHorizontalScrollIndicator = NO;
        helloRunOdd.navigationDelegate = self;
        rateCleared = helloRunOdd;
    }
    return rateCleared;
}

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

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

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

@end
