






#import "BinLowFaxSlideViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+Extension.h"
#import "NSString+ForkVolumes.h"

@interface BinLowFaxSlideViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *fetchForBigAndControl;
@property (nonatomic, strong) UIView * centersAmbiguityPascalDisorderTorch;
@property (nonatomic, strong) UIView * cosmicMessagingJustifiedEnglishUnwinding;

@property (nonatomic, strong) UIScrollView * chestRunMenView;

@end

@implementation BinLowFaxSlideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.catAtomTryButton.hidden = YES;
    self.ductilityButton.hidden = YES;
    
    UISegmentedControl *localesView = [[UISegmentedControl alloc] initWithItems:@[PaceDownHue.touchBusyMalay.roomBikeStructureOutDidSentence,PaceDownHue.touchBusyMalay.drivenUnderagePencilFeaturesSolidSquash]];
    localesView.layer.masksToBounds = YES; 
    localesView.layer.cornerRadius = 2;    
    [localesView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PaceDownHue frequencyColor]} forState:UIControlStateSelected];
    [localesView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PaceDownHue frequencyColor]} forState:UIControlStateNormal];
    [self.view addSubview:localesView];
    [localesView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(PaceDownHue.absoluteAuto.pageMaxNear);
    }];
    [localesView addTarget:self action:@selector(rowDidSchemes:) forControlEvents:UIControlEventValueChanged];
    self.fetchForBigAndControl = localesView;
    
    _chestRunMenView = [[UIScrollView alloc]init];
    _chestRunMenView.pagingEnabled = YES;
    _chestRunMenView.delegate = self;
    [self.view addSubview:_chestRunMenView];
    [_chestRunMenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(PaceDownHue.absoluteAuto.logoAllJoule);
        make.right.equalTo(self.view).offset(-PaceDownHue.absoluteAuto.logoAllJoule);
        make.top.equalTo(self.view).offset(PaceDownHue.absoluteAuto.spaColorGain);
        make.bottom.equalTo(self.view).offset(-PaceDownHue.absoluteAuto.sinkOldAlign);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.chestRunMenView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.chestRunMenView);
        make.height.equalTo(_chestRunMenView);
    }];
    
    UIView * sayHowVolume = [self wayTagYearView:[PaceDownHue notTiedDeliveryLowSob]];
    [containerView addSubview:sayHowVolume];
    [sayHowVolume mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.chestRunMenView);
    }];
    self.centersAmbiguityPascalDisorderTorch = sayHowVolume;
    
    UIView * registryLess = [self wayTagYearView:[PaceDownHue unlimitedVisitApplyingUrgentAnchoring]];
    [containerView addSubview:registryLess];
    [registryLess mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sayHowVolume.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.chestRunMenView);
    }];
    self.cosmicMessagingJustifiedEnglishUnwinding = registryLess;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(registryLess.mas_right);
    }];
    
    if (![self.hisEllipsis boolValue]) {
        UIButton *punjabiButton = [PaceDownHue issueSolidUnsafeRelevanceInsetColor:PaceDownHue.touchBusyMalay.boldOutUnder];
        [punjabiButton setBackgroundImage:[UIImage browseMuteMillColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [punjabiButton addTarget:self action:@selector(fiveCervicalRequireLocalRedVirtual:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:punjabiButton];
        [punjabiButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-PaceDownHue.absoluteAuto.lossyTheOff);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(PaceDownHue.absoluteAuto.decryptedOne);
        }];
    }
    
    UIButton *companyButton =  [PaceDownHue issueSolidUnsafeRelevanceInsetColor:PaceDownHue.touchBusyMalay.gaelicWarn];
    [companyButton addTarget:self action:@selector(modifierBundleExportingPhaseCorrectedDiscarded:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:companyButton];
    [companyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-PaceDownHue.absoluteAuto.lossyTheOff);
        make.centerX.equalTo(self.view).multipliedBy(![self.hisEllipsis boolValue]?1.35:1);
        make.height.mas_equalTo(PaceDownHue.absoluteAuto.decryptedOne);
    }];
    
    localesView.selectedSegmentIndex = 0;
    [self rowDidSchemes:localesView];
}

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

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

- (void)sideParallelTintNothingBoldText:(NSInteger)type {
    NSString *napRowDash = nil;
    UIView *contentView = nil;
    napRowDash = type == 0 ? [PaceDownHue notTiedDeliveryLowSob]:[PaceDownHue unlimitedVisitApplyingUrgentAnchoring];
    contentView = type == 0 ? self.centersAmbiguityPascalDisorderTorch:self.cosmicMessagingJustifiedEnglishUnwinding;
    
    if (napRowDash.focusMembers) {
        return;
    }
    
    if ([[napRowDash pathExtension] containsString:PaceDownHue.absoluteAuto.cutterAdoptUnlockConjugateRussian]) {
        UITextView *ourView = (UITextView *)contentView;
        if (ourView.text.length > 0) {
            return;
        }

        
        [IndianHardView exactPenBatchView:contentView];

        
        NSURL *url = [NSURL URLWithString:napRowDash];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [IndianHardView vendorOneUndoneAdjustedGracefulView:contentView];
                
                if (error || data.length == 0) {
                    
                    ourView.text = PaceDownHue.touchBusyMalay.engineOutputsDisorderEngineZoomingLacrosse;
                    return;
                }
                
                
                NSString *shapeHintCall = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                ourView.text = shapeHintCall ?: PaceDownHue.touchBusyMalay.prototypeBatchThumbUbiquityPreciseBloodPen;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *andHow = (WKWebView *)contentView;
        if (!andHow.isLoading && andHow.estimatedProgress == 1) {
            [IndianHardView vendorOneUndoneAdjustedGracefulView:contentView];
            return;
        }
        [IndianHardView exactPenBatchView:contentView];
        NSString *nowFusion =  [napRowDash.funTurnUndoCityLawMaltese stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:nowFusion];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [andHow loadRequest:request];
    }
}

- (void)fiveCervicalRequireLocalRedVirtual:(id)sender {
    [self cubicPreparingSphericalGujaratiNumbersAction:nil];
    if (self.preferRestingCollectorProfileWelsh) {
        self.preferRestingCollectorProfileWelsh(NO);
    }
}

- (void)modifierBundleExportingPhaseCorrectedDiscarded:(id)sender {
    [self cubicPreparingSphericalGujaratiNumbersAction:nil];
    if (self.preferRestingCollectorProfileWelsh) {
        self.preferRestingCollectorProfileWelsh(YES);
    }
}

- (UIView *)wayTagYearView:(NSString *)string {
    UIView *ejectTapCap = nil;
    if ([[string pathExtension] containsString:PaceDownHue.absoluteAuto.cutterAdoptUnlockConjugateRussian]) {
        UITextView * cleanSaw = [UITextView new];
        cleanSaw.editable = NO;
        cleanSaw.backgroundColor = UIColor.whiteColor;
        cleanSaw.textColor = UIColor.grayColor;
        ejectTapCap = cleanSaw;
    }else {
        WKWebView *splatSexCat = [[WKWebView alloc] initWithFrame:CGRectZero];
        splatSexCat.backgroundColor = UIColor.clearColor;
        splatSexCat.scrollView.backgroundColor = UIColor.lightGrayColor;
        splatSexCat.opaque = YES;
        splatSexCat.scrollView.bounces =NO;
        splatSexCat.scrollView.showsVerticalScrollIndicator = NO;
        splatSexCat.scrollView.showsHorizontalScrollIndicator = NO;
        splatSexCat.navigationDelegate = self;
        ejectTapCap = splatSexCat;
    }
    return ejectTapCap;
}

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

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

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

@end
