mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[webview_flutter_wkwebview] Only set limitsNavigationsToAppBoundDomains
when it is set to true (#5137)
This changes the flag to only flag to only call the method if it sets it to `true`. Fixes https://github.com/flutter/flutter/issues/136449
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
## 3.9.2
|
||||||
|
|
||||||
|
* Fixes error caused by calling `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` on
|
||||||
|
versions below 14.
|
||||||
|
|
||||||
## 3.9.1
|
## 3.9.1
|
||||||
|
|
||||||
* Fixes bug where `WebkitWebViewController.getUserAgent` was incorrectly returning an empty String.
|
* Fixes bug where `WebkitWebViewController.getUserAgent` was incorrectly returning an empty String.
|
||||||
|
@ -70,8 +70,14 @@ class WebKitWebViewControllerCreationParams
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
_configuration.setAllowsInlineMediaPlayback(allowsInlineMediaPlayback);
|
_configuration.setAllowsInlineMediaPlayback(allowsInlineMediaPlayback);
|
||||||
_configuration.setLimitsNavigationsToAppBoundDomains(
|
// `WKWebViewConfiguration.limitsNavigationsToAppBoundDomains` is only
|
||||||
limitsNavigationsToAppBoundDomains);
|
// supported on iOS versions 14+. So this only calls it if the value is set
|
||||||
|
// to true.
|
||||||
|
if (limitsNavigationsToAppBoundDomains) {
|
||||||
|
_configuration.setLimitsNavigationsToAppBoundDomains(
|
||||||
|
limitsNavigationsToAppBoundDomains,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a [WebKitWebViewControllerCreationParams] using a
|
/// Constructs a [WebKitWebViewControllerCreationParams] using a
|
||||||
|
@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
|
|||||||
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
|
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
|
||||||
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
|
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
|
||||||
version: 3.9.1
|
version: 3.9.2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.0 <4.0.0"
|
sdk: ">=2.19.0 <4.0.0"
|
||||||
|
@ -160,6 +160,25 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(
|
||||||
|
'limitsNavigationsToAppBoundDomains is not called if it uses default value (false)',
|
||||||
|
() {
|
||||||
|
final MockWKWebViewConfiguration mockConfiguration =
|
||||||
|
MockWKWebViewConfiguration();
|
||||||
|
|
||||||
|
WebKitWebViewControllerCreationParams(
|
||||||
|
webKitProxy: WebKitProxy(
|
||||||
|
createWebViewConfiguration: ({InstanceManager? instanceManager}) {
|
||||||
|
return mockConfiguration;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
verifyNever(
|
||||||
|
mockConfiguration.setLimitsNavigationsToAppBoundDomains(any),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('mediaTypesRequiringUserAction', () {
|
test('mediaTypesRequiringUserAction', () {
|
||||||
final MockWKWebViewConfiguration mockConfiguration =
|
final MockWKWebViewConfiguration mockConfiguration =
|
||||||
MockWKWebViewConfiguration();
|
MockWKWebViewConfiguration();
|
||||||
|
Reference in New Issue
Block a user