Pārlūkot izejas kodu

fix(android): webview crash with incognito in Android Lollipop (#799)

tekmin 5 gadus atpakaļ
vecāks
revīzija
47e9a0b97d

+ 5
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Parādīt failu

@@ -367,7 +367,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
367 367
   @ReactProp(name = "incognito")
368 368
   public void setIncognito(WebView view, boolean enabled) {
369 369
     // Remove all previous cookies
370
-    CookieManager.getInstance().removeAllCookies(null);
370
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
371
+      CookieManager.getInstance().removeAllCookies(null);
372
+    } else {
373
+      CookieManager.getInstance().removeAllCookie();
374
+    }
371 375
 
372 376
     // Disable caching
373 377
     view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);