






#import "AboveIdenticalViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+ReplyMill.h"
#import "NSString+AirPoloStay.h"

@interface AboveIdenticalViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *displayCyclingControl;
@property (nonatomic, strong) UIView * folderCousinActivatedStakeRegister;
@property (nonatomic, strong) UIView * licenseTaggerHandledFactoriesUsed;

@property (nonatomic, strong) UIScrollView * growGaspOutView;

@end

@implementation AboveIdenticalViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.halfWayPopButton.hidden = YES;
    self.itsReaderButton.hidden = YES;
    
    UISegmentedControl *gallonsView = [[UISegmentedControl alloc] initWithItems:@[ZipRestThat.useCatAliveLow.extendEncodeDependingNormalHectaresGallons,ZipRestThat.useCatAliveLow.spacingSentDisposeMonotonicMenBars]];
    gallonsView.layer.masksToBounds = YES; 
    gallonsView.layer.cornerRadius = 2;    
    [gallonsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[ZipRestThat focalFadeColor]} forState:UIControlStateSelected];
    [gallonsView setTitleTextAttributes:@{NSForegroundColorAttributeName:[ZipRestThat focalFadeColor]} forState:UIControlStateNormal];
    [self.view addSubview:gallonsView];
    [gallonsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(ZipRestThat.heartHowLead.askDetector);
    }];
    [gallonsView addTarget:self action:@selector(occlusionHint:) forControlEvents:UIControlEventValueChanged];
    self.displayCyclingControl = gallonsView;
    
    _growGaspOutView = [[UIScrollView alloc]init];
    _growGaspOutView.pagingEnabled = YES;
    _growGaspOutView.delegate = self;
    [self.view addSubview:_growGaspOutView];
    [_growGaspOutView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(ZipRestThat.heartHowLead.queueZeroOld);
        make.right.equalTo(self.view).offset(-ZipRestThat.heartHowLead.queueZeroOld);
        make.top.equalTo(self.view).offset(ZipRestThat.heartHowLead.derivedTower);
        make.bottom.equalTo(self.view).offset(-ZipRestThat.heartHowLead.caffeineLead);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.growGaspOutView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.growGaspOutView);
        make.height.equalTo(_growGaspOutView);
    }];
    
    UIView * thatUseHertz = [self useNowNoteView:[ZipRestThat afterWhiteDownhillLogBorders]];
    [containerView addSubview:thatUseHertz];
    [thatUseHertz mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.growGaspOutView);
    }];
    self.folderCousinActivatedStakeRegister = thatUseHertz;
    
    UIView * loadFarDelay = [self useNowNoteView:[ZipRestThat replacedFitPlusSkinColumn]];
    [containerView addSubview:loadFarDelay];
    [loadFarDelay mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(thatUseHertz.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.growGaspOutView);
    }];
    self.licenseTaggerHandledFactoriesUsed = loadFarDelay;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(loadFarDelay.mas_right);
    }];
    
    if (![self.groupedSink boolValue]) {
        UIButton *descendButton = [ZipRestThat subgroupHigherSharpenRunWeekColor:ZipRestThat.useCatAliveLow.moleCentered];
        [descendButton setBackgroundImage:[UIImage mindLoveSpouseColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [descendButton addTarget:self action:@selector(idiomHitLinkSkipTipOther:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:descendButton];
        [descendButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-ZipRestThat.heartHowLead.sessionCert);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(ZipRestThat.heartHowLead.missingClamp);
        }];
    }
    
    UIButton *nowMoodButton =  [ZipRestThat subgroupHigherSharpenRunWeekColor:ZipRestThat.useCatAliveLow.manUtility];
    [nowMoodButton addTarget:self action:@selector(oddDismissForeverBaseballCommonHover:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:nowMoodButton];
    [nowMoodButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-ZipRestThat.heartHowLead.sessionCert);
        make.centerX.equalTo(self.view).multipliedBy(![self.groupedSink boolValue]?1.35:1);
        make.height.mas_equalTo(ZipRestThat.heartHowLead.missingClamp);
    }];
    
    gallonsView.selectedSegmentIndex = 0;
    [self occlusionHint:gallonsView];
}

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

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

- (void)socialSindhiSexPoliciesAllText:(NSInteger)type {
    NSString *applyPlane = nil;
    UIView *contentView = nil;
    applyPlane = type == 0 ? [ZipRestThat afterWhiteDownhillLogBorders]:[ZipRestThat replacedFitPlusSkinColumn];
    contentView = type == 0 ? self.folderCousinActivatedStakeRegister:self.licenseTaggerHandledFactoriesUsed;
    
    if (applyPlane.howChargeRet) {
        return;
    }
    
    if ([[applyPlane pathExtension] containsString:ZipRestThat.heartHowLead.inferDarkenTenSensePart]) {
        UITextView *sonView = (UITextView *)contentView;
        if (sonView.text.length > 0) {
            return;
        }

        
        [PlayKernelView millFlatUnifyView:contentView];

        
        NSURL *url = [NSURL URLWithString:applyPlane];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [PlayKernelView datumDarkerOverlapWhoBridgeView:contentView];
                
                if (error || data.length == 0) {
                    
                    sonView.text = ZipRestThat.useCatAliveLow.reverseAddImpliedPasswordContextScore;
                    return;
                }
                
                
                NSString *dependentHigh = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                sonView.text = dependentHigh ?: ZipRestThat.useCatAliveLow.importantComplexEnteredDaughterOurDecigramsDefault;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *spoken = (WKWebView *)contentView;
        if (!spoken.isLoading && spoken.estimatedProgress == 1) {
            [PlayKernelView datumDarkerOverlapWhoBridgeView:contentView];
            return;
        }
        [PlayKernelView millFlatUnifyView:contentView];
        NSString *fixingCat =  [applyPlane.readerPanelGetEmbeddingVisualIterative stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:fixingCat];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [spoken loadRequest:request];
    }
}

- (void)idiomHitLinkSkipTipOther:(id)sender {
    [self successWeekdayIncludingPopPeriodicAction:nil];
    if (self.hierarchyDetailsRuleEarlyForbid) {
        self.hierarchyDetailsRuleEarlyForbid(NO);
    }
}

- (void)oddDismissForeverBaseballCommonHover:(id)sender {
    [self successWeekdayIncludingPopPeriodicAction:nil];
    if (self.hierarchyDetailsRuleEarlyForbid) {
        self.hierarchyDetailsRuleEarlyForbid(YES);
    }
}

- (UIView *)useNowNoteView:(NSString *)string {
    UIView *manWaxTilde = nil;
    if ([[string pathExtension] containsString:ZipRestThat.heartHowLead.inferDarkenTenSensePart]) {
        UITextView * funSegue = [UITextView new];
        funSegue.editable = NO;
        funSegue.backgroundColor = UIColor.whiteColor;
        funSegue.textColor = UIColor.grayColor;
        manWaxTilde = funSegue;
    }else {
        WKWebView *supplyModel = [[WKWebView alloc] initWithFrame:CGRectZero];
        supplyModel.backgroundColor = UIColor.clearColor;
        supplyModel.scrollView.backgroundColor = UIColor.lightGrayColor;
        supplyModel.opaque = YES;
        supplyModel.scrollView.bounces =NO;
        supplyModel.scrollView.showsVerticalScrollIndicator = NO;
        supplyModel.scrollView.showsHorizontalScrollIndicator = NO;
        supplyModel.navigationDelegate = self;
        manWaxTilde = supplyModel;
    }
    return manWaxTilde;
}

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

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

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

@end
