- 
                Notifications
    You must be signed in to change notification settings 
- Fork 269
Enable wk cookie store #171
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
base: master
Are you sure you want to change the base?
Conversation
| We need this! | 
0e784be    to
    3eac1f5      
    Compare
  
    | That´s really cool! Thank you! | 
| +1 | 
| The code looks good to me. However, I don't really have time to test it myself. Can anyone conduct some tests? If it works, I'd be happy to merge this change. | 
| can we use it with "react-native-cookies", i didn't understand how can we use this please can you give us an example thanks. | 
| You would use react-native-cookies, the way you normally use it. The only difference would be to use the  | 
8dff228    to
    36c7c36      
    Compare
  
    | This looks great and works really well. Is there a plan to merge this? If there is any testing required to make this ready to merge, I am happy to help. | 
| [cDesc appendFormat:@"domain=%@;", [cookie domain]]; | ||
| if ([cookie.path length] > 0) | ||
| [cDesc appendFormat:@"path=%@;", [cookie path]]; | ||
| if (cookie.expiresDate != nil) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its missing HttpOnly, secure and sessionOnly property. Is this something you would be able to add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the HttpOnly: I can do that,
for the sessionOnly there ist no such thing, If there is no expire date than it should be a session cookie, otherwise it will be stored until the expire date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://developer.apple.com/documentation/foundation/nshttpcookie/1392991-sessiononly?language=objc
I was referencing that boolean to indicate its a session only cookie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Thanks for fixing this issue!
50a49a8    to
    7f2e56d      
    Compare
  
    |  | ||
| #pragma mark - WKNavigationDelegate methods | ||
|  | ||
| - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are duplicate methods with this same name, can you please fix this? This is breaking my build with compilation issue
| RCTLogWarn(@"Webview Process Terminated"); | ||
| } | ||
|  | ||
| - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick response. Appreciate it
To improve the cookie handling a new option
useWKCookieStoreis introduced.When using
useWKCookieStore, the cookies fromHTTPCookieStorageget copied to the webView’sWKHTTPCookieStorage.The cookie Plugins https://github.com/joeferraro/react-native-cookies/ and https://github.com/shimohq/react-native-cookie do not support
WKHTTPCookieStorageat the moment and useNSHTTPCookieStorageto save the cookies.That's why the cookies are copied from the
NSHTTPCookieStorage.A workaround is used to initialize the
WKHTTPCookieStoragecorrectly. The WebKit bug https://bugs.webkit.org/show_bug.cgi?id=185483 prevents the initialization.