






#import "FeedRouteViewController.h"
#import "LocationsTrademarkMotionTintDarwinHandler.h"

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

@end

@implementation FeedRouteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tooSumWakeButton.hidden = YES;
    self.wayHyphenButton.hidden = YES;
    [self panSonInstantView];
}

- (void)panSonInstantView
{
    WKUserContentController *auditRareBuilt = [[WKUserContentController alloc] init];
    WKUserScript *usageSurge = [[WKUserScript alloc] initWithSource:MillLiftIll.hintLegalHue.gaussianRotationButPivotEscaped injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
    [auditRareBuilt addUserScript:usageSurge];
    
    WKWebViewConfiguration * config = [[WKWebViewConfiguration alloc] init];
    WKPreferences *closeReply = [[WKPreferences alloc]init];
    closeReply.javaScriptCanOpenWindowsAutomatically = YES;
    closeReply.minimumFontSize = 40.0;
    closeReply.javaScriptEnabled = YES;
    config.preferences = closeReply;
    config.selectionGranularity = WKSelectionGranularityDynamic;
    config.preferences.minimumFontSize = 18;
    config.preferences.javaScriptEnabled = YES;
    config.userContentController = auditRareBuilt;
    
    self.menLinkHold = [[WKWebView alloc] initWithFrame:CGRectZero];
    self.menLinkHold.backgroundColor = UIColor.clearColor;
    self.menLinkHold.scrollView.backgroundColor = UIColor.clearColor;
    self.menLinkHold.navigationDelegate = self;
    self.menLinkHold.opaque = YES;
    self.menLinkHold.scrollView.bounces = NO;
    self.menLinkHold.scrollView.showsVerticalScrollIndicator = NO;
    self.menLinkHold.scrollView.showsHorizontalScrollIndicator = NO;
    self.menLinkHold.UIDelegate = self;
    [self.view addSubview:self.menLinkHold];
    self.menLinkHold.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    
    
    LocationsTrademarkMotionTintDarwinHandler *moveSort = [[LocationsTrademarkMotionTintDarwinHandler alloc] initWithDelegate:self];
    LocationsTrademarkMotionTintDarwinHandler *sonHello = [[LocationsTrademarkMotionTintDarwinHandler alloc] initWithDelegate:self];
    
    [self.menLinkHold.configuration.userContentController addScriptMessageHandler:moveSort name:MillLiftIll.hintLegalHue.optimizeUnderlineGaspCutterLatvian];
    [self.menLinkHold.configuration.userContentController addScriptMessageHandler:sonHello name:MillLiftIll.hintLegalHue.ironDigitDryNormalizeIntegrateIndexingRight];
}

- (void)setExchangeKin:(NSString *)exchangeKin {
    _exchangeKin = exchangeKin;
    NSURL *url = [NSURL URLWithString:exchangeKin];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
    [request addValue:[MillLiftIll relationBedOurRetainedTurnToken] forHTTPHeaderField:MillLiftIll.hintLegalHue.gradientCompressRetIncludesDetaching];
    [self.menLinkHold loadRequest:request];
}

- (void)forkRectumMiddleExtensionBadBordersSafe:(NSURL *)URL {
    if ([self.moodItemSetup respondsToSelector:@selector(pressesView:recordDrumAction:due:)]) {
        [self.moodItemSetup pressesView:self.menLinkHold recordDrumAction:URL.host due: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:MillLiftIll.hintLegalHue.abnormal]) {
        [self forkRectumMiddleExtensionBadBordersSafe: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:MillLiftIll.hintLegalHue.siblingsSideCountTrapAverageExporting completionHandler:nil];
    
    [webView evaluateJavaScript:MillLiftIll.hintLegalHue.sinkPublisherSucceededSchoolSpaOpposite completionHandler:nil];
    [webView evaluateJavaScript:MillLiftIll.hintLegalHue.jouleEmbeddedBalancedSecurityEncoded completionHandler:nil];
    
    [TradFaxAgeView illYetDecreaseManEscapedView:self.view];
    while (self.menLinkHold.isLoading) {
        return;
    }
}


- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
    
    
    if ([self.moodItemSetup respondsToSelector:@selector(pressesView:recordDrumAction:due:)]) {
        [self.moodItemSetup pressesView:self.menLinkHold recordDrumAction:message.name due:message.body];
    }
}

-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler{
    
    [NotAlertView stackSpeedDesktopNoteTheBusy:@"" message:message completion:^(NSInteger unableIndex) {
        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(MillLiftIll.hintLegalHue.failBounding);
}


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

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

@end
