From 25cb58dce76e28d88fb03b2e9bc4b92677e127b6 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Wed, 12 Oct 2022 22:09:24 +0200 Subject: [PATCH] Fixed Android RendererPriorityPolicy.waivedWhenNotVisible type 'Null' is not a subtype of type 'bool' #1334 --- CHANGELOG.md | 1 + .../flutter_inappwebview/in_app_webview/InAppWebView.java | 8 ++------ .../in_app_webview/InAppWebViewOptions.java | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a98d91..baa8846f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Fixed missing `PullToRefreshController.isRefreshing` iOS implementation - Fixed Android `PullToRefreshController.setEnabled` at runtime - Fixed iOS `findNext` +- Fixed Android `RendererPriorityPolicy.waivedWhenNotVisible` type 'Null' is not a subtype of type 'bool' ## 5.4.4+3 diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java index 6bfca2bb..f061381c 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java @@ -360,10 +360,6 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie setRendererPriorityPolicy( (int) options.rendererPriorityPolicy.get("rendererRequestedPriority"), (boolean) options.rendererPriorityPolicy.get("waivedWhenNotVisible")); - } else if ((options.rendererPriorityPolicy == null || (options.rendererPriorityPolicy != null && options.rendererPriorityPolicy.isEmpty())) && - Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - options.rendererPriorityPolicy.put("rendererRequestedPriority", getRendererRequestedPriority()); - options.rendererPriorityPolicy.put("waivedWhenNotVisible", getRendererPriorityWaivedWhenNotVisible()); } contentBlockerHandler.getRuleList().clear(); @@ -939,9 +935,9 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie if (newOptionsMap.get("networkAvailable") != null && options.networkAvailable != newOptions.networkAvailable) setNetworkAvailable(newOptions.networkAvailable); - if (newOptionsMap.get("rendererPriorityPolicy") != null && + if (newOptionsMap.get("rendererPriorityPolicy") != null && (options.rendererPriorityPolicy == null || (options.rendererPriorityPolicy.get("rendererRequestedPriority") != newOptions.rendererPriorityPolicy.get("rendererRequestedPriority") || - options.rendererPriorityPolicy.get("waivedWhenNotVisible") != newOptions.rendererPriorityPolicy.get("waivedWhenNotVisible")) && + options.rendererPriorityPolicy.get("waivedWhenNotVisible") != newOptions.rendererPriorityPolicy.get("waivedWhenNotVisible"))) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { setRendererPriorityPolicy( (int) newOptions.rendererPriorityPolicy.get("rendererRequestedPriority"), diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewOptions.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewOptions.java index 21917383..1418af9b 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewOptions.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebViewOptions.java @@ -95,7 +95,8 @@ public class InAppWebViewOptions implements Options { public Integer scrollBarDefaultDelayBeforeFade = null; public Boolean scrollbarFadingEnabled = true; public Integer scrollBarFadeDuration = null; - public Map rendererPriorityPolicy = new HashMap<>(); + @Nullable + public Map rendererPriorityPolicy = null; public Boolean useShouldInterceptRequest = false; public Boolean useOnRenderProcessGone = false; public Boolean disableDefaultErrorPage = false;