Updated return value for CookieManager.setCookie method to be Future<bool>
This commit is contained in:
parent
897d404108
commit
6f819b2dbf
@ -1,5 +1,6 @@
|
||||
## 6.0.0-beta.26
|
||||
|
||||
- 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))
|
||||
- Merged "fix cert parsing for ios 12" [#1822](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1822) (thanks to [darkang3lz92](https://github.com/darkang3lz92))
|
||||
|
@ -180,8 +180,8 @@ public class MyCookieManager extends ChannelDelegateImpl {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cookieManager.setCookie(url, cookieValue, new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
public void onReceiveValue(Boolean aBoolean) {
|
||||
result.success(true);
|
||||
public void onReceiveValue(Boolean successful) {
|
||||
result.success(successful);
|
||||
}
|
||||
});
|
||||
cookieManager.flush();
|
||||
@ -297,7 +297,7 @@ public class MyCookieManager extends ChannelDelegateImpl {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cookieManager.setCookie(url, cookieValue, new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
public void onReceiveValue(Boolean aBoolean) {
|
||||
public void onReceiveValue(Boolean successful) {
|
||||
result.success(true);
|
||||
}
|
||||
});
|
||||
@ -364,7 +364,7 @@ public class MyCookieManager extends ChannelDelegateImpl {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
|
||||
@Override
|
||||
public void onReceiveValue(Boolean aBoolean) {
|
||||
public void onReceiveValue(Boolean successful) {
|
||||
result.success(true);
|
||||
}
|
||||
});
|
||||
|
@ -65,6 +65,9 @@ class CookieManager {
|
||||
///[webViewController] could be used if you need to set a session-only cookie using JavaScript (so [isHttpOnly] cannot be set, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)
|
||||
///on the current URL of the [WebView] managed by that controller when you need to target iOS below 11, MacOS below 10.13 and Web platform. In this case the [url] parameter is ignored.
|
||||
///
|
||||
///The return value indicates whether the cookie was set successfully.
|
||||
///Note that it will return always `true` for Web platform, iOS below 11.0 and MacOS below 10.13.
|
||||
///
|
||||
///**NOTE for iOS below 11.0 and MacOS below 10.13**: If [webViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
|
||||
///to set the cookie (session-only cookie won't work! In that case, you should set also [expiresDate] or [maxAge]).
|
||||
///
|
||||
@ -77,7 +80,7 @@ class CookieManager {
|
||||
///- iOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie))
|
||||
///- MacOS ([Official API - WKHTTPCookieStore.setCookie](https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882007-setcookie))
|
||||
///- Web
|
||||
Future<void> setCookie(
|
||||
Future<bool> setCookie(
|
||||
{required WebUri url,
|
||||
required String name,
|
||||
required String value,
|
||||
@ -110,7 +113,7 @@ class CookieManager {
|
||||
isSecure: isSecure,
|
||||
sameSite: sameSite,
|
||||
webViewController: webViewController);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
@ -125,7 +128,7 @@ class CookieManager {
|
||||
args.putIfAbsent('isHttpOnly', () => isHttpOnly);
|
||||
args.putIfAbsent('sameSite', () => sameSite?.toNativeValue());
|
||||
|
||||
await _channel.invokeMethod('setCookie', args);
|
||||
return await _channel.invokeMethod('setCookie', args);
|
||||
}
|
||||
|
||||
Future<void> _setCookieWithJavaScript(
|
||||
|
Loading…
x
Reference in New Issue
Block a user