






#import "OldWeekNoteSunViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+YellowRet.h"
#import "NSString+UseAlertNot.h"

@interface OldWeekNoteSunViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *secretMealTiedControl;
@property (nonatomic, strong) UIView * usabilityExpiredWasHeadArm;
@property (nonatomic, strong) UIView * predicateNewtonsRetTrainingBatch;

@property (nonatomic, strong) UIScrollView * editZipLazyView;

@end

@implementation OldWeekNoteSunViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.repeatsDogButton.hidden = YES;
    self.stopDrainButton.hidden = YES;
    
    UISegmentedControl *howSlowView = [[UISegmentedControl alloc] initWithItems:@[HourEllipse.alienSemaphore.seasonFarEngineerTagsInferStepper,HourEllipse.alienSemaphore.preventedCutterHealthPriceHeaderRoute]];
    howSlowView.layer.masksToBounds = YES; 
    howSlowView.layer.cornerRadius = 2;    
    [howSlowView setTitleTextAttributes:@{NSForegroundColorAttributeName:[HourEllipse screenKinColor]} forState:UIControlStateSelected];
    [howSlowView setTitleTextAttributes:@{NSForegroundColorAttributeName:[HourEllipse screenKinColor]} forState:UIControlStateNormal];
    [self.view addSubview:howSlowView];
    [howSlowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(HourEllipse.howSignaling.stopUtility);
    }];
    [howSlowView addTarget:self action:@selector(intensityLink:) forControlEvents:UIControlEventValueChanged];
    self.secretMealTiedControl = howSlowView;
    
    _editZipLazyView = [[UIScrollView alloc]init];
    _editZipLazyView.pagingEnabled = YES;
    _editZipLazyView.delegate = self;
    [self.view addSubview:_editZipLazyView];
    [_editZipLazyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(HourEllipse.howSignaling.oneWeekProxy);
        make.right.equalTo(self.view).offset(-HourEllipse.howSignaling.oneWeekProxy);
        make.top.equalTo(self.view).offset(HourEllipse.howSignaling.appearsRebus);
        make.bottom.equalTo(self.view).offset(-HourEllipse.howSignaling.canRunPerson);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.editZipLazyView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.editZipLazyView);
        make.height.equalTo(_editZipLazyView);
    }];
    
    UIView * equalWetTurn = [self binaryMenuView:[HourEllipse promisedMandarinProjectsIndicatedSubtitles]];
    [containerView addSubview:equalWetTurn];
    [equalWetTurn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.editZipLazyView);
    }];
    self.usabilityExpiredWasHeadArm = equalWetTurn;
    
    UIView * coercionReal = [self binaryMenuView:[HourEllipse rarePrimaryEggHashVoice]];
    [containerView addSubview:coercionReal];
    [coercionReal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(equalWetTurn.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.editZipLazyView);
    }];
    self.predicateNewtonsRetTrainingBatch = coercionReal;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(coercionReal.mas_right);
    }];
    
    if (![self.packFlagLaw boolValue]) {
        UIButton *warningButton = [HourEllipse boldfaceNapPhonogramComplexBordersColor:HourEllipse.alienSemaphore.eyeResponses];
        [warningButton setBackgroundImage:[UIImage forkPurpleOpenColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [warningButton addTarget:self action:@selector(mercuryHeadphoneLeaveTooFunkCanceled:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:warningButton];
        [warningButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-HourEllipse.howSignaling.moirePubMid);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(HourEllipse.howSignaling.undoneStereo);
        }];
    }
    
    UIButton *sheWaitButton =  [HourEllipse boldfaceNapPhonogramComplexBordersColor:HourEllipse.alienSemaphore.forLogHard];
    [sheWaitButton addTarget:self action:@selector(executingSlowWetHomepageStepGrade:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:sheWaitButton];
    [sheWaitButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-HourEllipse.howSignaling.moirePubMid);
        make.centerX.equalTo(self.view).multipliedBy(![self.packFlagLaw boolValue]?1.35:1);
        make.height.mas_equalTo(HourEllipse.howSignaling.undoneStereo);
    }];
    
    howSlowView.selectedSegmentIndex = 0;
    [self intensityLink:howSlowView];
}

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

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

- (void)blockHelpEnergyTagWonText:(NSInteger)type {
    NSString *roomWaxAnd = nil;
    UIView *contentView = nil;
    roomWaxAnd = type == 0 ? [HourEllipse promisedMandarinProjectsIndicatedSubtitles]:[HourEllipse rarePrimaryEggHashVoice];
    contentView = type == 0 ? self.usabilityExpiredWasHeadArm:self.predicateNewtonsRetTrainingBatch;
    
    if (roomWaxAnd.canEveryBond) {
        return;
    }
    
    if ([[roomWaxAnd pathExtension] containsString:HourEllipse.howSignaling.sourceOcclusionDisallowEncipherFormatted]) {
        UITextView *askView = (UITextView *)contentView;
        if (askView.text.length > 0) {
            return;
        }

        
        [LogicalSonView sleepInstallsView:contentView];

        
        NSURL *url = [NSURL URLWithString:roomWaxAnd];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [LogicalSonView dailyAddSenseProcessesFormView:contentView];
                
                if (error || data.length == 0) {
                    
                    askView.text = HourEllipse.alienSemaphore.hisFrameOverrideDeltaHerRows;
                    return;
                }
                
                
                NSString *unwindOrdinal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                askView.text = unwindOrdinal ?: HourEllipse.alienSemaphore.dependingBasalElevationDefaultOutExitsDifferent;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *review = (WKWebView *)contentView;
        if (!review.isLoading && review.estimatedProgress == 1) {
            [LogicalSonView dailyAddSenseProcessesFormView:contentView];
            return;
        }
        [LogicalSonView sleepInstallsView:contentView];
        NSString *saveBlend =  [roomWaxAnd.motionUnitRejectionTopDashFailing stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:saveBlend];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [review loadRequest:request];
    }
}

- (void)mercuryHeadphoneLeaveTooFunkCanceled:(id)sender {
    [self overwriteWayFocusedProductsLayoutAction:nil];
    if (self.selectorsRequestFarLeadHang) {
        self.selectorsRequestFarLeadHang(NO);
    }
}

- (void)executingSlowWetHomepageStepGrade:(id)sender {
    [self overwriteWayFocusedProductsLayoutAction:nil];
    if (self.selectorsRequestFarLeadHang) {
        self.selectorsRequestFarLeadHang(YES);
    }
}

- (UIView *)binaryMenuView:(NSString *)string {
    UIView *holdAxesAir = nil;
    if ([[string pathExtension] containsString:HourEllipse.howSignaling.sourceOcclusionDisallowEncipherFormatted]) {
        UITextView * pulseBad = [UITextView new];
        pulseBad.editable = NO;
        pulseBad.backgroundColor = UIColor.whiteColor;
        pulseBad.textColor = UIColor.grayColor;
        holdAxesAir = pulseBad;
    }else {
        WKWebView *sobLawClock = [[WKWebView alloc] initWithFrame:CGRectZero];
        sobLawClock.backgroundColor = UIColor.clearColor;
        sobLawClock.scrollView.backgroundColor = UIColor.lightGrayColor;
        sobLawClock.opaque = YES;
        sobLawClock.scrollView.bounces =NO;
        sobLawClock.scrollView.showsVerticalScrollIndicator = NO;
        sobLawClock.scrollView.showsHorizontalScrollIndicator = NO;
        sobLawClock.navigationDelegate = self;
        holdAxesAir = sobLawClock;
    }
    return holdAxesAir;
}

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

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

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

@end
