






#import "ReceivesVolumeViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+BeaconWax.h"
#import "NSString+KitLossBlob.h"

@interface ReceivesVolumeViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *tradPipeSubMayControl;
@property (nonatomic, strong) UIView * personalTailNormalizeCollapsesCrop;
@property (nonatomic, strong) UIView * noticeIgnoreDescenderTabFit;

@property (nonatomic, strong) UIScrollView * farDidStripView;

@end

@implementation ReceivesVolumeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.herClampedButton.hidden = YES;
    self.funnelDidButton.hidden = YES;
    
    UISegmentedControl *airMindView = [[UISegmentedControl alloc] initWithItems:@[MaskTheGray.starHealthHome.reservedOutputSeparatorOriginExistVisited,MaskTheGray.starHealthHome.warpConnectedIllDepthBandSemantics]];
    airMindView.layer.masksToBounds = YES; 
    airMindView.layer.cornerRadius = 2;    
    [airMindView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MaskTheGray screenNapColor]} forState:UIControlStateSelected];
    [airMindView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MaskTheGray screenNapColor]} forState:UIControlStateNormal];
    [self.view addSubview:airMindView];
    [airMindView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(MaskTheGray.andRomanPath.curveDryTab);
    }];
    [airMindView addTarget:self action:@selector(joinToolBatch:) forControlEvents:UIControlEventValueChanged];
    self.tradPipeSubMayControl = airMindView;
    
    _farDidStripView = [[UIScrollView alloc]init];
    _farDidStripView.pagingEnabled = YES;
    _farDidStripView.delegate = self;
    [self.view addSubview:_farDidStripView];
    [_farDidStripView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(MaskTheGray.andRomanPath.moodWeighted);
        make.right.equalTo(self.view).offset(-MaskTheGray.andRomanPath.moodWeighted);
        make.top.equalTo(self.view).offset(MaskTheGray.andRomanPath.nonceMileEgg);
        make.bottom.equalTo(self.view).offset(-MaskTheGray.andRomanPath.capsWrappers);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.farDidStripView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.farDidStripView);
        make.height.equalTo(_farDidStripView);
    }];
    
    UIView * malayForRank = [self needLowPenView:[MaskTheGray insertedLooperSpringSigmaPort]];
    [containerView addSubview:malayForRank];
    [malayForRank mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.farDidStripView);
    }];
    self.personalTailNormalizeCollapsesCrop = malayForRank;
    
    UIView * burnBurstTen = [self needLowPenView:[MaskTheGray armLengthsAddressGlyphHigh]];
    [containerView addSubview:burnBurstTen];
    [burnBurstTen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(malayForRank.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.farDidStripView);
    }];
    self.noticeIgnoreDescenderTabFit = burnBurstTen;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(burnBurstTen.mas_right);
    }];
    
    if (![self.beaconPolar boolValue]) {
        UIButton *mastersButton = [MaskTheGray commonLibraryGivenHisEitherColor:MaskTheGray.starHealthHome.panoramaFont];
        [mastersButton setBackgroundImage:[UIImage extraRebusPushColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [mastersButton addTarget:self action:@selector(longerMindWireGigabytesAccessorySoft:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:mastersButton];
        
        [mastersButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-MaskTheGray.andRomanPath.leftNominal);
            make.left.equalTo(self.view).offset(MaskTheGray.andRomanPath.moodWeighted);
            make.right.equalTo(self.view.mas_centerX).offset(-MaskTheGray.andRomanPath.funkOverMen);
            make.height.mas_equalTo(MaskTheGray.andRomanPath.arrayLargest);
        }];
    }

    UIButton *oddHomeButton =  [MaskTheGray commonLibraryGivenHisEitherColor:MaskTheGray.starHealthHome.canonSpeak];
    [oddHomeButton addTarget:self action:@selector(valueDocumentSubJobSubsetArm:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:oddHomeButton];
    BOOL bringButton = ![self.beaconPolar boolValue];
    [oddHomeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-MaskTheGray.andRomanPath.leftNominal);
        make.right.equalTo(self.view).offset(-MaskTheGray.andRomanPath.moodWeighted);
        
        if (bringButton) {
            make.left.equalTo(self.view.mas_centerX).offset(MaskTheGray.andRomanPath.funkOverMen);
        } else {
            make.left.equalTo(self.view).offset(MaskTheGray.andRomanPath.moodWeighted);
        }
        make.height.mas_equalTo(MaskTheGray.andRomanPath.arrayLargest);
    }];
    
    airMindView.selectedSegmentIndex = 0;
    [self joinToolBatch:airMindView];
}

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

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

- (void)expectingCountedOvulationMinuteAverageText:(NSInteger)type {
    NSString *freeCharge = nil;
    UIView *contentView = nil;
    freeCharge = type == 0 ? [MaskTheGray insertedLooperSpringSigmaPort]:[MaskTheGray armLengthsAddressGlyphHigh];
    contentView = type == 0 ? self.personalTailNormalizeCollapsesCrop:self.noticeIgnoreDescenderTabFit;
    
    if (freeCharge.resolvedBlue) {
        return;
    }
    
    if ([[freeCharge pathExtension] containsString:MaskTheGray.andRomanPath.activatedQuoteIssuerNowShortcut]) {
        UITextView *fixView = (UITextView *)contentView;
        if (fixView.text.length > 0) {
            return;
        }

        
        [EchoEggBitView hashRainStandView:contentView];

        
        NSURL *url = [NSURL URLWithString:freeCharge];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [EchoEggBitView deepLaunchedCardExtraInputView:contentView];
                
                if (error || data.length == 0) {
                    
                    fixView.text = MaskTheGray.starHealthHome.boostWrapMeterOverwriteBarsHue;
                    return;
                }
                
                
                NSString *existSpeakLaw = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                fixView.text = existSpeakLaw ?: MaskTheGray.starHealthHome.areLinkagePanFurlongsWetStringAsk;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *pencil = (WKWebView *)contentView;
        if (!pencil.isLoading && pencil.estimatedProgress == 1) {
            [EchoEggBitView deepLaunchedCardExtraInputView:contentView];
            return;
        }
        [EchoEggBitView hashRainStandView:contentView];
        NSString *longerBar =  [freeCharge.hintAnySquaredElapsedWasVowel stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:longerBar];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [pencil loadRequest:request];
    }
}

- (void)longerMindWireGigabytesAccessorySoft:(id)sender {
    [self portraitsGetTurkmenParagraphMatrixAction:nil];
    if (self.sectionIncomingRussianTagGet) {
        self.sectionIncomingRussianTagGet(NO);
    }
}

- (void)valueDocumentSubJobSubsetArm:(id)sender {
    [self portraitsGetTurkmenParagraphMatrixAction:nil];
    if (self.sectionIncomingRussianTagGet) {
        self.sectionIncomingRussianTagGet(YES);
    }
}

- (UIView *)needLowPenView:(NSString *)string {
    UIView *flashButBit = nil;
    if ([[string pathExtension] containsString:MaskTheGray.andRomanPath.activatedQuoteIssuerNowShortcut]) {
        UITextView * sobPlane = [UITextView new];
        sobPlane.editable = NO;
        sobPlane.backgroundColor = UIColor.whiteColor;
        sobPlane.textColor = UIColor.grayColor;
        flashButBit = sobPlane;
    }else {
        WKWebView *kinAbsolute = [[WKWebView alloc] initWithFrame:CGRectZero];
        kinAbsolute.backgroundColor = UIColor.clearColor;
        kinAbsolute.scrollView.backgroundColor = UIColor.lightGrayColor;
        kinAbsolute.opaque = YES;
        kinAbsolute.scrollView.bounces =NO;
        kinAbsolute.scrollView.showsVerticalScrollIndicator = NO;
        kinAbsolute.scrollView.showsHorizontalScrollIndicator = NO;
        kinAbsolute.navigationDelegate = self;
        flashButBit = kinAbsolute;
    }
    return flashButBit;
}

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

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

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

@end
