From d4e2fd8d3cf5a793ce2efba1f80749d2cfb85859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=AE=E1=84=85?= =?UTF-8?q?=E1=85=A5=E1=86=BC?= Date: Thu, 29 Feb 2024 16:17:44 +0900 Subject: [PATCH] fix: allow MutableContextWrapper for flutter sdk --- pagecall/src/main/java/com/pagecall/PagecallWebView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pagecall/src/main/java/com/pagecall/PagecallWebView.java b/pagecall/src/main/java/com/pagecall/PagecallWebView.java index c632ed6..9380d8d 100644 --- a/pagecall/src/main/java/com/pagecall/PagecallWebView.java +++ b/pagecall/src/main/java/com/pagecall/PagecallWebView.java @@ -3,6 +3,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.MutableContextWrapper; import android.content.res.AssetManager; import android.media.AudioManager; import android.net.Uri; @@ -188,9 +189,9 @@ public void loadDataWithBaseURL(@Nullable String baseUrl, @NonNull String data, private PagecallWebChromeClient webChromeClient; protected void init(Context context) { - // Check if the context is ActivityContext - if (!(context instanceof Activity)) { - throw new IllegalArgumentException("Provided context is not an Activity context."); + // Check if the context is ActivityContext or MutableContextWrapper + if (!(context instanceof Activity) && !(context instanceof MutableContextWrapper)) { + throw new IllegalArgumentException("The provided context is neither an Activity nor a MutableContextWrapper."); } if (this.pagecallUrls == null) { pagecallUrls = defaultPagecallUrls;