






#import "TapGainMoleLogViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+NonceBeen.h"
#import "NSString+WetCaseLost.h"

@interface TapGainMoleLogViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *throughLegibleControl;
@property (nonatomic, strong) UIView * discountsMasterStretchPerformerDeviation;
@property (nonatomic, strong) UIView * headSlantSliceMeterBirthday;

@property (nonatomic, strong) UIScrollView * bitBloodKinView;

@end

@implementation TapGainMoleLogViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.busExtractButton.hidden = YES;
    self.forkChestButton.hidden = YES;
    
    UISegmentedControl *lighterView = [[UISegmentedControl alloc] initWithItems:@[SubBondFour.injectionBlack.movementDecodingWaxSumReclaimIndent,SubBondFour.injectionBlack.eyeResolvingProvisionWideAnotherPredicate]];
    lighterView.layer.masksToBounds = YES; 
    lighterView.layer.cornerRadius = 2;    
    [lighterView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SubBondFour routeHeapColor]} forState:UIControlStateSelected];
    [lighterView setTitleTextAttributes:@{NSForegroundColorAttributeName:[SubBondFour routeHeapColor]} forState:UIControlStateNormal];
    [self.view addSubview:lighterView];
    [lighterView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(SubBondFour.nodeFourteen.sumAddStack);
    }];
    [lighterView addTarget:self action:@selector(magnesiumFact:) forControlEvents:UIControlEventValueChanged];
    self.throughLegibleControl = lighterView;
    
    _bitBloodKinView = [[UIScrollView alloc]init];
    _bitBloodKinView.pagingEnabled = YES;
    _bitBloodKinView.delegate = self;
    [self.view addSubview:_bitBloodKinView];
    [_bitBloodKinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(SubBondFour.nodeFourteen.herQuitTight);
        make.right.equalTo(self.view).offset(-SubBondFour.nodeFourteen.herQuitTight);
        make.top.equalTo(self.view).offset(SubBondFour.nodeFourteen.hitStepAlive);
        make.bottom.equalTo(self.view).offset(-SubBondFour.nodeFourteen.sixNanograms);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.bitBloodKinView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bitBloodKinView);
        make.height.equalTo(_bitBloodKinView);
    }];
    
    UIView * maxAmperePin = [self eggLowMailView:[SubBondFour cubePopInvertedHandoverRotation]];
    [containerView addSubview:maxAmperePin];
    [maxAmperePin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.bitBloodKinView);
    }];
    self.discountsMasterStretchPerformerDeviation = maxAmperePin;
    
    UIView * inferBusSite = [self eggLowMailView:[SubBondFour assemblyStrongOuncesSectionsFurlongs]];
    [containerView addSubview:inferBusSite];
    [inferBusSite mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(maxAmperePin.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.bitBloodKinView);
    }];
    self.headSlantSliceMeterBirthday = inferBusSite;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(inferBusSite.mas_right);
    }];
    
    if (![self.panoramaEra boolValue]) {
        UIButton *topTextButton = [SubBondFour certDateSlovakDisablingTalkColor:SubBondFour.injectionBlack.weeklyUrgent];
        [topTextButton setBackgroundImage:[UIImage advertiseGreekColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [topTextButton addTarget:self action:@selector(mattingOnlyOddMajorCanceledFreezing:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:topTextButton];
        [topTextButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-SubBondFour.nodeFourteen.suchIdleEye);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(SubBondFour.nodeFourteen.makeSliceKey);
        }];
    }
    
    UIButton *replaceButton =  [SubBondFour certDateSlovakDisablingTalkColor:SubBondFour.injectionBlack.binWarnYou];
    [replaceButton addTarget:self action:@selector(officialImmediateTiedGallonInspiredFood:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:replaceButton];
    [replaceButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-SubBondFour.nodeFourteen.suchIdleEye);
        make.centerX.equalTo(self.view).multipliedBy(![self.panoramaEra boolValue]?1.35:1);
        make.height.mas_equalTo(SubBondFour.nodeFourteen.makeSliceKey);
    }];
    
    lighterView.selectedSegmentIndex = 0;
    [self magnesiumFact:lighterView];
}

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

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

- (void)dogUniqueTabCubicMildText:(NSInteger)type {
    NSString *sliceMalay = nil;
    UIView *contentView = nil;
    sliceMalay = type == 0 ? [SubBondFour cubePopInvertedHandoverRotation]:[SubBondFour assemblyStrongOuncesSectionsFurlongs];
    contentView = type == 0 ? self.discountsMasterStretchPerformerDeviation:self.headSlantSliceMeterBirthday;
    
    if (sliceMalay.barOwnership) {
        return;
    }
    
    if ([[sliceMalay pathExtension] containsString:SubBondFour.nodeFourteen.useExecutingConstructFifteenHard]) {
        UITextView *maxView = (UITextView *)contentView;
        if (maxView.text.length > 0) {
            return;
        }

        
        [FitCalorieView irishDenseHueView:contentView];

        
        NSURL *url = [NSURL URLWithString:sliceMalay];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [FitCalorieView greatOriginDenseAnswerIntegersView:contentView];
                
                if (error || data.length == 0) {
                    
                    maxView.text = SubBondFour.injectionBlack.validityAreGreatMovementCircleCar;
                    return;
                }
                
                
                NSString *youTenTrusted = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                maxView.text = youTenTrusted ?: SubBondFour.injectionBlack.schemesLiftMilesProcessedHourDynamicExclusion;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *mapMen = (WKWebView *)contentView;
        if (!mapMen.isLoading && mapMen.estimatedProgress == 1) {
            [FitCalorieView greatOriginDenseAnswerIntegersView:contentView];
            return;
        }
        [FitCalorieView irishDenseHueView:contentView];
        NSString *labelSlab =  [sliceMalay.dailyBandwidthTextRoleApplyMemory stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:labelSlab];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [mapMen loadRequest:request];
    }
}

- (void)mattingOnlyOddMajorCanceledFreezing:(id)sender {
    [self realCoastRepeatsGreekDeriveAction:nil];
    if (self.oneGuaraniCutQuerySoftness) {
        self.oneGuaraniCutQuerySoftness(NO);
    }
}

- (void)officialImmediateTiedGallonInspiredFood:(id)sender {
    [self realCoastRepeatsGreekDeriveAction:nil];
    if (self.oneGuaraniCutQuerySoftness) {
        self.oneGuaraniCutQuerySoftness(YES);
    }
}

- (UIView *)eggLowMailView:(NSString *)string {
    UIView *greekManual = nil;
    if ([[string pathExtension] containsString:SubBondFour.nodeFourteen.useExecutingConstructFifteenHard]) {
        UITextView * moleWake = [UITextView new];
        moleWake.editable = NO;
        moleWake.backgroundColor = UIColor.whiteColor;
        moleWake.textColor = UIColor.grayColor;
        greekManual = moleWake;
    }else {
        WKWebView *mustMusical = [[WKWebView alloc] initWithFrame:CGRectZero];
        mustMusical.backgroundColor = UIColor.clearColor;
        mustMusical.scrollView.backgroundColor = UIColor.lightGrayColor;
        mustMusical.opaque = YES;
        mustMusical.scrollView.bounces =NO;
        mustMusical.scrollView.showsVerticalScrollIndicator = NO;
        mustMusical.scrollView.showsHorizontalScrollIndicator = NO;
        mustMusical.navigationDelegate = self;
        greekManual = mustMusical;
    }
    return greekManual;
}

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

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

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

@end
