






#import "BelowShotViewController.h"
#import "StakeEntitledObjectAdvertiseExtentsHandler.h"

@interface BelowShotViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler>

@end

@implementation BelowShotViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.martialAreButton.hidden = YES;
    self.loudBuddyButton.hidden = YES;
    [self cocoaSceneUseView];
}

- (void)cocoaSceneUseView
{
    WKUserContentController *warpSmoothSwap = [[WKUserContentController alloc] init];
    WKUserScript *addIgnored = [[WKUserScript alloc] initWithSource:WinNeedHang.chargePenSin.deferredSlabSelectorGarbageConnect injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
    [warpSmoothSwap addUserScript:addIgnored];
    
    WKWebViewConfiguration * config = [[WKWebViewConfiguration alloc] init];
    WKPreferences *bendButCat = [[WKPreferences alloc]init];
    bendButCat.javaScriptCanOpenWindowsAutomatically = YES;
    bendButCat.minimumFontSize = 40.0;
    bendButCat.javaScriptEnabled = YES;
    config.preferences = bendButCat;
    config.selectionGranularity = WKSelectionGranularityDynamic;
    config.preferences.minimumFontSize = 18;
    config.preferences.javaScriptEnabled = YES;
    config.userContentController = warpSmoothSwap;
    
    self.peerSeekToo = [[WKWebView alloc] initWithFrame:CGRectZero];
    self.peerSeekToo.backgroundColor = UIColor.clearColor;
    self.peerSeekToo.scrollView.backgroundColor = UIColor.clearColor;
    self.peerSeekToo.navigationDelegate = self;
    self.peerSeekToo.opaque = YES;
    self.peerSeekToo.scrollView.bounces = NO;
    self.peerSeekToo.scrollView.showsVerticalScrollIndicator = NO;
    self.peerSeekToo.scrollView.showsHorizontalScrollIndicator = NO;
    self.peerSeekToo.UIDelegate = self;
    [self.view addSubview:self.peerSeekToo];
    self.peerSeekToo.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    
    
    StakeEntitledObjectAdvertiseExtentsHandler *eachSlab = [[StakeEntitledObjectAdvertiseExtentsHandler alloc] initWithDelegate:self];
    StakeEntitledObjectAdvertiseExtentsHandler *delaySun = [[StakeEntitledObjectAdvertiseExtentsHandler alloc] initWithDelegate:self];
    
    [self.peerSeekToo.configuration.userContentController addScriptMessageHandler:eachSlab name:WinNeedHang.chargePenSin.suggestFillerBasalHowAccording];
    [self.peerSeekToo.configuration.userContentController addScriptMessageHandler:delaySun name:WinNeedHang.chargePenSin.computerInteriorAgentSunThermalTrailingExist];
}

- (void)setForkRainEgg:(NSString *)forkRainEgg {
    _forkRainEgg = forkRainEgg;
    NSURL *url = [NSURL URLWithString:forkRainEgg];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
    [request addValue:[WinNeedHang hasSpanSortCheckWasToken] forHTTPHeaderField:WinNeedHang.chargePenSin.azimuthSceneSentinelAmbiguousOdd];
    [self.peerSeekToo loadRequest:request];
}

- (void)thirteenIllEraModifierWidthUniqueLight:(NSURL *)URL {
    if ([self.unitRatioPlug respondsToSelector:@selector(revokedView:blobDayRowAction:are:)]) {
        [self.unitRatioPlug revokedView:self.peerSeekToo blobDayRowAction:URL.host are:URL];
    }
}



- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler {
    decisionHandler(WKNavigationResponsePolicyAllow);
}


- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
    NSURL *URL = navigationAction.request.URL;
    
    if ([URL.scheme hasPrefix:WinNeedHang.chargePenSin.signMole]) {
        [self thirteenIllEraModifierWidthUniqueLight:URL];
        decisionHandler(WKNavigationActionPolicyCancel);
        return;
    }
    decisionHandler(WKNavigationActionPolicyAllow);
}


-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{

}


- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{
    

}


-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
    
    [webView evaluateJavaScript:WinNeedHang.chargePenSin.haveIconRowShelfHectaresFloater completionHandler:nil];
    
    [webView evaluateJavaScript:WinNeedHang.chargePenSin.deletingDifferentHostingOutputHoursDense completionHandler:nil];
    [webView evaluateJavaScript:WinNeedHang.chargePenSin.printerSortDashCreatingHistory completionHandler:nil];
    
    [BeaconsEggView bracketedWateryDiscountMetricsWaitView:self.view];
    while (self.peerSeekToo.isLoading) {
        return;
    }
}


- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
    
    
    if ([self.unitRatioPlug respondsToSelector:@selector(revokedView:blobDayRowAction:are:)]) {
        [self.unitRatioPlug revokedView:self.peerSeekToo blobDayRowAction:message.name are:message.body];
    }
}

-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler{
    
    [KeyAlertView hallPreparedWaxSucceedCocoaDomains:@"" message:message completion:^(NSInteger sonOwnIndex) {
        completionHandler();
    }];
}



- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures{
    WKFrameInfo *frameInfo = navigationAction.targetFrame;
    if (![frameInfo isMainFrame]) {
        [webView loadRequest:navigationAction.request];
    }
    return nil;
}


- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * __nullable result))completionHandler{
    completionHandler(WinNeedHang.chargePenSin.linkageUpper);
}


- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler{
    completionHandler(YES);
}

- (void)dealloc {
    self.peerSeekToo.UIDelegate = nil;
    self.view = nil;
    [self.peerSeekToo.configuration.userContentController removeAllUserScripts];
}

@end
