Save all retrieved cookies and get cookies using javascript#18
Save all retrieved cookies and get cookies using javascript#18kheldiente wants to merge 2 commits into
Conversation
5addbc6 to
cba1960
Compare
Kofktu
left a comment
There was a problem hiding this comment.
Instead of creating a separate value called recordCookies,
store the cookie values in HTTPCookieStorage
In the service, it would be better to know through callback(onUpdateCookieStroage).
| // The closure where cookie information is called at update time | ||
| @objc public var onUpdateCookieStorage: ((WKCookieWebView) -> Void)? | ||
|
|
||
| @objc public var recordedCookies: [HTTPCookie] = []; |
There was a problem hiding this comment.
Variables managed only internally
I think private would be better than public.
| @objc public func deleteRecordedCookie(_ cookie: HTTPCookie) { | ||
| recordedCookies.removeAll(where: { $0.name == cookie.name }) | ||
| } | ||
|
|
Hi @Kofktu , as per testing on my end, setting cookies to HTTPCookieStorage does not work in iOS 10 or lower. I believe this has something to do with evaluateDocumentCookies(webView: WKWebView) having dummy properties in cookies. Also, this validates the intention for storing it in a dedicated array and enabling clients to browse all cookies retrieved by WKCookieWebView, hence it is public. For deleteRecordedCookie(_ cookie: HTTPCookie), I'll remove that one. Commit for improvement is here. |
Uh oh!
There was an error while loading. Please reload this page.