






#import "LeftGetHexRankViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+RetainWax.h"
#import "NSString+OldChestBig.h"

@interface LeftGetHexRankViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *dividerCarrierControl;
@property (nonatomic, strong) UIView * exposureBurnRetScoreCellular;
@property (nonatomic, strong) UIView * wayComplexBadFilenamePair;

@property (nonatomic, strong) UIScrollView * deepNapAutoView;

@end

@implementation LeftGetHexRankViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.throughRowButton.hidden = YES;
    self.reuseCallButton.hidden = YES;
    
    UISegmentedControl *marginsView = [[UISegmentedControl alloc] initWithItems:@[SchemesSong.albumHexAgeFix.forCleanEventualBookmarkPartlyIgnored,SchemesSong.albumHexAgeFix.packOutsideCertSheVolatileBridge]];
    marginsView.layer.masksToBounds = YES; 
    marginsView.layer.cornerRadius = 2;    
    [marginsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SchemesSong domainCatColor]} forState:UIControlStateSelected];
    [marginsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SchemesSong domainCatColor]} forState:UIControlStateNormal];
    [self.view addSubview:marginsView];
    [marginsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(SchemesSong.targetRemote.funkHistory);
    }];
    [marginsView addTarget:self action:@selector(lappishHeader:) forControlEvents:UIControlEventValueChanged];
    self.dividerCarrierControl = marginsView;
    
    _deepNapAutoView = [[UIScrollView alloc]init];
    _deepNapAutoView.pagingEnabled = YES;
    _deepNapAutoView.delegate = self;
    [self.view addSubview:_deepNapAutoView];
    [_deepNapAutoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(SchemesSong.targetRemote.musicDynamic);
        make.right.equalTo(self.view).offset(-SchemesSong.targetRemote.musicDynamic);
        make.top.equalTo(self.view).offset(SchemesSong.targetRemote.ratingsSense);
        make.bottom.equalTo(self.view).offset(-SchemesSong.targetRemote.identityTemp);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.deepNapAutoView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.deepNapAutoView);
        make.height.equalTo(_deepNapAutoView);
    }];
    
    UIView * stringSubFat = [self chromeLikeView:[SchemesSong slavicTurnLateRemovalEmergency]];
    [containerView addSubview:stringSubFat];
    [stringSubFat mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.deepNapAutoView);
    }];
    self.exposureBurnRetScoreCellular = stringSubFat;
    
    UIView * underPairHit = [self chromeLikeView:[SchemesSong hardFarLinearKindFeed]];
    [containerView addSubview:underPairHit];
    [underPairHit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(stringSubFat.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.deepNapAutoView);
    }];
    self.wayComplexBadFilenamePair = underPairHit;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(underPairHit.mas_right);
    }];
    
    if (![self.minimumLine boolValue]) {
        UIButton *manLikeButton = [SchemesSong yetPickerDecomposeYouHundredColor:SchemesSong.albumHexAgeFix.sheColumnWho];
        [manLikeButton setBackgroundImage:[UIImage reportFailTalkColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [manLikeButton addTarget:self action:@selector(appleMeasuredPassDidSecretProvides:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:manLikeButton];
        
        [manLikeButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-SchemesSong.targetRemote.bagClipEcho);
            make.left.equalTo(self.view).offset(SchemesSong.targetRemote.musicDynamic);
            make.right.equalTo(self.view.mas_centerX).offset(-SchemesSong.targetRemote.areOutQuiet);
            make.height.mas_equalTo(SchemesSong.targetRemote.sleepAirMany);
        }];
    }

    UIButton *definedButton =  [SchemesSong yetPickerDecomposeYouHundredColor:SchemesSong.albumHexAgeFix.tagsAndKin];
    [definedButton addTarget:self action:@selector(translateCandidateSoftnessPortOutsideMacintosh:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:definedButton];
    BOOL storeButton = ![self.minimumLine boolValue];
    [definedButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-SchemesSong.targetRemote.bagClipEcho);
        make.right.equalTo(self.view).offset(-SchemesSong.targetRemote.musicDynamic);
        
        if (storeButton) {
            make.left.equalTo(self.view.mas_centerX).offset(SchemesSong.targetRemote.areOutQuiet);
        } else {
            make.left.equalTo(self.view).offset(SchemesSong.targetRemote.musicDynamic);
        }
        make.height.mas_equalTo(SchemesSong.targetRemote.sleepAirMany);
    }];
    
    marginsView.selectedSegmentIndex = 0;
    [self lappishHeader:marginsView];
}

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

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

- (void)pasteWetDayLockUplinkText:(NSInteger)type {
    NSString *drawZipSay = nil;
    UIView *contentView = nil;
    drawZipSay = type == 0 ? [SchemesSong slavicTurnLateRemovalEmergency]:[SchemesSong hardFarLinearKindFeed];
    contentView = type == 0 ? self.exposureBurnRetScoreCellular:self.wayComplexBadFilenamePair;
    
    if (drawZipSay.maxYouKernel) {
        return;
    }
    
    if ([[drawZipSay pathExtension] containsString:SchemesSong.targetRemote.perfusionSafeFitGreenDash]) {
        UITextView *lowView = (UITextView *)contentView;
        if (lowView.text.length > 0) {
            return;
        }

        
        [RevertDaysView tenSceneRangeView:contentView];

        
        NSURL *url = [NSURL URLWithString:drawZipSay];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [RevertDaysView countDisplaysSleepCharQualifierView:contentView];
                
                if (error || data.length == 0) {
                    
                    lowView.text = SchemesSong.albumHexAgeFix.labelItalicUptimePostEnclosingRatio;
                    return;
                }
                
                
                NSString *forLoadingEgg = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                lowView.text = forLoadingEgg ?: SchemesSong.albumHexAgeFix.finderBeaconsRainCollectedScopeHostingDolby;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *hexHex = (WKWebView *)contentView;
        if (!hexHex.isLoading && hexHex.estimatedProgress == 1) {
            [RevertDaysView countDisplaysSleepCharQualifierView:contentView];
            return;
        }
        [RevertDaysView tenSceneRangeView:contentView];
        NSString *filterHue =  [drawZipSay.reuseSoccerTwelveSyntheticRequestedSink stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:filterHue];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [hexHex loadRequest:request];
    }
}

- (void)appleMeasuredPassDidSecretProvides:(id)sender {
    [self warpCaloriesCupAmbiguousSymbolicAction:nil];
    if (self.putHisFrequencyAgeRebuild) {
        self.putHisFrequencyAgeRebuild(NO);
    }
}

- (void)translateCandidateSoftnessPortOutsideMacintosh:(id)sender {
    [self warpCaloriesCupAmbiguousSymbolicAction:nil];
    if (self.putHisFrequencyAgeRebuild) {
        self.putHisFrequencyAgeRebuild(YES);
    }
}

- (UIView *)chromeLikeView:(NSString *)string {
    UIView *funnelAdobe = nil;
    if ([[string pathExtension] containsString:SchemesSong.targetRemote.perfusionSafeFitGreenDash]) {
        UITextView * muteGain = [UITextView new];
        muteGain.editable = NO;
        muteGain.backgroundColor = UIColor.whiteColor;
        muteGain.textColor = UIColor.grayColor;
        funnelAdobe = muteGain;
    }else {
        WKWebView *holdBothAir = [[WKWebView alloc] initWithFrame:CGRectZero];
        holdBothAir.backgroundColor = UIColor.clearColor;
        holdBothAir.scrollView.backgroundColor = UIColor.lightGrayColor;
        holdBothAir.opaque = YES;
        holdBothAir.scrollView.bounces =NO;
        holdBothAir.scrollView.showsVerticalScrollIndicator = NO;
        holdBothAir.scrollView.showsHorizontalScrollIndicator = NO;
        holdBothAir.navigationDelegate = self;
        funnelAdobe = holdBothAir;
    }
    return funnelAdobe;
}

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

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

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

@end
