






#import "SonImpactViewController.h"
#import "ZoneExpandNetManganeseReplacedHandler.h"

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

@end

@implementation SonImpactViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.halfWayPopButton.hidden = YES;
    self.itsReaderButton.hidden = YES;
    [self downDigitizedView];
}

- (void)downDigitizedView
{
    WKUserContentController *warpWithMember = [[WKUserContentController alloc] init];
    WKUserScript *duePutHeap = [[WKUserScript alloc] initWithSource:ZipRestThat.heartHowLead.affiliateVariablesArtistDefinesKilogram injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
    [warpWithMember addUserScript:duePutHeap];
    
    WKWebViewConfiguration * config = [[WKWebViewConfiguration alloc] init];
    WKPreferences *lowHighWax = [[WKPreferences alloc]init];
    lowHighWax.javaScriptCanOpenWindowsAutomatically = YES;
    lowHighWax.minimumFontSize = 40.0;
    lowHighWax.javaScriptEnabled = YES;
    config.preferences = lowHighWax;
    config.selectionGranularity = WKSelectionGranularityDynamic;
    config.preferences.minimumFontSize = 18;
    config.preferences.javaScriptEnabled = YES;
    config.userContentController = warpWithMember;
    
    self.supplyModel = [[WKWebView alloc] initWithFrame:CGRectZero];
    self.supplyModel.backgroundColor = UIColor.clearColor;
    self.supplyModel.scrollView.backgroundColor = UIColor.clearColor;
    self.supplyModel.navigationDelegate = self;
    self.supplyModel.opaque = YES;
    self.supplyModel.scrollView.bounces = NO;
    self.supplyModel.scrollView.showsVerticalScrollIndicator = NO;
    self.supplyModel.scrollView.showsHorizontalScrollIndicator = NO;
    self.supplyModel.UIDelegate = self;
    [self.view addSubview:self.supplyModel];
    self.supplyModel.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    
    
    ZoneExpandNetManganeseReplacedHandler *released = [[ZoneExpandNetManganeseReplacedHandler alloc] initWithDelegate:self];
    ZoneExpandNetManganeseReplacedHandler *tipHuman = [[ZoneExpandNetManganeseReplacedHandler alloc] initWithDelegate:self];
    
    [self.supplyModel.configuration.userContentController addScriptMessageHandler:released name:ZipRestThat.heartHowLead.cropBringDecipherMatchUpper];
    [self.supplyModel.configuration.userContentController addScriptMessageHandler:tipHuman name:ZipRestThat.heartHowLead.putTriggersDiscountsBounceStepsonConsumerScanner];
}

- (void)setBusyEpsilon:(NSString *)busyEpsilon {
    _busyEpsilon = busyEpsilon;
    NSURL *url = [NSURL URLWithString:busyEpsilon];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
    [request addValue:[ZipRestThat bookmarksIntensityPinSleetAirToken] forHTTPHeaderField:ZipRestThat.heartHowLead.herSwapLearnCautionDark];
    [self.supplyModel loadRequest:request];
}

- (void)matrixGlyphBackNormalTriggerBoldHome:(NSURL *)URL {
    if ([self.appleOverride respondsToSelector:@selector(dogCostView:shortAlbumAction:sub:)]) {
        [self.appleOverride dogCostView:self.supplyModel shortAlbumAction:URL.host sub: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:ZipRestThat.heartHowLead.pressSob]) {
        [self matrixGlyphBackNormalTriggerBoldHome: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:ZipRestThat.heartHowLead.obsoleteRedMapSkipElevenRecovered completionHandler:nil];
    
    [webView evaluateJavaScript:ZipRestThat.heartHowLead.askExpectedRetTryAdditiveMin completionHandler:nil];
    [webView evaluateJavaScript:ZipRestThat.heartHowLead.askSendButCatFade completionHandler:nil];
    
    [PlayKernelView datumDarkerOverlapWhoBridgeView:self.view];
    while (self.supplyModel.isLoading) {
        return;
    }
}


- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
    
    
    if ([self.appleOverride respondsToSelector:@selector(dogCostView:shortAlbumAction:sub:)]) {
        [self.appleOverride dogCostView:self.supplyModel shortAlbumAction:message.name sub:message.body];
    }
}

-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler{
    
    [IllAlertView outsideTwistCenteredEmergencyIntegersLose:@"" message:message completion:^(NSInteger bigWetIndex) {
        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(ZipRestThat.heartHowLead.samplingBend);
}


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

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

@end
