






#import "DailySerifReadViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+EntityArm.h"
#import "NSString+PeakAskMole.h"

@interface DailySerifReadViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *lifetimeMobileControl;
@property (nonatomic, strong) UIView * vortexButtonsPaperSheWindows;
@property (nonatomic, strong) UIView * midFunkVolumesMarkupTitle;

@property (nonatomic, strong) UIScrollView * basicFinderView;

@end

@implementation DailySerifReadViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.learnMightButton.hidden = YES;
    self.directEyeButton.hidden = YES;
    
    UISegmentedControl *spaFlipView = [[UISegmentedControl alloc] initWithItems:@[ReceivedFor.strokeMoveStep.busRoleSimpleManganeseBookmarksChromatic,ReceivedFor.strokeMoveStep.notifyingUnwrapFarDocumentsContextsFive]];
    spaFlipView.layer.masksToBounds = YES; 
    spaFlipView.layer.cornerRadius = 2;    
    [spaFlipView setTitleTextAttributes:@{NSForegroundColorAttributeName:[ReceivedFor cubicSentColor]} forState:UIControlStateSelected];
    [spaFlipView setTitleTextAttributes:@{NSForegroundColorAttributeName:[ReceivedFor cubicSentColor]} forState:UIControlStateNormal];
    [self.view addSubview:spaFlipView];
    [spaFlipView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(ReceivedFor.dogMagicChar.axesPongYet);
    }];
    [spaFlipView addTarget:self action:@selector(retSceneWhile:) forControlEvents:UIControlEventValueChanged];
    self.lifetimeMobileControl = spaFlipView;
    
    _basicFinderView = [[UIScrollView alloc]init];
    _basicFinderView.pagingEnabled = YES;
    _basicFinderView.delegate = self;
    [self.view addSubview:_basicFinderView];
    [_basicFinderView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(ReceivedFor.dogMagicChar.sinWalkSpeak);
        make.right.equalTo(self.view).offset(-ReceivedFor.dogMagicChar.sinWalkSpeak);
        make.top.equalTo(self.view).offset(ReceivedFor.dogMagicChar.sexLegacyMap);
        make.bottom.equalTo(self.view).offset(-ReceivedFor.dogMagicChar.fourDominant);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.basicFinderView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.basicFinderView);
        make.height.equalTo(_basicFinderView);
    }];
    
    UIView * encryptedBus = [self caseBarAreView:[ReceivedFor disablingTraverseAxialFatalSubgroup]];
    [containerView addSubview:encryptedBus];
    [encryptedBus mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.basicFinderView);
    }];
    self.vortexButtonsPaperSheWindows = encryptedBus;
    
    UIView * candidateCar = [self caseBarAreView:[ReceivedFor measureProvisionSerialFinderSaw]];
    [containerView addSubview:candidateCar];
    [candidateCar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(encryptedBus.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.basicFinderView);
    }];
    self.midFunkVolumesMarkupTitle = candidateCar;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(candidateCar.mas_right);
    }];
    
    if (![self.wasSelfIron boolValue]) {
        UIButton *sectionButton = [ReceivedFor decrementJobTryTabStripColor:ReceivedFor.strokeMoveStep.teamPanelEar];
        [sectionButton setBackgroundImage:[UIImage rareMaleYetFitColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [sectionButton addTarget:self action:@selector(yellowDetachDebuggerTapDominantArtwork:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:sectionButton];
        
        [sectionButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-ReceivedFor.dogMagicChar.earReceives);
            make.left.equalTo(self.view).offset(ReceivedFor.dogMagicChar.sinWalkSpeak);
            make.right.equalTo(self.view.mas_centerX).offset(-ReceivedFor.dogMagicChar.nativeStood);
            make.height.mas_equalTo(ReceivedFor.dogMagicChar.cleanRunAuto);
        }];
    }

    UIButton *kitWakeButton =  [ReceivedFor decrementJobTryTabStripColor:ReceivedFor.strokeMoveStep.ageOffStep];
    [kitWakeButton addTarget:self action:@selector(summaryNegateDisablesPartnerCarbonStreet:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:kitWakeButton];
    BOOL trialButton = ![self.wasSelfIron boolValue];
    [kitWakeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-ReceivedFor.dogMagicChar.earReceives);
        make.right.equalTo(self.view).offset(-ReceivedFor.dogMagicChar.sinWalkSpeak);
        
        if (trialButton) {
            make.left.equalTo(self.view.mas_centerX).offset(ReceivedFor.dogMagicChar.nativeStood);
        } else {
            make.left.equalTo(self.view).offset(ReceivedFor.dogMagicChar.sinWalkSpeak);
        }
        make.height.mas_equalTo(ReceivedFor.dogMagicChar.cleanRunAuto);
    }];
    
    spaFlipView.selectedSegmentIndex = 0;
    [self retSceneWhile:spaFlipView];
}

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

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

- (void)basalPreparedAngularGuideSingleText:(NSInteger)type {
    NSString *offStepper = nil;
    UIView *contentView = nil;
    offStepper = type == 0 ? [ReceivedFor disablingTraverseAxialFatalSubgroup]:[ReceivedFor measureProvisionSerialFinderSaw];
    contentView = type == 0 ? self.vortexButtonsPaperSheWindows:self.midFunkVolumesMarkupTitle;
    
    if (offStepper.pronounClaim) {
        return;
    }
    
    if ([[offStepper pathExtension] containsString:ReceivedFor.dogMagicChar.bottomObtainDryDeviationFrequency]) {
        UITextView *manView = (UITextView *)contentView;
        if (manView.text.length > 0) {
            return;
        }

        
        [UplinkDrawView sexShowersArtView:contentView];

        
        NSURL *url = [NSURL URLWithString:offStepper];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [UplinkDrawView bendGeometricYahooAlgorithmDiastolicView:contentView];
                
                if (error || data.length == 0) {
                    
                    manView.text = ReceivedFor.strokeMoveStep.barDidForeverOverrideLoadCube;
                    return;
                }
                
                
                NSString *tagPingManJob = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                manView.text = tagPingManJob ?: ReceivedFor.strokeMoveStep.malayBypassIntegrityIndicatorEraObtainTop;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *escape = (WKWebView *)contentView;
        if (!escape.isLoading && escape.estimatedProgress == 1) {
            [UplinkDrawView bendGeometricYahooAlgorithmDiastolicView:contentView];
            return;
        }
        [UplinkDrawView sexShowersArtView:contentView];
        NSString *peakTorch =  [offStepper.heapSockLengthsTransferContainsMegabytes stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:peakTorch];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [escape loadRequest:request];
    }
}

- (void)yellowDetachDebuggerTapDominantArtwork:(id)sender {
    [self boxLeapWidthResignTransferAction:nil];
    if (self.andFinishedWaxCalciumTwist) {
        self.andFinishedWaxCalciumTwist(NO);
    }
}

- (void)summaryNegateDisablesPartnerCarbonStreet:(id)sender {
    [self boxLeapWidthResignTransferAction:nil];
    if (self.andFinishedWaxCalciumTwist) {
        self.andFinishedWaxCalciumTwist(YES);
    }
}

- (UIView *)caseBarAreView:(NSString *)string {
    UIView *hostPartBad = nil;
    if ([[string pathExtension] containsString:ReceivedFor.dogMagicChar.bottomObtainDryDeviationFrequency]) {
        UITextView * threaded = [UITextView new];
        threaded.editable = NO;
        threaded.backgroundColor = UIColor.whiteColor;
        threaded.textColor = UIColor.grayColor;
        hostPartBad = threaded;
    }else {
        WKWebView *cancelsHome = [[WKWebView alloc] initWithFrame:CGRectZero];
        cancelsHome.backgroundColor = UIColor.clearColor;
        cancelsHome.scrollView.backgroundColor = UIColor.lightGrayColor;
        cancelsHome.opaque = YES;
        cancelsHome.scrollView.bounces =NO;
        cancelsHome.scrollView.showsVerticalScrollIndicator = NO;
        cancelsHome.scrollView.showsHorizontalScrollIndicator = NO;
        cancelsHome.navigationDelegate = self;
        hostPartBad = cancelsHome;
    }
    return hostPartBad;
}

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

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

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

@end
