Repository navigation
[webview_flutter] Platform implementations for getCookies #11037 #11386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
9b66f6c
4f2f4e8
150d9cc
b5f94a5
2d5a916
0cd5df3
092db6e
45fa55f
0f9fc43
8fcd044
d60c7b1
3ec2eb1
5c25776
09a5802
2f01b98
ab380f1
a7bc03c
8ac1939
979af46
14facae
f1accca
f258911
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -87,4 +87,26 @@ class AndroidWebViewCookieManager extends PlatformWebViewCookieManager { | |||||||||||||||||||||||||||||||||
| .getInstanceWithWeakReference(controller.webViewIdentifier)!; | ||||||||||||||||||||||||||||||||||
| return _cookieManager.setAcceptThirdPartyCookies(webView, accept); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| @override | ||||||||||||||||||||||||||||||||||
| Future<List<WebViewCookie>> getCookies(Uri url) async { | ||||||||||||||||||||||||||||||||||
| final String? cookies = await _cookieManager.getCookies(url.toString()); | ||||||||||||||||||||||||||||||||||
| if (cookies == null || cookies.isEmpty) { | ||||||||||||||||||||||||||||||||||
| return []; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| final webViewCookies = <WebViewCookie>[]; | ||||||||||||||||||||||||||||||||||
| for (final String cookie in cookies.split('; ')) { | ||||||||||||||||||||||||||||||||||
| final List<String> cookieValue = cookie.split('='); | ||||||||||||||||||||||||||||||||||
| webViewCookies.add( | ||||||||||||||||||||||||||||||||||
| WebViewCookie( | ||||||||||||||||||||||||||||||||||
| name: cookieValue.first, | ||||||||||||||||||||||||||||||||||
| value: cookieValue.last, | ||||||||||||||||||||||||||||||||||
| domain: url.toString(), | ||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+100
to
+107
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current cookie parsing logic is incorrect if a cookie's value contains an equals sign ( To correctly parse the cookie, you should take everything after the first
Suggested change
|
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return webViewCookies; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.