






#import "InfoSexCellOneViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+OddArmpit.h"
#import "NSString+MakeRowNext.h"

@interface InfoSexCellOneViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *moireScheduledControl;
@property (nonatomic, strong) UIView * cancelingSonCoastMeterTremor;
@property (nonatomic, strong) UIView * sheLambdaOddDaysProposal;

@property (nonatomic, strong) UIScrollView * sonHindiLowView;

@end

@implementation InfoSexCellOneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.coverStandButton.hidden = YES;
    self.eggSignerButton.hidden = YES;
    
    UISegmentedControl *kannadaView = [[UISegmentedControl alloc] initWithItems:@[BinFaxEight.signRoomModify.bothSameGoldenBarDisorderUrgent,BinFaxEight.signRoomModify.stepchildHisYahooThumbnailSlantSelenium]];
    kannadaView.layer.masksToBounds = YES; 
    kannadaView.layer.cornerRadius = 2;    
    [kannadaView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BinFaxEight indentJobColor]} forState:UIControlStateSelected];
    [kannadaView setTitleTextAttributes:@{NSForegroundColorAttributeName:[BinFaxEight indentJobColor]} forState:UIControlStateNormal];
    [self.view addSubview:kannadaView];
    [kannadaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(BinFaxEight.icyAboutDrum.firstVortex);
    }];
    [kannadaView addTarget:self action:@selector(icyBringCaret:) forControlEvents:UIControlEventValueChanged];
    self.moireScheduledControl = kannadaView;
    
    _sonHindiLowView = [[UIScrollView alloc]init];
    _sonHindiLowView.pagingEnabled = YES;
    _sonHindiLowView.delegate = self;
    [self.view addSubview:_sonHindiLowView];
    [_sonHindiLowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(BinFaxEight.icyAboutDrum.vitalCubeFix);
        make.right.equalTo(self.view).offset(-BinFaxEight.icyAboutDrum.vitalCubeFix);
        make.top.equalTo(self.view).offset(BinFaxEight.icyAboutDrum.wrongOurWeek);
        make.bottom.equalTo(self.view).offset(-BinFaxEight.icyAboutDrum.burnBoxPhoto);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.sonHindiLowView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.sonHindiLowView);
        make.height.equalTo(_sonHindiLowView);
    }];
    
    UIView * cloudOneWide = [self unsafeWrapView:[BinFaxEight markAddressesWritingTagalogWarn]];
    [containerView addSubview:cloudOneWide];
    [cloudOneWide mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.sonHindiLowView);
    }];
    self.cancelingSonCoastMeterTremor = cloudOneWide;
    
    UIView * flowJouleMen = [self unsafeWrapView:[BinFaxEight labelYouTopCutCat]];
    [containerView addSubview:flowJouleMen];
    [flowJouleMen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(cloudOneWide.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.sonHindiLowView);
    }];
    self.sheLambdaOddDaysProposal = flowJouleMen;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(flowJouleMen.mas_right);
    }];
    
    if (![self.givenBarRet boolValue]) {
        UIButton *sonYearButton = [BinFaxEight ratingsIndigoNumeratorRenameBrokenColor:BinFaxEight.signRoomModify.hueRevealMen];
        [sonYearButton setBackgroundImage:[UIImage menHitFoggyGetColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [sonYearButton addTarget:self action:@selector(initiallyDecryptSixteenHeartbeatBarsAddition:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:sonYearButton];
        
        [sonYearButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-BinFaxEight.icyAboutDrum.maxSentinel);
            make.left.equalTo(self.view).offset(BinFaxEight.icyAboutDrum.vitalCubeFix);
            make.right.equalTo(self.view.mas_centerX).offset(-BinFaxEight.icyAboutDrum.howShakeSix);
            make.height.mas_equalTo(BinFaxEight.icyAboutDrum.recycleToken);
        }];
    }

    UIButton *sessionButton =  [BinFaxEight ratingsIndigoNumeratorRenameBrokenColor:BinFaxEight.signRoomModify.growRetain];
    [sessionButton addTarget:self action:@selector(paymentsClockNowNeverAreEach:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:sessionButton];
    BOOL auditButton = ![self.givenBarRet boolValue];
    [sessionButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-BinFaxEight.icyAboutDrum.maxSentinel);
        make.right.equalTo(self.view).offset(-BinFaxEight.icyAboutDrum.vitalCubeFix);
        
        if (auditButton) {
            make.left.equalTo(self.view.mas_centerX).offset(BinFaxEight.icyAboutDrum.howShakeSix);
        } else {
            make.left.equalTo(self.view).offset(BinFaxEight.icyAboutDrum.vitalCubeFix);
        }
        make.height.mas_equalTo(BinFaxEight.icyAboutDrum.recycleToken);
    }];
    
    kannadaView.selectedSegmentIndex = 0;
    [self icyBringCaret:kannadaView];
}

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

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

- (void)safeBusShotClinicalWidgetText:(NSInteger)type {
    NSString *needHockey = nil;
    UIView *contentView = nil;
    needHockey = type == 0 ? [BinFaxEight markAddressesWritingTagalogWarn]:[BinFaxEight labelYouTopCutCat];
    contentView = type == 0 ? self.cancelingSonCoastMeterTremor:self.sheLambdaOddDaysProposal;
    
    if (needHockey.funExclusive) {
        return;
    }
    
    if ([[needHockey pathExtension] containsString:BinFaxEight.icyAboutDrum.digitizedTibetanReadyActiveChain]) {
        UITextView *rawView = (UITextView *)contentView;
        if (rawView.text.length > 0) {
            return;
        }

        
        [DoneBasqueView lowSayPopSeedView:contentView];

        
        NSURL *url = [NSURL URLWithString:needHockey];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [DoneBasqueView utteranceOpticalResourceAllergyHiddenView:contentView];
                
                if (error || data.length == 0) {
                    
                    rawView.text = BinFaxEight.signRoomModify.deliveredSettingSphericalOptionalGramCircular;
                    return;
                }
                
                
                NSString *copyrightIdle = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                rawView.text = copyrightIdle ?: BinFaxEight.signRoomModify.insertedStiffnessTipScalePrimariesMusicWay;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *dublin = (WKWebView *)contentView;
        if (!dublin.isLoading && dublin.estimatedProgress == 1) {
            [DoneBasqueView utteranceOpticalResourceAllergyHiddenView:contentView];
            return;
        }
        [DoneBasqueView lowSayPopSeedView:contentView];
        NSString *moduleOdd =  [needHockey.megawattsRenderedBedEnclosingYardCancel stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:moduleOdd];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [dublin loadRequest:request];
    }
}

- (void)initiallyDecryptSixteenHeartbeatBarsAddition:(id)sender {
    [self telephotoImperialSubgroupsShortcutsArtsAction:nil];
    if (self.suffixTowerFunctionsSpineCoalesce) {
        self.suffixTowerFunctionsSpineCoalesce(NO);
    }
}

- (void)paymentsClockNowNeverAreEach:(id)sender {
    [self telephotoImperialSubgroupsShortcutsArtsAction:nil];
    if (self.suffixTowerFunctionsSpineCoalesce) {
        self.suffixTowerFunctionsSpineCoalesce(YES);
    }
}

- (UIView *)unsafeWrapView:(NSString *)string {
    UIView *capsLoopAir = nil;
    if ([[string pathExtension] containsString:BinFaxEight.icyAboutDrum.digitizedTibetanReadyActiveChain]) {
        UITextView * vowelHis = [UITextView new];
        vowelHis.editable = NO;
        vowelHis.backgroundColor = UIColor.whiteColor;
        vowelHis.textColor = UIColor.grayColor;
        capsLoopAir = vowelHis;
    }else {
        WKWebView *penAssembly = [[WKWebView alloc] initWithFrame:CGRectZero];
        penAssembly.backgroundColor = UIColor.clearColor;
        penAssembly.scrollView.backgroundColor = UIColor.lightGrayColor;
        penAssembly.opaque = YES;
        penAssembly.scrollView.bounces =NO;
        penAssembly.scrollView.showsVerticalScrollIndicator = NO;
        penAssembly.scrollView.showsHorizontalScrollIndicator = NO;
        penAssembly.navigationDelegate = self;
        capsLoopAir = penAssembly;
    }
    return capsLoopAir;
}

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

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

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

@end
