From 928045c485dce47f6106db18ce690cd037ca505f Mon Sep 17 00:00:00 2001 From: rodruiz Date: Mon, 16 Sep 2019 15:19:42 -0700 Subject: [PATCH 1/8] iOS webview_flutter. Iframes and _blank links --- .../webview_flutter/ios/Classes/FlutterWebView.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/webview_flutter/ios/Classes/FlutterWebView.m b/packages/webview_flutter/ios/Classes/FlutterWebView.m index 36f4e8cb5cfe..80e3acae539d 100644 --- a/packages/webview_flutter/ios/Classes/FlutterWebView.m +++ b/packages/webview_flutter/ios/Classes/FlutterWebView.m @@ -34,6 +34,10 @@ - (instancetype)initWithMessenger:(NSObject*)messenger { @end +@interface FLTWebViewController() + +@end + @implementation FLTWebViewController { WKWebView* _webView; int64_t _viewId; @@ -72,6 +76,7 @@ - (instancetype)initWithFrame:(CGRect)frame _webView = [[WKWebView alloc] initWithFrame:frame configuration:configuration]; _navigationDelegate = [[FLTWKNavigationDelegate alloc] initWithChannel:_channel]; _webView.navigationDelegate = _navigationDelegate; + _webView.UIDelegate = self; __weak __typeof__(self) weakSelf = self; [_channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { [weakSelf onMethodCall:call result:result]; @@ -365,4 +370,14 @@ - (void)updateUserAgent:(NSString*)userAgent { } } +// Added to allow for all iframe links / ads to ask the navigationdelegate for rejection or acceptance +- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { + if (!navigationAction.targetFrame.isMainFrame) { + // ... + [webView loadRequest:navigationAction.request]; + } + + return nil; +} + @end From b793c322e9601927c429622f24093510961a435f Mon Sep 17 00:00:00 2001 From: rodruiz Date: Tue, 17 Sep 2019 10:35:55 -0700 Subject: [PATCH 2/8] fix format FlutterWebView.m --- .../ios/Classes/FlutterWebView.m | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/webview_flutter/ios/Classes/FlutterWebView.m b/packages/webview_flutter/ios/Classes/FlutterWebView.m index 80e3acae539d..82fdf01154bd 100644 --- a/packages/webview_flutter/ios/Classes/FlutterWebView.m +++ b/packages/webview_flutter/ios/Classes/FlutterWebView.m @@ -34,7 +34,7 @@ - (instancetype)initWithMessenger:(NSObject*)messenger { @end -@interface FLTWebViewController() +@interface FLTWebViewController () @end @@ -370,14 +370,18 @@ - (void)updateUserAgent:(NSString*)userAgent { } } -// Added to allow for all iframe links / ads to ask the navigationdelegate for rejection or acceptance -- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { - if (!navigationAction.targetFrame.isMainFrame) { - // ... - [webView loadRequest:navigationAction.request]; - } +// Added to allow for all iframe links / ads to ask the navigationdelegate for rejection or +// acceptance +- (WKWebView*)webView:(WKWebView*)webView + createWebViewWithConfiguration:(WKWebViewConfiguration*)configuration + forNavigationAction:(WKNavigationAction*)navigationAction + windowFeatures:(WKWindowFeatures*)windowFeatures { + if (!navigationAction.targetFrame.isMainFrame) { + // ... + [webView loadRequest:navigationAction.request]; + } - return nil; + return nil; } @end From d814748ea4fa490d348a6d33d8a8cf6cdb995529 Mon Sep 17 00:00:00 2001 From: rodruiz Date: Mon, 7 Oct 2019 11:37:07 -0700 Subject: [PATCH 3/8] Update CHANGELOG.md --- packages/webview_flutter/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/webview_flutter/CHANGELOG.md b/packages/webview_flutter/CHANGELOG.md index 98e312afd3a3..c59472b9072f 100644 --- a/packages/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.14+2 + +* iOS now can open iframe links and target _blank links. + ## 0.3.14+1 * Allow underscores anywhere for Javascript Channel name. From 9e41af6600e72d990ffa3ed06f26a5074000f21e Mon Sep 17 00:00:00 2001 From: rodruiz Date: Mon, 7 Oct 2019 11:37:46 -0700 Subject: [PATCH 4/8] Update pubspec.yaml --- packages/webview_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/pubspec.yaml b/packages/webview_flutter/pubspec.yaml index e5f39f14da87..13ccef744009 100644 --- a/packages/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget on Android and iOS. -version: 0.3.14+1 +version: 0.3.14+2 author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/webview_flutter From 606357ed5097eb687392b674b7283ce2f4eb5049 Mon Sep 17 00:00:00 2001 From: rodruiz Date: Mon, 9 Dec 2019 16:13:48 -0800 Subject: [PATCH 5/8] Update CHANGELOG.md --- packages/webview_flutter/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/CHANGELOG.md b/packages/webview_flutter/CHANGELOG.md index 60d682d1de03..ef186e39f20f 100644 --- a/packages/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/CHANGELOG.md @@ -1,11 +1,11 @@ -## 0.3.19 - -* iOS now can open iframe links and target _blank links. - ## 0.3.18 * Add support for onPageStarted event. +## 0.3.17+1 + +* iOS now can open iframe links and target _blank links. + ## 0.3.17 * Fix pedantic lint errors. Added missing documentation and awaited some futures From 42e5189498888f2459a238a86d2a6d38e1a08084 Mon Sep 17 00:00:00 2001 From: rodruiz Date: Mon, 9 Dec 2019 16:14:04 -0800 Subject: [PATCH 6/8] Update pubspec.yaml --- packages/webview_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/pubspec.yaml b/packages/webview_flutter/pubspec.yaml index b94142eb91aa..54e2553a16bb 100644 --- a/packages/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: webview_flutter description: A Flutter plugin that provides a WebView widget on Android and iOS. -version: 0.3.19 +version: 0.3.17+1 author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/webview_flutter From 19b1c04982628cfd3537adbfb4a1f50042d36605 Mon Sep 17 00:00:00 2001 From: rodruiz Date: Thu, 12 Dec 2019 11:31:51 -0800 Subject: [PATCH 7/8] Update webview_flutter CHANGELOG.md --- packages/webview_flutter/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/CHANGELOG.md b/packages/webview_flutter/CHANGELOG.md index 1b7b61abfe9a..461f39599085 100644 --- a/packages/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.18+2 + +* iOS now can open iframe links and target _blank links. + ## 0.3.18+1 * Be explicit that keyboard is not ready for production in README.md. @@ -9,10 +13,6 @@ * Migrate to the new pubspec platforms manifest. * Require Flutter SDK 1.10.0 or greater. -## 0.3.17+1 - -* iOS now can open iframe links and target _blank links. - ## 0.3.17 * Fix pedantic lint errors. Added missing documentation and awaited some futures From 7a66aaa3343c4a16e82deb3e140743b2a7a697de Mon Sep 17 00:00:00 2001 From: Rodolfo Ruiz Date: Mon, 27 Jan 2020 16:17:29 -0800 Subject: [PATCH 8/8] Allow zoom --- packages/webview_flutter/CHANGELOG.md | 1 + .../io/flutter/plugins/webviewflutter/FlutterWebView.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/packages/webview_flutter/CHANGELOG.md b/packages/webview_flutter/CHANGELOG.md index 666a4eaca122..c23fc0f7fb20 100644 --- a/packages/webview_flutter/CHANGELOG.md +++ b/packages/webview_flutter/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.3.19+6 * iOS now can open iframe links and target _blank links. +* Allow zoom and hide the zoom in and zoom out buttons. ## 0.3.19+5 diff --git a/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java b/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java index 0e5a5609dd93..429f3b3c2a54 100644 --- a/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java +++ b/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java @@ -49,6 +49,11 @@ public class FlutterWebView implements PlatformView, MethodCallHandler { // Allow local storage. webView.getSettings().setDomStorageEnabled(true); + // Allow zoom and hide the zoom in and zoom out buttons. + webView.getSettings().setSupportZoom(true); + webView.getSettings().setBuiltInZoomControls(true); + webView.getSettings().setDisplayZoomControls(false); + methodChannel = new MethodChannel(messenger, "plugins.flutter.io/webview_" + id); methodChannel.setMethodCallHandler(this);