CookieManager.deleteCookies wait for all delete cookie completion handler to be completed on iOS and macOS, fix #1678
This commit is contained in:
parent
1a8f7b1814
commit
be570be6b0
|
@ -1,6 +1,7 @@
|
|||
## 6.0.0-beta.26
|
||||
|
||||
- Throw an error if any controller is used after being disposed
|
||||
- `CookieManager.deleteCookies` wait for all delete cookie completion handler to be completed on iOS and macOS
|
||||
- Updated return value for `CookieManager.setCookie` method to be `Future<bool>`. The return value indicates whether the cookie was set successfully
|
||||
- Merged "feat(ios): optional tradeoff to fix ios input delay" [#1665](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1665) (thanks to [andreasgangso](https://github.com/andreasgangso))
|
||||
- Merged "Fix ios multiple flutter presenting error" [#1736](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1736) (thanks to [AlexT84](https://github.com/AlexT84))
|
||||
|
@ -10,6 +11,7 @@
|
|||
- Merged "fix: chrome tab open failed due to chrome process not running" [#1772](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1772) (thanks to [YumengNevix](https://github.com/YumengNevix))
|
||||
- Merged "Android - Fix context menu position for pages with horizontal scroll" [#1504](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1504) (thanks to [lrorpilla](https://github.com/lrorpilla))
|
||||
- Fixed "iOS about:blank popup not loading page" [#1500](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1500)
|
||||
- Fixed "iOS macOS - This method should not be called on the main thread as it may lead to UI unresponsiveness" [#1678](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678)
|
||||
|
||||
## 6.0.0-beta.25
|
||||
|
||||
|
|
|
@ -2042,9 +2042,13 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
|||
return
|
||||
}
|
||||
|
||||
if let scheme = challenge.protectionSpace.protocol, scheme == "https",
|
||||
let sslCertificate = challenge.protectionSpace.sslCertificate {
|
||||
InAppWebView.sslCertificatesMap[challenge.protectionSpace.host] = sslCertificate
|
||||
// workaround for ProtectionSpace SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
if let scheme = challenge.protectionSpace.protocol, scheme == "https",
|
||||
let sslCertificate = challenge.protectionSpace.sslCertificate {
|
||||
InAppWebView.sslCertificatesMap[challenge.protectionSpace.host] = sslCertificate
|
||||
}
|
||||
}
|
||||
|
||||
let callback = WebViewChannelDelegate.ReceivedServerTrustAuthRequestCallback()
|
||||
|
|
|
@ -886,7 +886,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback);
|
||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
||||
|
@ -910,7 +910,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback);
|
||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public func onLoadStart(url: String?) {
|
||||
|
@ -965,7 +965,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: challenge.toMap(), callback: callback)
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ReceivedServerTrustAuthRequestCallback : BaseCallbackResult<ServerTrustAuthResponse> {
|
||||
|
@ -986,7 +993,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: challenge.toMap(), callback: callback);
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ReceivedClientCertRequestCallback : BaseCallbackResult<ClientCertResponse> {
|
||||
|
@ -1007,7 +1021,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: challenge.toMap(), callback: callback);
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func onZoomScaleChanged(newScale: Float, oldScale: Float) {
|
||||
|
@ -1061,7 +1082,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
"handlerName": handlerName,
|
||||
"args": args
|
||||
]
|
||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback);
|
||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||
}
|
||||
|
||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||
|
@ -1085,7 +1106,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback);
|
||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
||||
|
@ -1109,7 +1130,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: challenge.toMap(), callback: callback)
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func onWebContentProcessDidTerminate() {
|
||||
|
|
|
@ -249,6 +249,7 @@ public class MyCookieManager: ChannelDelegate {
|
|||
|
||||
public static func deleteCookies(url: String, path: String, domain: String?, result: @escaping FlutterResult) {
|
||||
var domain = domain
|
||||
let dispatchGroup = DispatchGroup()
|
||||
MyCookieManager.httpCookieStore.getAllCookies { (cookies) in
|
||||
for cookie in cookies {
|
||||
var originURL = url
|
||||
|
@ -266,10 +267,15 @@ public class MyCookieManager: ChannelDelegate {
|
|||
}
|
||||
}
|
||||
if let domain = domain, cookie.domain == domain, cookie.path == path {
|
||||
MyCookieManager.httpCookieStore.delete(cookie, completionHandler: nil)
|
||||
dispatchGroup.enter()
|
||||
MyCookieManager.httpCookieStore.delete(cookie) {
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
}
|
||||
}
|
||||
result(true)
|
||||
dispatchGroup.notify(queue: .main) {
|
||||
result(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1424,9 +1424,13 @@ public class InAppWebView: WKWebView, WKUIDelegate,
|
|||
return
|
||||
}
|
||||
|
||||
if let scheme = challenge.protectionSpace.protocol, scheme == "https",
|
||||
let sslCertificate = challenge.protectionSpace.sslCertificate {
|
||||
InAppWebView.sslCertificatesMap[challenge.protectionSpace.host] = sslCertificate
|
||||
// workaround for ProtectionSpace SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
if let scheme = challenge.protectionSpace.protocol, scheme == "https",
|
||||
let sslCertificate = challenge.protectionSpace.sslCertificate {
|
||||
InAppWebView.sslCertificatesMap[challenge.protectionSpace.host] = sslCertificate
|
||||
}
|
||||
}
|
||||
|
||||
let callback = WebViewChannelDelegate.ReceivedServerTrustAuthRequestCallback()
|
||||
|
|
|
@ -849,7 +849,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback);
|
||||
channel.invokeMethod("onPermissionRequest", arguments: request.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public class ShouldOverrideUrlLoadingCallback : BaseCallbackResult<WKNavigationActionPolicy> {
|
||||
|
@ -873,7 +873,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback);
|
||||
channel.invokeMethod("shouldOverrideUrlLoading", arguments: navigationAction.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public func onLoadStart(url: String?) {
|
||||
|
@ -928,7 +928,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: challenge.toMap(), callback: callback)
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedHttpAuthRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ReceivedServerTrustAuthRequestCallback : BaseCallbackResult<ServerTrustAuthResponse> {
|
||||
|
@ -949,7 +956,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: challenge.toMap(), callback: callback);
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedServerTrustAuthRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ReceivedClientCertRequestCallback : BaseCallbackResult<ClientCertResponse> {
|
||||
|
@ -970,7 +984,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: challenge.toMap(), callback: callback);
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("onReceivedClientCertRequest", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func onZoomScaleChanged(newScale: Float, oldScale: Float) {
|
||||
|
@ -1024,7 +1045,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
"handlerName": handlerName,
|
||||
"args": args
|
||||
]
|
||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback);
|
||||
channel.invokeMethod("onCallJsHandler", arguments: arguments, callback: callback)
|
||||
}
|
||||
|
||||
public class NavigationResponseCallback : BaseCallbackResult<WKNavigationResponsePolicy> {
|
||||
|
@ -1048,7 +1069,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback);
|
||||
channel.invokeMethod("onNavigationResponse", arguments: navigationResponse.toMap(), callback: callback)
|
||||
}
|
||||
|
||||
public class ShouldAllowDeprecatedTLSCallback : BaseCallbackResult<Bool> {
|
||||
|
@ -1072,7 +1093,14 @@ public class WebViewChannelDelegate : ChannelDelegate {
|
|||
callback.defaultBehaviour(nil)
|
||||
return
|
||||
}
|
||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: challenge.toMap(), callback: callback)
|
||||
// workaround for ProtectionSpace.toMap() SSL Certificate
|
||||
// https://github.com/pichillilorenzo/flutter_inappwebview/issues/1678
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
let arguments = challenge.toMap()
|
||||
DispatchQueue.main.async {
|
||||
channel.invokeMethod("shouldAllowDeprecatedTLS", arguments: arguments, callback: callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func onWebContentProcessDidTerminate() {
|
||||
|
|
|
@ -245,6 +245,7 @@ public class MyCookieManager: ChannelDelegate {
|
|||
|
||||
public static func deleteCookies(url: String, path: String, domain: String?, result: @escaping FlutterResult) {
|
||||
var domain = domain
|
||||
let dispatchGroup = DispatchGroup()
|
||||
MyCookieManager.httpCookieStore.getAllCookies { (cookies) in
|
||||
for cookie in cookies {
|
||||
var originURL = url
|
||||
|
@ -258,10 +259,15 @@ public class MyCookieManager: ChannelDelegate {
|
|||
domain = domainUrl.host
|
||||
}
|
||||
if let domain = domain, cookie.domain == domain, cookie.path == path {
|
||||
MyCookieManager.httpCookieStore.delete(cookie, completionHandler: nil)
|
||||
dispatchGroup.enter()
|
||||
MyCookieManager.httpCookieStore.delete(cookie) {
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
}
|
||||
}
|
||||
result(true)
|
||||
dispatchGroup.notify(queue: .main) {
|
||||
result(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ if [ -z "$NODE_SERVER_IP" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORM=$2
|
||||
DEVICE_ID=$2
|
||||
FAILED=0
|
||||
|
||||
if [ ! -z "$2" ] && [ $PLATFORM = "web" ]; then
|
||||
if [ ! -z "$2" ] && [ $DEVICE_ID = "chrome" ]; then
|
||||
$PROJECT_DIR/tool/chromedriver --port=4444 &
|
||||
fi
|
||||
|
||||
|
@ -39,12 +39,13 @@ node index.js &
|
|||
adb shell "echo '_ --disable-digital-asset-link-verification-for-url=\"https://flutter.dev\"' > /data/local/tmp/chrome-command-line" || true
|
||||
|
||||
flutter --version
|
||||
flutter devices
|
||||
flutter clean
|
||||
flutter pub get
|
||||
cd $PROJECT_DIR/example
|
||||
flutter clean
|
||||
if [ ! -z "$2" ] && [ $PLATFORM = "web" ]; then
|
||||
flutter driver --driver=test_driver/integration_test.dart --target=integration_test/webview_flutter_test.dart --device-id=chrome
|
||||
if [ ! -z "$2" ]; then
|
||||
flutter driver --driver=test_driver/integration_test.dart --target=integration_test/webview_flutter_test.dart --device-id=$DEVICE_ID
|
||||
else
|
||||
flutter driver --driver=test_driver/integration_test.dart --target=integration_test/webview_flutter_test.dart
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue