






#import "AmountFastPoloViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+NoiseFold.h"
#import "NSString+GracefulCar.h"

@interface AmountFastPoloViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *keepUniqueThatControl;
@property (nonatomic, strong) UIView * compositeLyricistOperatingNowReuse;
@property (nonatomic, strong) UIView * conflictVirtualOuterPendingScrolling;

@property (nonatomic, strong) UIScrollView * popAsteriskView;

@end

@implementation AmountFastPoloViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.sizeMidBigButton.hidden = YES;
    self.receivingButton.hidden = YES;
    
    UISegmentedControl *skipDueView = [[UISegmentedControl alloc] initWithItems:@[AffectedBus.delayOceanMale.binUpperBuildReportingKeepDocument,AffectedBus.delayOceanMale.personSwapLogQuerySwimmingMake]];
    skipDueView.layer.masksToBounds = YES; 
    skipDueView.layer.cornerRadius = 2;    
    [skipDueView setTitleTextAttributes:@{NSForegroundColorAttributeName:[AffectedBus betterWhoColor]} forState:UIControlStateSelected];
    [skipDueView setTitleTextAttributes:@{NSForegroundColorAttributeName:[AffectedBus betterWhoColor]} forState:UIControlStateNormal];
    [self.view addSubview:skipDueView];
    [skipDueView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(AffectedBus.mixProviders.grayCleanup);
    }];
    [skipDueView addTarget:self action:@selector(offOddRestore:) forControlEvents:UIControlEventValueChanged];
    self.keepUniqueThatControl = skipDueView;
    
    _popAsteriskView = [[UIScrollView alloc]init];
    _popAsteriskView.pagingEnabled = YES;
    _popAsteriskView.delegate = self;
    [self.view addSubview:_popAsteriskView];
    [_popAsteriskView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(AffectedBus.mixProviders.dividingSize);
        make.right.equalTo(self.view).offset(-AffectedBus.mixProviders.dividingSize);
        make.top.equalTo(self.view).offset(AffectedBus.mixProviders.moodOptimize);
        make.bottom.equalTo(self.view).offset(-AffectedBus.mixProviders.estimateBlob);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.popAsteriskView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.popAsteriskView);
        make.height.equalTo(_popAsteriskView);
    }];
    
    UIView * waxOverwrite = [self symbolsLowView:[AffectedBus appearingDistantExecutionFactoryRealm]];
    [containerView addSubview:waxOverwrite];
    [waxOverwrite mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.popAsteriskView);
    }];
    self.compositeLyricistOperatingNowReuse = waxOverwrite;
    
    UIView * bitExtraStay = [self symbolsLowView:[AffectedBus countLyricistInteractAloneSound]];
    [containerView addSubview:bitExtraStay];
    [bitExtraStay mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(waxOverwrite.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.popAsteriskView);
    }];
    self.conflictVirtualOuterPendingScrolling = bitExtraStay;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bitExtraStay.mas_right);
    }];
    
    if (![self.undoItemSon boolValue]) {
        UIButton *summaryButton = [AffectedBus lightCollectedQuickSyntheticAssertColor:AffectedBus.delayOceanMale.silencedTone];
        [summaryButton setBackgroundImage:[UIImage multiplyPersonColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [summaryButton addTarget:self action:@selector(kashmiriAssertSobThroughSwedishEscapes:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:summaryButton];
        [summaryButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-AffectedBus.mixProviders.interiorAnd);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(AffectedBus.mixProviders.portLocation);
        }];
    }
    
    UIButton *growTwoButton =  [AffectedBus lightCollectedQuickSyntheticAssertColor:AffectedBus.delayOceanMale.dryFixItem];
    [growTwoButton addTarget:self action:@selector(spanGallonRollDescribesCalculateAdaptor:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:growTwoButton];
    [growTwoButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-AffectedBus.mixProviders.interiorAnd);
        make.centerX.equalTo(self.view).multipliedBy(![self.undoItemSon boolValue]?1.35:1);
        make.height.mas_equalTo(AffectedBus.mixProviders.portLocation);
    }];
    
    skipDueView.selectedSegmentIndex = 0;
    [self offOddRestore:skipDueView];
}

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

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

- (void)sawMalayAutoDetachingAirlineText:(NSInteger)type {
    NSString *artOldRace = nil;
    UIView *contentView = nil;
    artOldRace = type == 0 ? [AffectedBus appearingDistantExecutionFactoryRealm]:[AffectedBus countLyricistInteractAloneSound];
    contentView = type == 0 ? self.compositeLyricistOperatingNowReuse:self.conflictVirtualOuterPendingScrolling;
    
    if (artOldRace.cubeGateways) {
        return;
    }
    
    if ([[artOldRace pathExtension] containsString:AffectedBus.mixProviders.proposedCharSemanticLicenseAddresses]) {
        UITextView *bedView = (UITextView *)contentView;
        if (bedView.text.length > 0) {
            return;
        }

        
        [JobSinHalfView bounceOutcomeView:contentView];

        
        NSURL *url = [NSURL URLWithString:artOldRace];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [JobSinHalfView taggerMarkupNegateWarnWrongView:contentView];
                
                if (error || data.length == 0) {
                    
                    bedView.text = AffectedBus.delayOceanMale.cornersBeaconHectaresIndicesArtMegawatts;
                    return;
                }
                
                
                NSString *execSumSpaSum = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                bedView.text = execSumSpaSum ?: AffectedBus.delayOceanMale.retInsulinLabelSnowDisplaysAdvisoryBack;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *sixSub = (WKWebView *)contentView;
        if (!sixSub.isLoading && sixSub.estimatedProgress == 1) {
            [JobSinHalfView taggerMarkupNegateWarnWrongView:contentView];
            return;
        }
        [JobSinHalfView bounceOutcomeView:contentView];
        NSString *pageCross =  [artOldRace.strongestPaymentsPatientLuminanceUnpluggedIdiom stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:pageCross];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [sixSub loadRequest:request];
    }
}

- (void)kashmiriAssertSobThroughSwedishEscapes:(id)sender {
    [self bufferingPartSoftwareWorkoutWordAction:nil];
    if (self.divideDefinesStylizeSerbianPolish) {
        self.divideDefinesStylizeSerbianPolish(NO);
    }
}

- (void)spanGallonRollDescribesCalculateAdaptor:(id)sender {
    [self bufferingPartSoftwareWorkoutWordAction:nil];
    if (self.divideDefinesStylizeSerbianPolish) {
        self.divideDefinesStylizeSerbianPolish(YES);
    }
}

- (UIView *)symbolsLowView:(NSString *)string {
    UIView *airMakerAnd = nil;
    if ([[string pathExtension] containsString:AffectedBus.mixProviders.proposedCharSemanticLicenseAddresses]) {
        UITextView * cutScale = [UITextView new];
        cutScale.editable = NO;
        cutScale.backgroundColor = UIColor.whiteColor;
        cutScale.textColor = UIColor.grayColor;
        airMakerAnd = cutScale;
    }else {
        WKWebView *sindhiInuit = [[WKWebView alloc] initWithFrame:CGRectZero];
        sindhiInuit.backgroundColor = UIColor.clearColor;
        sindhiInuit.scrollView.backgroundColor = UIColor.lightGrayColor;
        sindhiInuit.opaque = YES;
        sindhiInuit.scrollView.bounces =NO;
        sindhiInuit.scrollView.showsVerticalScrollIndicator = NO;
        sindhiInuit.scrollView.showsHorizontalScrollIndicator = NO;
        sindhiInuit.navigationDelegate = self;
        airMakerAnd = sindhiInuit;
    }
    return airMakerAnd;
}

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

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

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

@end
