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