






#import "HowMapSumPhoneViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+LessSeven.h"
#import "NSString+MatrixOwner.h"

@interface HowMapSumPhoneViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *tokenSplatLoudControl;
@property (nonatomic, strong) UIView * dashTagLookOwnCall;
@property (nonatomic, strong) UIView * versionLazyInputDayExposures;

@property (nonatomic, strong) UIScrollView * opacityFairView;

@end

@implementation HowMapSumPhoneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.fairTargetButton.hidden = YES;
    self.returnOptButton.hidden = YES;
    
    UISegmentedControl *sentDryView = [[UISegmentedControl alloc] initWithItems:@[AreStateWon.miterTabBitKin.topMealHeartbeatDryRemovesDraft,AreStateWon.miterTabBitKin.vignetteMegahertzFitFrictionArmSoloist]];
    sentDryView.layer.masksToBounds = YES; 
    sentDryView.layer.cornerRadius = 2;    
    [sentDryView setTitleTextAttributes:@{NSForegroundColorAttributeName:[AreStateWon spanFloatColor]} forState:UIControlStateSelected];
    [sentDryView setTitleTextAttributes:@{NSForegroundColorAttributeName:[AreStateWon spanFloatColor]} forState:UIControlStateNormal];
    [self.view addSubview:sentDryView];
    [sentDryView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(AreStateWon.twoHoverHard.mouseRecent);
    }];
    [sentDryView addTarget:self action:@selector(worldCarMerge:) forControlEvents:UIControlEventValueChanged];
    self.tokenSplatLoudControl = sentDryView;
    
    _opacityFairView = [[UIScrollView alloc]init];
    _opacityFairView.pagingEnabled = YES;
    _opacityFairView.delegate = self;
    [self.view addSubview:_opacityFairView];
    [_opacityFairView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(AreStateWon.twoHoverHard.dublinCarBut);
        make.right.equalTo(self.view).offset(-AreStateWon.twoHoverHard.dublinCarBut);
        make.top.equalTo(self.view).offset(AreStateWon.twoHoverHard.vortexRetMan);
        make.bottom.equalTo(self.view).offset(-AreStateWon.twoHoverHard.hailMinExits);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.opacityFairView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.opacityFairView);
        make.height.equalTo(_opacityFairView);
    }];
    
    UIView * barFeetPhoto = [self redoStreetView:[AreStateWon fairUbiquityCapGetHit]];
    [containerView addSubview:barFeetPhoto];
    [barFeetPhoto mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.opacityFairView);
    }];
    self.dashTagLookOwnCall = barFeetPhoto;
    
    UIView * inverseInuit = [self redoStreetView:[AreStateWon whoSpanMustServicesJabber]];
    [containerView addSubview:inverseInuit];
    [inverseInuit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(barFeetPhoto.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.opacityFairView);
    }];
    self.versionLazyInputDayExposures = inverseInuit;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(inverseInuit.mas_right);
    }];
    
    if (![self.lawBoldSeed boolValue]) {
        UIButton *loadingButton = [AreStateWon safePromisedRequiringAdjustsIrishColor:AreStateWon.miterTabBitKin.downContains];
        [loadingButton setBackgroundImage:[UIImage pinkDidOldPrepColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [loadingButton addTarget:self action:@selector(revertingDolbyCropPenKeysHandball:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:loadingButton];
        [loadingButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-AreStateWon.twoHoverHard.symbolTilde);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(AreStateWon.twoHoverHard.sinWireNoise);
        }];
    }
    
    UIButton *burmeseButton =  [AreStateWon safePromisedRequiringAdjustsIrishColor:AreStateWon.miterTabBitKin.intentsBad];
    [burmeseButton addTarget:self action:@selector(outsideCostDiscardedButBridgedPull:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:burmeseButton];
    [burmeseButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-AreStateWon.twoHoverHard.symbolTilde);
        make.centerX.equalTo(self.view).multipliedBy(![self.lawBoldSeed boolValue]?1.35:1);
        make.height.mas_equalTo(AreStateWon.twoHoverHard.sinWireNoise);
    }];
    
    sentDryView.selectedSegmentIndex = 0;
    [self worldCarMerge:sentDryView];
}

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

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

- (void)justNetCatIllEntityText:(NSInteger)type {
    NSString *literGroup = nil;
    UIView *contentView = nil;
    literGroup = type == 0 ? [AreStateWon fairUbiquityCapGetHit]:[AreStateWon whoSpanMustServicesJabber];
    contentView = type == 0 ? self.dashTagLookOwnCall:self.versionLazyInputDayExposures;
    
    if (literGroup.composerNext) {
        return;
    }
    
    if ([[literGroup pathExtension] containsString:AreStateWon.twoHoverHard.mayAppendedDomainsDeleteTrash]) {
        UITextView *dueView = (UITextView *)contentView;
        if (dueView.text.length > 0) {
            return;
        }

        
        [BitAgeSafeView clickLyricistView:contentView];

        
        NSURL *url = [NSURL URLWithString:literGroup];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [BitAgeSafeView appendingEffectiveNowLayerBlinkView:contentView];
                
                if (error || data.length == 0) {
                    
                    dueView.text = AreStateWon.miterTabBitKin.ukrainianScreenOrderPreviewsHighestRouter;
                    return;
                }
                
                
                NSString *lowButSkipped = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                dueView.text = lowButSkipped ?: AreStateWon.miterTabBitKin.driveVisitedFinalPopCourseProgressObservers;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *didAge = (WKWebView *)contentView;
        if (!didAge.isLoading && didAge.estimatedProgress == 1) {
            [BitAgeSafeView appendingEffectiveNowLayerBlinkView:contentView];
            return;
        }
        [BitAgeSafeView clickLyricistView:contentView];
        NSString *zipServer =  [literGroup.rawAbsentManLookupFarthestWill stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:zipServer];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [didAge loadRequest:request];
    }
}

- (void)revertingDolbyCropPenKeysHandball:(id)sender {
    [self procedureSourcesRawRowFractionAction:nil];
    if (self.boyfriendAssetGuideGaspGigabits) {
        self.boyfriendAssetGuideGaspGigabits(NO);
    }
}

- (void)outsideCostDiscardedButBridgedPull:(id)sender {
    [self procedureSourcesRawRowFractionAction:nil];
    if (self.boyfriendAssetGuideGaspGigabits) {
        self.boyfriendAssetGuideGaspGigabits(YES);
    }
}

- (UIView *)redoStreetView:(NSString *)string {
    UIView *headQuitPin = nil;
    if ([[string pathExtension] containsString:AreStateWon.twoHoverHard.mayAppendedDomainsDeleteTrash]) {
        UITextView * videoArm = [UITextView new];
        videoArm.editable = NO;
        videoArm.backgroundColor = UIColor.whiteColor;
        videoArm.textColor = UIColor.grayColor;
        headQuitPin = videoArm;
    }else {
        WKWebView *lenientMile = [[WKWebView alloc] initWithFrame:CGRectZero];
        lenientMile.backgroundColor = UIColor.clearColor;
        lenientMile.scrollView.backgroundColor = UIColor.lightGrayColor;
        lenientMile.opaque = YES;
        lenientMile.scrollView.bounces =NO;
        lenientMile.scrollView.showsVerticalScrollIndicator = NO;
        lenientMile.scrollView.showsHorizontalScrollIndicator = NO;
        lenientMile.navigationDelegate = self;
        headQuitPin = lenientMile;
    }
    return headQuitPin;
}

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

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

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

@end
