|
@@ -432,6 +432,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
432
|
432
|
|
433
|
433
|
@ReactProp(name = "incognito")
|
434
|
434
|
public void setIncognito(WebView view, boolean enabled) {
|
|
435
|
+ // Don't do anything when incognito is disabled
|
|
436
|
+ if (!enabled) {
|
|
437
|
+ return;
|
|
438
|
+ }
|
|
439
|
+
|
435
|
440
|
// Remove all previous cookies
|
436
|
441
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
437
|
442
|
CookieManager.getInstance().removeAllCookies(null);
|
|
@@ -441,14 +446,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
441
|
446
|
|
442
|
447
|
// Disable caching
|
443
|
448
|
view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
444
|
|
- view.getSettings().setAppCacheEnabled(!enabled);
|
|
449
|
+ view.getSettings().setAppCacheEnabled(false);
|
445
|
450
|
view.clearHistory();
|
446
|
|
- view.clearCache(enabled);
|
|
451
|
+ view.clearCache(true);
|
447
|
452
|
|
448
|
453
|
// No form data or autofill enabled
|
449
|
454
|
view.clearFormData();
|
450
|
|
- view.getSettings().setSavePassword(!enabled);
|
451
|
|
- view.getSettings().setSaveFormData(!enabled);
|
|
455
|
+ view.getSettings().setSavePassword(false);
|
|
456
|
+ view.getSettings().setSaveFormData(false);
|
452
|
457
|
}
|
453
|
458
|
|
454
|
459
|
@ReactProp(name = "source")
|