[TIMOB-26915] iOS: Implement cookie in TiUIWebView using WKHTTPCookieStore
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | None |
Status | In Review |
Resolution | Unresolved |
Affected Version/s | Release 8.0.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | breaking-change, cookies, webview |
Reporter | Vijay Singh |
Assignee | Vijay Singh |
Created | 2019-03-20T21:09:40.000+0000 |
Updated | 2021-03-22T19:22:07.000+0000 |
Description
From SDK 8.0.0 we have started using WKWebView. NSHTTPCookie is not compatible with WKWebView.
From iOS 11+ apple has given WKHTTPCookieStore in WKWebView to support cookie.
We need to use WKHTTPCookieStore to implement cookie for iOS 11.0+.
Currently we have implemented using description as given in below link -
https://stackoverflow.com/questions/26573137
https://github.com/haifengkao/YWebView
Following points need to be considered while implementation -
1. In titanium cookies are cross platform. So parity should be there.
2. It should be supported for iOS <11.0 as we minimum iOS version in SDK is 9.0
Edit -
1. From SDK 10, minimum iOS target is iOS 11. Now it can be implemented without worrying about point 2 .
2. It will be breaking change as it will not sync with Ti.Network.HTTPClient cookies. Every webview will have its own cookie management.
3. Can we have android parity as well?
4. New WebView cookie APIs -
Method -
a) webview.addCookie(Titanium.Network.Cookie);
b) webview.removeCookie('domain', 'path', 'name');
c) webview.removeAllCookies();
d) webview.removeCookiesForDomain('domain') -> Array(Titanium.Network.Cookie)
e) webview.getCookies(''domain', 'path', 'name') -> Array(Titanium.Network.Cookie)
f) webview.cookiesForDomain('domain') -> Array(Titanium.Network.Cookie)
Property (read-only) -
e) webview.allCookies -> Array(Titanium.Network.Cookie)
PR - https://github.com/appcelerator/titanium_mobile/pull/12451