






#import "BagPasteKeySonViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+BitUpload.h"
#import "NSString+AuthorAlert.h"

@interface BagPasteKeySonViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *ourCubicForEarControl;
@property (nonatomic, strong) UIView * simpleContextTrashSheAlternate;
@property (nonatomic, strong) UIView * romanBeginningKoreanSubtitleSum;

@property (nonatomic, strong) UIScrollView * gesturesOwnView;

@end

@implementation BagPasteKeySonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.nowEquallyButton.hidden = YES;
    self.redoHertzButton.hidden = YES;
    
    UISegmentedControl *tagHashView = [[UISegmentedControl alloc] initWithItems:@[FeedSunTied.switchEnvelope.normalizeAssameseAccountUnwrapFileTrademark,FeedSunTied.switchEnvelope.japaneseSnapshotEitherSunDaysCorrupt]];
    tagHashView.layer.masksToBounds = YES; 
    tagHashView.layer.cornerRadius = 2;    
    [tagHashView setTitleTextAttributes:@{NSForegroundColorAttributeName:[FeedSunTied activeBigColor]} forState:UIControlStateSelected];
    [tagHashView setTitleTextAttributes:@{NSForegroundColorAttributeName:[FeedSunTied activeBigColor]} forState:UIControlStateNormal];
    [self.view addSubview:tagHashView];
    [tagHashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(FeedSunTied.rootIntegral.urgentOther);
    }];
    [tagHashView addTarget:self action:@selector(armFitRecycle:) forControlEvents:UIControlEventValueChanged];
    self.ourCubicForEarControl = tagHashView;
    
    _gesturesOwnView = [[UIScrollView alloc]init];
    _gesturesOwnView.pagingEnabled = YES;
    _gesturesOwnView.delegate = self;
    [self.view addSubview:_gesturesOwnView];
    [_gesturesOwnView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(FeedSunTied.rootIntegral.indexingDisk);
        make.right.equalTo(self.view).offset(-FeedSunTied.rootIntegral.indexingDisk);
        make.top.equalTo(self.view).offset(FeedSunTied.rootIntegral.legalDecimal);
        make.bottom.equalTo(self.view).offset(-FeedSunTied.rootIntegral.anyModalSkip);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.gesturesOwnView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.gesturesOwnView);
        make.height.equalTo(_gesturesOwnView);
    }];
    
    UIView * routeYearYou = [self sunCombineView:[FeedSunTied activeFlightSequencesReliableOutcome]];
    [containerView addSubview:routeYearYou];
    [routeYearYou mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.gesturesOwnView);
    }];
    self.simpleContextTrashSheAlternate = routeYearYou;
    
    UIView * traveledOver = [self sunCombineView:[FeedSunTied bitSunDetectedZoomMacintosh]];
    [containerView addSubview:traveledOver];
    [traveledOver mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(routeYearYou.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.gesturesOwnView);
    }];
    self.romanBeginningKoreanSubtitleSum = traveledOver;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(traveledOver.mas_right);
    }];
    
    if (![self.feedFairArm boolValue]) {
        UIButton *popMustButton = [FeedSunTied edgeSlideMidDeciliterIndentColor:FeedSunTied.switchEnvelope.tailExemplar];
        [popMustButton setBackgroundImage:[UIImage cutoffTeamHintColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [popMustButton addTarget:self action:@selector(scrollsObserveInterestReturnedInitiatedFilter:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:popMustButton];
        [popMustButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-FeedSunTied.rootIntegral.lastDismiss);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(FeedSunTied.rootIntegral.escapeStatic);
        }];
    }
    
    UIButton *spaCityButton =  [FeedSunTied edgeSlideMidDeciliterIndentColor:FeedSunTied.switchEnvelope.lessEggCar];
    [spaCityButton addTarget:self action:@selector(eyeDiscoveryRespondsDeferringAllocatedStep:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:spaCityButton];
    [spaCityButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-FeedSunTied.rootIntegral.lastDismiss);
        make.centerX.equalTo(self.view).multipliedBy(![self.feedFairArm boolValue]?1.35:1);
        make.height.mas_equalTo(FeedSunTied.rootIntegral.escapeStatic);
    }];
    
    tagHashView.selectedSegmentIndex = 0;
    [self armFitRecycle:tagHashView];
}

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

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

- (void)forwardsIndexesInuitManagedAreText:(NSInteger)type {
    NSString *spaceInput = nil;
    UIView *contentView = nil;
    spaceInput = type == 0 ? [FeedSunTied activeFlightSequencesReliableOutcome]:[FeedSunTied bitSunDetectedZoomMacintosh];
    contentView = type == 0 ? self.simpleContextTrashSheAlternate:self.romanBeginningKoreanSubtitleSum;
    
    if (spaceInput.diphthongEye) {
        return;
    }
    
    if ([[spaceInput pathExtension] containsString:FeedSunTied.rootIntegral.beginningFloorFreestyleReplacedDialog]) {
        UITextView *farView = (UITextView *)contentView;
        if (farView.text.length > 0) {
            return;
        }

        
        [CutSubjectView flashLeaseMaxView:contentView];

        
        NSURL *url = [NSURL URLWithString:spaceInput];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [CutSubjectView samplingAttitudeSpineFatRowView:contentView];
                
                if (error || data.length == 0) {
                    
                    farView.text = FeedSunTied.switchEnvelope.beforeEarDependingAdvisedBinRight;
                    return;
                }
                
                
                NSString *hashMakerRate = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                farView.text = hashMakerRate ?: FeedSunTied.switchEnvelope.positiveFullMixerBarInlandSlowGet;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *bigZip = (WKWebView *)contentView;
        if (!bigZip.isLoading && bigZip.estimatedProgress == 1) {
            [CutSubjectView samplingAttitudeSpineFatRowView:contentView];
            return;
        }
        [CutSubjectView flashLeaseMaxView:contentView];
        NSString *capWindow =  [spaceInput.downTransportMeteringRightEllipseWatery stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:capWindow];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [bigZip loadRequest:request];
    }
}

- (void)scrollsObserveInterestReturnedInitiatedFilter:(id)sender {
    [self treeGetAlienMantissaPairAction:nil];
    if (self.sourcesLiftPrimaryPushPub) {
        self.sourcesLiftPrimaryPushPub(NO);
    }
}

- (void)eyeDiscoveryRespondsDeferringAllocatedStep:(id)sender {
    [self treeGetAlienMantissaPairAction:nil];
    if (self.sourcesLiftPrimaryPushPub) {
        self.sourcesLiftPrimaryPushPub(YES);
    }
}

- (UIView *)sunCombineView:(NSString *)string {
    UIView *thousandFor = nil;
    if ([[string pathExtension] containsString:FeedSunTied.rootIntegral.beginningFloorFreestyleReplacedDialog]) {
        UITextView * echoLike = [UITextView new];
        echoLike.editable = NO;
        echoLike.backgroundColor = UIColor.whiteColor;
        echoLike.textColor = UIColor.grayColor;
        thousandFor = echoLike;
    }else {
        WKWebView *stoodPutSub = [[WKWebView alloc] initWithFrame:CGRectZero];
        stoodPutSub.backgroundColor = UIColor.clearColor;
        stoodPutSub.scrollView.backgroundColor = UIColor.lightGrayColor;
        stoodPutSub.opaque = YES;
        stoodPutSub.scrollView.bounces =NO;
        stoodPutSub.scrollView.showsVerticalScrollIndicator = NO;
        stoodPutSub.scrollView.showsHorizontalScrollIndicator = NO;
        stoodPutSub.navigationDelegate = self;
        thousandFor = stoodPutSub;
    }
    return thousandFor;
}

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

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

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

@end
