fix(incognito): Ensures that incognito doesn't clear cookies when not enabled (#1447 by @jasonkellydk)
Co-authored-by: Jason Kelly <jason.kelly@isobar.com> Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com> Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
This commit is contained in:
parent
7513f198c1
commit
63c584c647
|
@ -432,6 +432,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|||
|
||||
@ReactProp(name = "incognito")
|
||||
public void setIncognito(WebView view, boolean enabled) {
|
||||
// Don't do anything when incognito is disabled
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove all previous cookies
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
CookieManager.getInstance().removeAllCookies(null);
|
||||
|
@ -441,14 +446,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|||
|
||||
// Disable caching
|
||||
view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
view.getSettings().setAppCacheEnabled(!enabled);
|
||||
view.getSettings().setAppCacheEnabled(false);
|
||||
view.clearHistory();
|
||||
view.clearCache(enabled);
|
||||
view.clearCache(true);
|
||||
|
||||
// No form data or autofill enabled
|
||||
view.clearFormData();
|
||||
view.getSettings().setSavePassword(!enabled);
|
||||
view.getSettings().setSaveFormData(!enabled);
|
||||
view.getSettings().setSavePassword(false);
|
||||
view.getSettings().setSaveFormData(false);
|
||||
}
|
||||
|
||||
@ReactProp(name = "source")
|
||||
|
|
Loading…
Reference in New Issue