






#import "HardNapNetBoldViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+NoiseCrop.h"
#import "NSString+BoxLifetime.h"

@interface HardNapNetBoldViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *clearedThiaminControl;
@property (nonatomic, strong) UIView * changeWorkoutInviteLongitudeKilogram;
@property (nonatomic, strong) UIView * getCloudyExpectingGopherCubic;

@property (nonatomic, strong) UIScrollView * barModifierView;

@end

@implementation HardNapNetBoldViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.smallBayerButton.hidden = YES;
    self.romanGoalButton.hidden = YES;
    
    UISegmentedControl *cautionView = [[UISegmentedControl alloc] initWithItems:@[DidTodayWax.fixEraSafeTaps.equalityWrappingHourUsePrefixedWay,DidTodayWax.fixEraSafeTaps.curveDefinesUploadedFormatFarWorkouts]];
    cautionView.layer.masksToBounds = YES; 
    cautionView.layer.cornerRadius = 2;    
    [cautionView setTitleTextAttributes:@{NSForegroundColorAttributeName:[DidTodayWax mightLeftColor]} forState:UIControlStateSelected];
    [cautionView setTitleTextAttributes:@{NSForegroundColorAttributeName:[DidTodayWax mightLeftColor]} forState:UIControlStateNormal];
    [self.view addSubview:cautionView];
    [cautionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(DidTodayWax.invitePencil.brownYouTen);
    }];
    [cautionView addTarget:self action:@selector(anySubNowHelp:) forControlEvents:UIControlEventValueChanged];
    self.clearedThiaminControl = cautionView;
    
    _barModifierView = [[UIScrollView alloc]init];
    _barModifierView.pagingEnabled = YES;
    _barModifierView.delegate = self;
    [self.view addSubview:_barModifierView];
    [_barModifierView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(DidTodayWax.invitePencil.peakHoursYou);
        make.right.equalTo(self.view).offset(-DidTodayWax.invitePencil.peakHoursYou);
        make.top.equalTo(self.view).offset(DidTodayWax.invitePencil.typeMandarin);
        make.bottom.equalTo(self.view).offset(-DidTodayWax.invitePencil.farsiSunHash);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.barModifierView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.barModifierView);
        make.height.equalTo(_barModifierView);
    }];
    
    UIView * panAspectMen = [self feetTooSumView:[DidTodayWax cleanHavePotentialRotorFollow]];
    [containerView addSubview:panAspectMen];
    [panAspectMen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.barModifierView);
    }];
    self.changeWorkoutInviteLongitudeKilogram = panAspectMen;
    
    UIView * daysHisDelta = [self feetTooSumView:[DidTodayWax penTamilHerMattingPromise]];
    [containerView addSubview:daysHisDelta];
    [daysHisDelta mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(panAspectMen.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.barModifierView);
    }];
    self.getCloudyExpectingGopherCubic = daysHisDelta;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(daysHisDelta.mas_right);
    }];
    
    if (![self.treeStretch boolValue]) {
        UIButton *overlayButton = [DidTodayWax rejectShiftInvitedObserverRectifiedColor:DidTodayWax.fixEraSafeTaps.boostNetRank];
        [overlayButton setBackgroundImage:[UIImage hitLoopLoopCupColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [overlayButton addTarget:self action:@selector(filteredPassTransformOurCutFix:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:overlayButton];
        [overlayButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-DidTodayWax.invitePencil.artThinCost);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(DidTodayWax.invitePencil.forbiddenTab);
        }];
    }
    
    UIButton *fatTapsButton =  [DidTodayWax rejectShiftInvitedObserverRectifiedColor:DidTodayWax.fixEraSafeTaps.pullFitOld];
    [fatTapsButton addTarget:self action:@selector(declinedThiaminResourcesCombinedExporterGravity:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:fatTapsButton];
    [fatTapsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-DidTodayWax.invitePencil.artThinCost);
        make.centerX.equalTo(self.view).multipliedBy(![self.treeStretch boolValue]?1.35:1);
        make.height.mas_equalTo(DidTodayWax.invitePencil.forbiddenTab);
    }];
    
    cautionView.selectedSegmentIndex = 0;
    [self anySubNowHelp:cautionView];
}

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

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

- (void)tokenAdjectiveAscendingRelatedDingbatsText:(NSInteger)type {
    NSString *sliceFloor = nil;
    UIView *contentView = nil;
    sliceFloor = type == 0 ? [DidTodayWax cleanHavePotentialRotorFollow]:[DidTodayWax penTamilHerMattingPromise];
    contentView = type == 0 ? self.changeWorkoutInviteLongitudeKilogram:self.getCloudyExpectingGopherCubic;
    
    if (sliceFloor.interNextBin) {
        return;
    }
    
    if ([[sliceFloor pathExtension] containsString:DidTodayWax.invitePencil.limitedIntrinsicDolbyAllocateCatalyst]) {
        UITextView *sixView = (UITextView *)contentView;
        if (sixView.text.length > 0) {
            return;
        }

        
        [StoodStyleView lemmaEmailDryView:contentView];

        
        NSURL *url = [NSURL URLWithString:sliceFloor];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [StoodStyleView completedGeometryBoyfriendNoticeMinimalView:contentView];
                
                if (error || data.length == 0) {
                    
                    sixView.text = DidTodayWax.fixEraSafeTaps.smoothModeProtocolGolfPriorityThird;
                    return;
                }
                
                
                NSString *didRemovalSix = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                sixView.text = didRemovalSix ?: DidTodayWax.fixEraSafeTaps.renewedFlagHalfStructureRecycleLambdaWaist;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *carIll = (WKWebView *)contentView;
        if (!carIll.isLoading && carIll.estimatedProgress == 1) {
            [StoodStyleView completedGeometryBoyfriendNoticeMinimalView:contentView];
            return;
        }
        [StoodStyleView lemmaEmailDryView:contentView];
        NSString *callSlant =  [sliceFloor.usageBackwardFoggySurfaceSelectorsRegister stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:callSlant];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [carIll loadRequest:request];
    }
}

- (void)filteredPassTransformOurCutFix:(id)sender {
    [self cadencePrincipalFaceReachableRoleAction:nil];
    if (self.printableSpaceSixFrequencyOut) {
        self.printableSpaceSixFrequencyOut(NO);
    }
}

- (void)declinedThiaminResourcesCombinedExporterGravity:(id)sender {
    [self cadencePrincipalFaceReachableRoleAction:nil];
    if (self.printableSpaceSixFrequencyOut) {
        self.printableSpaceSixFrequencyOut(YES);
    }
}

- (UIView *)feetTooSumView:(NSString *)string {
    UIView *receiptRank = nil;
    if ([[string pathExtension] containsString:DidTodayWax.invitePencil.limitedIntrinsicDolbyAllocateCatalyst]) {
        UITextView * busFocus = [UITextView new];
        busFocus.editable = NO;
        busFocus.backgroundColor = UIColor.whiteColor;
        busFocus.textColor = UIColor.grayColor;
        receiptRank = busFocus;
    }else {
        WKWebView *yetShareOne = [[WKWebView alloc] initWithFrame:CGRectZero];
        yetShareOne.backgroundColor = UIColor.clearColor;
        yetShareOne.scrollView.backgroundColor = UIColor.lightGrayColor;
        yetShareOne.opaque = YES;
        yetShareOne.scrollView.bounces =NO;
        yetShareOne.scrollView.showsVerticalScrollIndicator = NO;
        yetShareOne.scrollView.showsHorizontalScrollIndicator = NO;
        yetShareOne.navigationDelegate = self;
        receiptRank = yetShareOne;
    }
    return receiptRank;
}

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

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

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

@end
