Commit e4d8b798 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

updated locationchange iOS javascript event name, updated...

updated locationchange iOS javascript event name, updated javaScriptHandlerForbiddenNames dart variable
parent 16de8b19
This diff is collapsed.
...@@ -463,7 +463,7 @@ let interceptNavigationStateChangeJS = """ ...@@ -463,7 +463,7 @@ let interceptNavigationStateChangeJS = """
return function pushState(){ return function pushState(){
var ret = f.apply(this, arguments); var ret = f.apply(this, arguments);
window.dispatchEvent(new Event('pushstate')); window.dispatchEvent(new Event('pushstate'));
window.dispatchEvent(new Event('locationchange')); window.dispatchEvent(new Event('_flutter_inappbrowser_locationchange'));
return ret; return ret;
}; };
})(history.pushState); })(history.pushState);
...@@ -471,14 +471,14 @@ let interceptNavigationStateChangeJS = """ ...@@ -471,14 +471,14 @@ let interceptNavigationStateChangeJS = """
return function replaceState(){ return function replaceState(){
var ret = f.apply(this, arguments); var ret = f.apply(this, arguments);
window.dispatchEvent(new Event('replacestate')); window.dispatchEvent(new Event('replacestate'));
window.dispatchEvent(new Event('locationchange')); window.dispatchEvent(new Event('_flutter_inappbrowser_locationchange'));
return ret; return ret;
}; };
})(history.replaceState); })(history.replaceState);
window.addEventListener('popstate',function() { window.addEventListener('popstate',function() {
window.dispatchEvent(new Event('locationchange')); window.dispatchEvent(new Event('_flutter_inappbrowser_locationchange'));
}); });
window.addEventListener('locationchange', function() { window.addEventListener('_flutter_inappbrowser_locationchange', function() {
window.webkit.messageHandlers["onNavigationStateChange"].postMessage(JSON.stringify({ window.webkit.messageHandlers["onNavigationStateChange"].postMessage(JSON.stringify({
url: document.location.href url: document.location.href
})); }));
......
...@@ -16,7 +16,7 @@ import 'types.dart'; ...@@ -16,7 +16,7 @@ import 'types.dart';
import 'in_app_browser.dart'; import 'in_app_browser.dart';
import 'webview_options.dart'; import 'webview_options.dart';
const javaScriptHandlersNameForbidden = ["onLoadResource", "shouldInterceptAjaxRequest", "onAjaxReadyStateChange", "onAjaxEvent"]; const javaScriptHandlerForbiddenNames = ["onLoadResource", "shouldInterceptAjaxRequest", "onAjaxReadyStateChange", "onAjaxProgress", "shouldInterceptFetchRequest"];
///InAppWebView Widget class. ///InAppWebView Widget class.
/// ///
...@@ -1144,7 +1144,7 @@ class InAppWebViewController { ...@@ -1144,7 +1144,7 @@ class InAppWebViewController {
/// """); /// """);
///``` ///```
void addJavaScriptHandler(String handlerName, JavaScriptHandlerCallback callback) { void addJavaScriptHandler(String handlerName, JavaScriptHandlerCallback callback) {
assert(!javaScriptHandlersNameForbidden.contains(handlerName)); assert(!javaScriptHandlerForbiddenNames.contains(handlerName));
this.javaScriptHandlersMap[handlerName] = (callback); this.javaScriptHandlersMap[handlerName] = (callback);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment