diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6b9fd3fa..177cf086 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -15,16 +15,21 @@
-
+
+
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -45,13 +50,10 @@
-
+
-
-
-
-
-
+
+
@@ -59,62 +61,53 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -125,59 +118,50 @@
- _onPlatformViewCreated
- callback
- evaluate
- onLoadReso
- reload
- t-rex
- ajaxReq
- window.
- shouldInterceptFetchRequest
- onconsole
- shouldInterceptAjaxRequest
- console
- getHT
- getFavicons
- getHtml
- loadUrl
- evaluateJavascript
- isAsync
- "headers": headers
- shouldIn
- onZaboHandlerCallback
- AndroidView
- scalesPageToFit
- cookie_manager
- scroll
- scrolltO
- removeF
- onScroll
+ onConsoleM
+ return this
+ return await
+ onCallJsHandler
+ ListenerCallback
+ jsonDecode
+ CallBac
+ dart
+ ```
+ JavaScriptHandlerCallback
+ addJavaScriptHandler
+ indexTest
+ removeJavaScriptHandler
+ __safeBrowsingEnabled__
+ __safe
+ __textZoom
+ hidden
+ builtInZoomControls
+ __builtInZoomControls__
+ android.support.v4
+ __transparentBackground__
dispose
- _getDomainName
+ _dispose
+ รน
+ setC
+ _textFieldController
+ in_app_webview_on_target_blank_test
+ createPromptDialog
+ houldOverrideUrlLoad
+ InAppWebViewShouldOverrideUrlLoadingTest
activity.getPreferences(0)
Log.
com.pichillilorenzo.flutter_inappbrowser
flutter_inappbrowser
- throwIsNotOpened
- ChannelManager
- Function
- ?.toMap() ?? {});
- javascriptEnabled
- [InAppWebView]\
$PROJECT_DIR$/example/android
- $PROJECT_DIR$/lib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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a7f1e7c..1d7245f0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,11 @@
- Renamed `injectStyleCode` to `injectCSSCode`
- Renamed `injectStyleFile` to `injectCSSFileFromUrl`
+## 1.2.2
+
+- Merge "added a shared WKProcessPool for webview instances" [#198](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/198) (thanks to [robertcnst](https://github.com/robertcnst))
+- Fixed iOS setCookie.
+
## 1.2.1
- Merge "Add new option to control the contentMode in Android platform" [#101](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/101) (thanks to [DreamBuddy](https://github.com/DreamBuddy))
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java
index d3071b04..5f784045 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebChromeClient.java
@@ -9,6 +9,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
+import android.os.Message;
import android.util.Log;
import android.view.View;
import android.webkit.ConsoleMessage;
@@ -18,6 +19,7 @@ import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
+import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -395,12 +397,40 @@ public class InAppWebChromeClient extends WebChromeClient implements PluginRegis
}
@Override
- public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg) {
- WebView.HitTestResult result = view.getHitTestResult();
- String data = result.getExtra();
- Map obj = new HashMap<>();
+ public boolean onCreateWindow(WebView view, boolean isDialog, boolean userGesture, final Message resultMsg) {
+ final Map obj = new HashMap<>();
if (inAppBrowserActivity != null)
obj.put("uuid", inAppBrowserActivity.uuid);
+
+ WebView.HitTestResult result = view.getHitTestResult();
+ String data = result.getExtra();
+
+ if (data == null) {
+ // to get the URL, create a temp weview
+ final WebView newWebView = new WebView(view.getContext());
+ // disable javascript
+ newWebView.getSettings().setJavaScriptEnabled(false);
+ newWebView.setWebViewClient(new WebViewClient(){
+ @Override
+ public void onPageStarted(WebView v, String url, Bitmap favicon) {
+ super.onPageStarted(v, url, favicon);
+
+ obj.put("url", url);
+ getChannel().invokeMethod("onTargetBlank", obj);
+
+ // stop webview loading
+ v.stopLoading();
+
+ // this will throw the error "Application attempted to call on a destroyed AwAutofillManager" that will kill the webview.
+ // that's ok.
+ v.destroy();
+ }
+ });
+ ((WebView.WebViewTransport)resultMsg.obj).setWebView(newWebView);
+ resultMsg.sendToTarget();
+ return true;
+ }
+
obj.put("url", data);
getChannel().invokeMethod("onTargetBlank", obj);
return false;
diff --git a/example/lib/in_app_webiew_example.screen.dart b/example/lib/in_app_webiew_example.screen.dart
index 6482554f..645565f5 100755
--- a/example/lib/in_app_webiew_example.screen.dart
+++ b/example/lib/in_app_webiew_example.screen.dart
@@ -42,6 +42,7 @@ class _InAppWebViewExampleScreenState extends State {
@override
void dispose() {
super.dispose();
+ _textFieldController.dispose();
}
@override
@@ -122,11 +123,11 @@ class _InAppWebViewExampleScreenState extends State {
BoxDecoration(border: Border.all(color: Colors.blueAccent)),
child: InAppWebView(
//initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1",
- initialUrl: "https://github.com",
+ //initialUrl: "https://github.com",
//initialUrl: "chrome://safe-browsing/match?type=malware",
//initialUrl: "http://192.168.1.20:8081/",
//initialUrl: "https://192.168.1.20:4433/",
- //initialFile: "assets/index.html",
+ initialFile: "assets/index.html",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index ac51e7e8..8fb8e5f6 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -56,6 +56,10 @@ flutter:
- test_assets/in_app_webview_ajax_test.html
- test_assets/in_app_webview_fetch_test.html
- test_assets/in_app_webview_on_load_resource_custom_scheme_test.html
+ - test_assets/in_app_webview_on_console_message_test.html
+ - test_assets/in_app_webview_on_download_start_test.html
+ - test_assets/in_app_webview_on_target_blank_test.html
+ - test_assets/in_app_webview_on_js_dialog_test.html
- test_assets/css/
- test_assets/images/
- test_assets/favicon.ico
diff --git a/example/test_assets/in_app_webview_initial_file_test.html b/example/test_assets/in_app_webview_initial_file_test.html
index 35047153..443d98e9 100644
--- a/example/test_assets/in_app_webview_initial_file_test.html
+++ b/example/test_assets/in_app_webview_initial_file_test.html
@@ -29,6 +29,7 @@
+ flutter_inappbrowser
+ InAppWebViewOnJsDialogTest
+
+
diff --git a/example/test_assets/in_app_webview_on_js_dialog_test.html b/example/test_assets/in_app_webview_on_js_dialog_test.html
new file mode 100644
index 00000000..a234f0ef
--- /dev/null
+++ b/example/test_assets/in_app_webview_on_js_dialog_test.html
@@ -0,0 +1,19 @@
+
+
+