|
|
@@ -3,7 +3,7 @@
|
|
|
static NSString *const CHANNEL_NAME = @"flutter_webview_plugin";
|
|
|
|
|
|
// UIWebViewDelegate
|
|
|
-@interface FlutterWebviewPlugin() <WKNavigationDelegate, UIScrollViewDelegate> {
|
|
|
+@interface FlutterWebviewPlugin() <WKNavigationDelegate, UIScrollViewDelegate, WKUIDelegate> {
|
|
|
BOOL _enableAppScheme;
|
|
|
BOOL _enableZoom;
|
|
|
}
|
|
|
@@ -105,6 +105,7 @@ static NSString *const CHANNEL_NAME = @"flutter_webview_plugin";
|
|
|
}
|
|
|
|
|
|
self.webview = [[WKWebView alloc] initWithFrame:rc];
|
|
|
+ self.webview.UIDelegate = self;
|
|
|
self.webview.navigationDelegate = self;
|
|
|
self.webview.scrollView.delegate = self;
|
|
|
self.webview.hidden = [hidden boolValue];
|
|
|
@@ -260,6 +261,15 @@ static NSString *const CHANNEL_NAME = @"flutter_webview_plugin";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration
|
|
|
+ forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
|
|
|
+
|
|
|
+ if (!navigationAction.targetFrame.isMainFrame) {
|
|
|
+ [webView loadRequest:navigationAction.request];
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil;
|
|
|
+}
|
|
|
|
|
|
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
|
|
[channel invokeMethod:@"onState" arguments:@{@"type": @"startLoad", @"url": webView.URL.absoluteString}];
|