diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 638eec5d..3576e27d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -15,33 +15,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
@@ -64,8 +47,8 @@
-
-
+
+
@@ -73,11 +56,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -100,26 +95,17 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -130,17 +116,8 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -157,10 +134,6 @@
- initialOpti
- Platform
- Platform.i
- getOption
.toValue
fromValue(
?.toMap());
@@ -187,6 +160,10 @@
onAjaxEvent
shouldInterceptAjaxRequest
shouldInterceptFetchRequest
+ onAjaxProgress
+ onAjaxReady
+ NAVIGATION
+ onNavigationStateChange
activity.getPreferences(0)
@@ -251,18 +228,18 @@
-
-
-
-
-
+
+
+
+
+
@@ -284,17 +261,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -337,17 +303,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -377,6 +332,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -541,7 +507,7 @@
-
+
@@ -549,7 +515,7 @@
-
+
@@ -766,13 +732,10 @@
-
+
-
-
-
-
-
+
+
@@ -783,43 +746,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
@@ -836,15 +778,39 @@
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b884586..9169ec81 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,7 +27,8 @@
- Added `onReceivedServerTrustAuthRequest` and `onReceivedClientCertRequest` events to manage SSL requests
- Added `onFindResultReceived` event, `findAllAsync`, `findNext` and `clearMatches` methods
- Added `getHtml`, `injectJavascriptFileFromAsset` and `injectCSSFileFromAsset` methods
-- Added `shouldInterceptAjaxRequest`, `onAjaxReadyStateChange`, `onAjaxProgressEvent` and `shouldInterceptFetchRequest` events with `useShouldInterceptAjaxRequest` and `useShouldInterceptFetchRequest` webview options
+- Added `shouldInterceptAjaxRequest`, `onAjaxReadyStateChange`, `onAjaxProgress` and `shouldInterceptFetchRequest` events with `useShouldInterceptAjaxRequest` and `useShouldInterceptFetchRequest` webview options
+- Added `onNavigationStateChange` event
- Fun: added `getTRexRunnerHtml` and `getTRexRunnerCss` methods to get html (with javascript) and css to recreate the Chromium's t-rex runner game
### BREAKING CHANGES
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
index c3b61968..4ae9bb68 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
@@ -154,9 +154,9 @@ final public class InAppWebView extends InputAwareWebView {
" lengthComputable: e.lengthComputable" +
" }" +
" };" +
- " window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxProgressEvent', ajaxRequest).then(function(result) {" +
+ " window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxProgress', ajaxRequest).then(function(result) {" +
" if (result != null) {" +
- " switch (result.action) {" +
+ " switch (result) {" +
" case 0:" +
" self.abort();" +
" return;" +
@@ -197,7 +197,7 @@ final public class InAppWebView extends InputAwareWebView {
" };" +
" window." + JavaScriptBridgeInterface.name + ".callHandler('onAjaxReadyStateChange', ajaxRequest).then(function(result) {" +
" if (result != null) {" +
- " switch (result.action) {" +
+ " switch (result) {" +
" case 0:" +
" self.abort();" +
" return;" +
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java
index ae397965..88b630ed 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java
@@ -49,9 +49,9 @@ public class InAppWebViewClient extends WebViewClient {
private FlutterWebView flutterWebView;
private InAppBrowserActivity inAppBrowserActivity;
Map statusCodeMapping = new HashMap();
- long startPageTime = 0;
private static int previousAuthRequestFailureCount = 0;
private static List credentialsProposed = null;
+ private String onPageStartedURL = "";
public InAppWebViewClient(Object obj) {
super();
@@ -145,9 +145,9 @@ public class InAppWebViewClient extends WebViewClient {
webView.loadUrl("javascript:" + InAppWebView.resourceObserverJS.replaceAll("[\r\n]+", ""));
}
+ onPageStartedURL = url;
super.onPageStarted(view, url, favicon);
- startPageTime = System.currentTimeMillis();
webView.isLoading = true;
if (inAppBrowserActivity != null && inAppBrowserActivity.searchView != null && !url.equals(inAppBrowserActivity.searchView.getQuery().toString())) {
inAppBrowserActivity.searchView.setQuery(url, false);
@@ -194,6 +194,21 @@ public class InAppWebViewClient extends WebViewClient {
getChannel().invokeMethod("onLoadStop", obj);
}
+ @Override
+ public void doUpdateVisitedHistory (WebView view, String url, boolean isReload) {
+ super.doUpdateVisitedHistory(view, url, isReload);
+
+ if (!isReload && !url.equals(onPageStartedURL)) {
+ onPageStartedURL = "";
+ Map obj = new HashMap<>();
+ if (inAppBrowserActivity != null)
+ obj.put("uuid", inAppBrowserActivity.uuid);
+ obj.put("url", url);
+ getChannel().invokeMethod("onNavigationStateChange", obj);
+ }
+ }
+
+ @Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
diff --git a/example/assets/index.html b/example/assets/index.html
index 4930ba70..5bcf2652 100644
--- a/example/assets/index.html
+++ b/example/assets/index.html
@@ -31,6 +31,9 @@
+
+
+
@@ -51,6 +54,27 @@