This commit is contained in:
Lorenzo Pichilli 2023-11-14 23:13:02 +01:00
parent acb20fc10a
commit b190d02925
2 changed files with 14 additions and 10 deletions

View File

@ -5,6 +5,7 @@
- Added support for Android `WebViewFeature.isStartupFeatureSupported`, `WebViewFeature.STARTUP_FEATURE_SET_DIRECTORY_BASE_PATHS`, `WebViewFeature.STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX`, `WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER` - Added support for Android `WebViewFeature.isStartupFeatureSupported`, `WebViewFeature.STARTUP_FEATURE_SET_DIRECTORY_BASE_PATHS`, `WebViewFeature.STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX`, `WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER`
- Added `WebMessage.type` property - Added `WebMessage.type` property
- Fixed "iOS EXC_BAD_ACCESS crash on kill app with InAppWebView keyboard open" [#1837](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1837) - Fixed "iOS EXC_BAD_ACCESS crash on kill app with InAppWebView keyboard open" [#1837](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1837)
- Fixed "Flutter Web - TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. error" [#1841](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1841)
### BREAKING CHANGES ### BREAKING CHANGES

View File

@ -139,18 +139,21 @@ window.flutter_inappwebview = {
} }
var initialTitle = iframe.contentDocument.title; var initialTitle = iframe.contentDocument.title;
var titleEl = iframe.contentDocument.querySelector('title');
webView.documentTitle = initialTitle; webView.documentTitle = initialTitle;
window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [initialTitle]); window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [initialTitle]);
new MutationObserver(function(mutations) { if (titleEl != null) {
var title = mutations[0].target.innerText; new MutationObserver(function(mutations) {
if (title != webView.documentTitle) { var title = mutations[0].target.innerText;
webView.documentTitle = title; if (title != webView.documentTitle) {
window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [title]); webView.documentTitle = title;
} window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [title]);
}).observe( }
iframe.contentDocument.querySelector('title'), }).observe(
{ subtree: true, characterData: true, childList: true } titleEl,
); { subtree: true, characterData: true, childList: true }
);
}
var oldPixelRatio = iframe.contentWindow.devicePixelRatio; var oldPixelRatio = iframe.contentWindow.devicePixelRatio;
iframe.contentWindow.addEventListener('resize', function (e) { iframe.contentWindow.addEventListener('resize', function (e) {