diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md
index 283e9357..46107d40 100644
--- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md
+++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md
@@ -6,7 +6,7 @@ about: Something is crashing or not working as intended
## Environment
-**App version:**
+**Plugin version:**
**Android version:**
**Device information:**
**Flutter version:**
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7f..46ea4792 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1e99327e..10429288 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -15,24 +15,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
+
@@ -56,10 +84,9 @@
-
-
+
+
-
@@ -70,8 +97,8 @@
-
-
+
+
@@ -79,8 +106,8 @@
-
-
+
+
@@ -89,10 +116,25 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -109,17 +151,6 @@
- window.
- onLoadHttpError
- microphone
- Action
- Action {
- Action action;
- Response {
- 'action': this.action
- : this.action
- this.
- Event fires
onSafe
onPermission
onPermissionRequest
@@ -139,6 +170,17 @@
iltInZoomControls
databaseEnabled
Cookie
+ \
+ `shouldOverrideUrlLoading
+ useshouldOverrideUrlLoading
+ initiald
+ shouldOverrideUrlLoading
+ BAAAAACK
+ loadData
+ iNitialData
+ pauseTimers
+ historyUrl
+ data
activity.getPreferences(0)
@@ -161,14 +203,6 @@
-
+
@@ -256,6 +298,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -263,6 +316,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -285,13 +349,14 @@
-
+
+
-
+
@@ -308,17 +373,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -340,10 +394,6 @@
-
-
-
-
@@ -351,6 +401,11 @@
+
+
+
+
+
@@ -469,8 +524,9 @@
+
-
+
@@ -481,7 +537,7 @@
-
+
@@ -489,7 +545,7 @@
-
+
@@ -519,55 +575,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -728,11 +735,6 @@
-
-
-
-
-
@@ -763,16 +765,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -797,40 +789,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -851,49 +809,151 @@
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9320188..4aa3d71b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 2.1.0
+
+- Added `pause` and `resume` methods for Android.
+- Added `pauseTimers` and `resumeTimers` methods.
+- Added new `historyUrl` optional parameter for `loadData` and `openData` methods and `InAppWebViewInitialData` class. It is used only on Android.
+- Fix "problems with onReceivedHttpAuthRequest when initialData is used" [#201](https://github.com/pichillilorenzo/flutter_inappwebview/issues/201)
+- Fix "System ui (status bar and navigation bar) doesn't hide automatically" [#202](https://github.com/pichillilorenzo/flutter_inappwebview/issues/202)
+
## 2.0.1+1
- Fixed error "java.lang.ClassCastException: $Proxy1 cannot be cast to android.view.WindowManagerImpl" on Android when using native alert dialogs
diff --git a/README.md b/README.md
index 320c0f5f..e9e42820 100644
--- a/README.md
+++ b/README.md
@@ -427,12 +427,12 @@ Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
* `onLoadHttpError`: Event fired when the InAppWebView main page receives an HTTP error.
* `onProgressChanged`: Event fired when the current progress of loading a page is changed.
* `onConsoleMessage`: Event fired when the InAppWebView receives a ConsoleMessage.
-* `shouldOverrideUrlLoading`: Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
-* `onLoadResource`: Event fired when the InAppWebView loads a resource.
+* `shouldOverrideUrlLoading`: Give the host application a chance to take control when a URL is about to be loaded in the current WebView (to use this event, the `useShouldOverrideUrlLoading` option must be `true`).
+* `onLoadResource`: Event fired when the InAppWebView loads a resource (to use this event, the `useOnLoadResource` option must be `true`).
* `onScrollChanged`: Event fired when the InAppWebView scrolls.
-* `onDownloadStart`: Event fired when InAppWebView recognizes and starts a downloadable file.
+* `onDownloadStart`: Event fired when InAppWebView recognizes and starts a downloadable file (to use this event, the `useOnDownloadStart` option must be `true`).
* `onLoadResourceCustomScheme`: Event fired when the InAppWebView finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a CustomSchemeResponse to load a specific resource encoded to `base64`.
-* `onTargetBlank`: Event fired when the InAppWebView tries to open a link with `target="_blank"`.
+* `onTargetBlank`: Event fired when the InAppWebView tries to open a link with `target="_blank"` (to use this event, the `useOnTargetBlank` option must be `true`).
* `onGeolocationPermissionsShowPrompt`: Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin (available only on Android).
* `onJsAlert`: Event fired when javascript calls the `alert()` method to display an alert dialog.
* `onJsConfirm`: Event fired when javascript calls the `confirm()` method to display a confirm dialog.
@@ -442,10 +442,10 @@ Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
* `onReceivedServerTrustAuthRequest`: Event fired when the WebView need to perform server trust authentication (certificate validation).
* `onReceivedClientCertRequest`: Notify the host application to handle an SSL client certificate request.
* `onFindResultReceived`: Event fired as find-on-page operations progress.
-* `shouldInterceptAjaxRequest`: Event fired when an `XMLHttpRequest` is sent to a server.
-* `onAjaxReadyStateChange`: Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
-* `onAjaxProgress`: Event fired as an `XMLHttpRequest` progress.
-* `shouldInterceptFetchRequest`: Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
+* `shouldInterceptAjaxRequest`: Event fired when an `XMLHttpRequest` is sent to a server (to use this event, the `useShouldInterceptAjaxRequest` option must be `true`).
+* `onAjaxReadyStateChange`: Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes (to use this event, the `useShouldInterceptAjaxRequest` option must be `true`).
+* `onAjaxProgress`: Event fired as an `XMLHttpRequest` progress (to use this event, the `useShouldInterceptAjaxRequest` option must be `true`).
+* `shouldInterceptFetchRequest`: Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API) (to use this event, the `useShouldInterceptFetchRequest` option must be `true`).
* `onNavigationStateChange`: Event fired when the navigation state of the InAppWebView changes.
* `onPermissionRequest`: Event fired when the webview is requesting permission to access the specified resources and the permission currently isn't granted or denied (available only on Android).
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/FlutterWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/FlutterWebView.java
index fcaae2b5..2d921eae 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/FlutterWebView.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/FlutterWebView.java
@@ -76,7 +76,8 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
String mimeType = initialData.get("mimeType");
String encoding = initialData.get("encoding");
String baseUrl = initialData.get("baseUrl");
- webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, null);
+ String historyUrl = initialData.get("historyUrl");
+ webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
}
else
webView.loadUrl(initialUrl, initialHeaders);
@@ -117,9 +118,10 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
String mimeType = (String) call.argument("mimeType");
String encoding = (String) call.argument("encoding");
String baseUrl = (String) call.argument("baseUrl");
+ String historyUrl = (String) call.argument("historyUrl");
if (webView != null)
- webView.loadData(data, mimeType, encoding, baseUrl, result);
+ webView.loadData(data, mimeType, encoding, baseUrl, historyUrl, result);
else
result.success(false);
}
@@ -300,6 +302,38 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
}
result.success(true);
break;
+ case "pause":
+ if (webView != null) {
+ webView.onPause();
+ result.success(true);
+ } else {
+ result.success(false);
+ }
+ break;
+ case "resume":
+ if (webView != null) {
+ webView.onResume();
+ result.success(true);
+ } else {
+ result.success(false);
+ }
+ break;
+ case "pauseTimers":
+ if (webView != null) {
+ webView.pauseTimers();
+ result.success(true);
+ } else {
+ result.success(false);
+ }
+ break;
+ case "resumeTimers":
+ if (webView != null) {
+ webView.resumeTimers();
+ result.success(true);
+ } else {
+ result.success(false);
+ }
+ break;
default:
result.notImplemented();
}
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowser.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowser.java
index 6c794b5a..7bd15b85 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowser.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowser.java
@@ -153,7 +153,8 @@ public class InAppBrowser implements MethodChannel.MethodCallHandler {
String mimeType = (String) call.argument("mimeType");
String encoding = (String) call.argument("encoding");
String baseUrl = (String) call.argument("baseUrl");
- openData(activity, uuid, options, data, mimeType, encoding, baseUrl);
+ String historyUrl = (String) call.argument("historyUrl");
+ openData(activity, uuid, options, data, mimeType, encoding, baseUrl, historyUrl);
result.success(true);
}
});
@@ -180,7 +181,8 @@ public class InAppBrowser implements MethodChannel.MethodCallHandler {
String mimeType = (String) call.argument("mimeType");
String encoding = (String) call.argument("encoding");
String baseUrl = (String) call.argument("baseUrl");
- loadData(uuid, data, mimeType, encoding, baseUrl, result);
+ String historyUrl = (String) call.argument("historyUrl");
+ loadData(uuid, data, mimeType, encoding, baseUrl, historyUrl, result);
}
break;
case "loadFile":
@@ -460,7 +462,7 @@ public class InAppBrowser implements MethodChannel.MethodCallHandler {
result.error(LOG_TAG, "No WebView fallback declared.", null);
}
- public void openData(Activity activity, String uuid, HashMap options, String data, String mimeType, String encoding, String baseUrl) {
+ public void openData(Activity activity, String uuid, HashMap options, String data, String mimeType, String encoding, String baseUrl, String historyUrl) {
Intent intent = new Intent(activity, InAppBrowserActivity.class);
Bundle extras = new Bundle();
@@ -471,6 +473,7 @@ public class InAppBrowser implements MethodChannel.MethodCallHandler {
extras.putString("mimeType", mimeType);
extras.putString("encoding", encoding);
extras.putString("baseUrl", baseUrl);
+ extras.putString("historyUrl", historyUrl);
intent.putExtras(extras);
activity.startActivity(intent);
@@ -513,10 +516,10 @@ public class InAppBrowser implements MethodChannel.MethodCallHandler {
inAppBrowserActivity.postUrl(url, postData, result);
}
- public void loadData(String uuid, String data, String mimeType, String encoding, String baseUrl, Result result) {
+ public void loadData(String uuid, String data, String mimeType, String encoding, String baseUrl, String historyUrl, Result result) {
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
if (inAppBrowserActivity != null)
- inAppBrowserActivity.loadData(data, mimeType, encoding, baseUrl, result);
+ inAppBrowserActivity.loadData(data, mimeType, encoding, baseUrl, historyUrl, result);
}
public void loadFile(String uuid, String url, Map headers, Result result) {
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserActivity.java
index 497d3d1d..0f4e3c21 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserActivity.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserActivity.java
@@ -88,7 +88,8 @@ public class InAppBrowserActivity extends AppCompatActivity {
String mimeType = b.getString("mimeType");
String encoding = b.getString("encoding");
String baseUrl = b.getString("baseUrl");
- webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, null);
+ String historyUrl = b.getString("historyUrl");
+ webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
}
Map obj = new HashMap<>();
@@ -228,9 +229,9 @@ public class InAppBrowserActivity extends AppCompatActivity {
}
}
- public void loadData(String data, String mimeType, String encoding, String baseUrl, MethodChannel.Result result) {
+ public void loadData(String data, String mimeType, String encoding, String baseUrl, String historyUrl, MethodChannel.Result result) {
if (webView != null) {
- webView.loadData(data, mimeType, encoding, baseUrl, result);
+ webView.loadData(data, mimeType, encoding, baseUrl, historyUrl, result);
} else {
result.error(LOG_TAG, "webView is null", null);
}
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java
index a4fe8adb..38a86bef 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java
@@ -794,8 +794,8 @@ final public class InAppWebView extends InputAwareWebView {
result.success(true);
}
- public void loadData(String data, String mimeType, String encoding, String baseUrl, MethodChannel.Result result) {
- loadDataWithBaseURL(baseUrl, data, mimeType, encoding, null);
+ public void loadData(String data, String mimeType, String encoding, String baseUrl, String historyUrl, MethodChannel.Result result) {
+ loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
result.success(true);
}
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewChromeClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewChromeClient.java
index 8f255334..d2c02781 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewChromeClient.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebViewChromeClient.java
@@ -98,7 +98,16 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
this.mCustomViewCallback = paramCustomViewCallback;
this.mCustomView.setBackgroundColor(Color.parseColor("#000000"));
((FrameLayout) decorView).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1));
- decorView.setSystemUiVisibility(3846 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+ decorView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ // Set the content to appear under the system bars so that the
+ // content doesn't resize when the system bars hide and show.
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ // Hide the nav bar and status bar
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN);
}
@Override
diff --git a/example/assets/index.html b/example/assets/index.html
index 7cd13b03..a5c09316 100644
--- a/example/assets/index.html
+++ b/example/assets/index.html
@@ -4,7 +4,7 @@
- Flutter InAppBrowser
+ Flutter InAppWebView
@@ -14,7 +14,7 @@
+