-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
CookieManager.instance.flush() #2354
Comments
flush is already called when setting or deleting cookies on Android, for example: Line 363 in f67ae1f
Maybe the flush() method call should be moved inside the |
Sorry, i was not enough precise. The issue is present when a cookie is set or removed by a webpage (not by Flutter). In this case, if user kill the app few times after and relaunch it, cookie will not be here (in case of creation) or still be here (in case of deletion). For example we have a scenario where when an users launch the app, they can see a webview to accept or not cookie "consent" (for tracking purpose). Once accepted or rejected we receive a postMessage from our webview to inform us to close the webview. That's why we found calling .flush() before closing webview seems to well fix the issue. |
Ok, clear now, thanks! So then I will expose that method on Android as soon as possible 👍 |
You rock ! Ty so much ! |
Exposing flush() will be great and can help other future scenario on Android. We got also the issue on iOS but this time we didn't have any suggestion / solution. I can create a dedicated issue if you want. |
iOS doesn't have any "flush()" method: https://developer.apple.com/documentation/webkit/wkhttpcookiestore |
Yes, will create new issue for iOS, it will be clean. |
Released new version |
…tic method, Added CookieManager.flush method, Updated InAppWebViewController.takeScreenshot implementation to support screenshot out of visible viewport when InAppWebViewController.enableSlowWholeDocumentDraw is called, fix pichillilorenzo#2354
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
Is there an existing feature request for this?
Operating System
Android
Pain
I've the same issue as react-native-webview/react-native-webview#1345.
If you remove a cookie in the web view and then kill the application in the recent application list on Android. When you launch again the application, the cookie is still here.
He does the same if you set a cookie and kill the app few seconds after, the cookie will not be here.
It seems ok on iOS.
Suggested solution
Adding a method to manually call Android
getCookieManager().flush();
https://github.com/react-native-cookies/cookies/blob/69fe6557b0f2c286e6df6fa9100391ad2d163860/android/src/main/java/com/reactnativecommunity/cookies/CookieManagerModule.java#L96
A temporary solution is to delete a random fake cookie :
This will call on Android
getCookieManager().flush();
without regarding if deletion succeed or failed.Useful resources
https://developer.android.com/reference/android/webkit/CookieManager#flush()
Additional information
Flutter 3.24
Self grab
The text was updated successfully, but these errors were encountered: