正在查看: Housing v14.7.8 应用的 RNCWebViewManagerImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 RNCWebViewManagerImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.reactnativecommunity.webview;
import android.app.Activity;
import android.app.DownloadManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.camera.camera2.internal.t2;
import androidx.webkit.internal.h;
import androidx.webkit.internal.i;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.uimanager.ThemedReactContext;
import com.google.firebase.messaging.e;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.LogInstrumentation;
import com.quickblox.users.Consts;
import io.heap.core.data.model.f;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.r;
import kotlin.text.d;
import kotlin.text.q;
import okhttp3.internal.ws.WebSocketProtocol;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jivesoftware.smack.packet.Message;
import org.json.JSONException;
import org.json.JSONObject;
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010$\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\bF\n\u0002\u0018\u0002\n\u0002\b+\u0018\u0000 \u0095\u00012\u00020\u0001:\u0002\u0095\u0001B\u0011\u0012\b\b\u0002\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u0015\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\t\u0010\nJ\u0015\u0010\f\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\f\u0010\rJ\u001d\u0010\f\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u000e\u001a\u00020\b¢\u0006\u0004\b\f\u0010\u000fJ\u001f\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010\u0012\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b\u0014\u0010\u0015J\u001f\u0010\u0017\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010\u0016\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b\u0017\u0010\u0015J\u001f\u0010\u001a\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010\u0019\u001a\u0004\u0018\u00010\u0018¢\u0006\u0004\b\u001a\u0010\u001bJ\u0015\u0010\u001c\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b¢\u0006\u0004\b\u001c\u0010\u001dJ\u0015\u0010\u001e\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b¢\u0006\u0004\b\u001e\u0010\u001dJ\u001b\u0010!\u001a\u0010\u0012\u0004\u0012\u00020\u0011\u0012\u0004\u0012\u00020 \u0018\u00010\u001f¢\u0006\u0004\b!\u0010\"J%\u0010&\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010#\u001a\u00020\u00112\u0006\u0010%\u001a\u00020$¢\u0006\u0004\b&\u0010'J\u001f\u0010)\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010(\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b)\u0010\u0015J\u001d\u0010+\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010*\u001a\u00020\u0002¢\u0006\u0004\b+\u0010,J\u001f\u0010.\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010-\u001a\u0004\u0018\u00010\u0018¢\u0006\u0004\b.\u0010\u001bJ\u001f\u00100\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010/\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b0\u0010\u0015J\u001d\u00102\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\b2\u0010,J\u001d\u00103\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\b3\u0010,J\u001f\u00105\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u00104\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b5\u0010\u0015J\u001f\u00106\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010/\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b6\u0010\u0015J\u001d\u00107\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b7\u0010,J\u001d\u00108\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b8\u0010,J\u001f\u00109\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010/\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b9\u0010\u0015J\u001d\u0010:\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b:\u0010,J\u001d\u0010;\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b;\u0010,J\u001d\u0010<\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b<\u0010,J\u001d\u0010=\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b=\u0010,J\u001d\u0010>\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b>\u0010,J\u001d\u0010?\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b?\u0010,J\u001d\u0010@\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\b@\u0010,J\u001d\u0010B\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010A\u001a\u00020\u0002¢\u0006\u0004\bB\u0010,J\u001d\u0010C\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bC\u0010,J\u001d\u0010D\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bD\u0010,J\u001f\u0010F\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010E\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\bF\u0010\u0015J\u001f\u0010H\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010G\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\bH\u0010\u0015J\u001d\u0010I\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bI\u0010,J\u0017\u0010J\u001a\u00020\u00132\b\u0010/\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\bJ\u0010KJ\u001d\u0010L\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\bL\u0010,J\u001d\u0010M\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bM\u0010,J\u0017\u0010N\u001a\u00020\u00132\b\u0010/\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\bN\u0010KJ\u001d\u0010O\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bO\u0010,J\u001d\u0010P\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020 ¢\u0006\u0004\bP\u0010QJ\u001d\u0010R\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\bR\u0010,J\u001f\u0010S\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010/\u001a\u0004\u0018\u00010$¢\u0006\u0004\bS\u0010TJ\u001d\u0010U\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bU\u0010,J\u001f\u0010W\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010V\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\bW\u0010\u0015J\u001d\u0010Y\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010X\u001a\u00020\u0002¢\u0006\u0004\bY\u0010,J\u001d\u0010Z\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\bZ\u0010,J\u001d\u0010[\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b[\u0010,J\u001d\u0010\\\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b\\\u0010,J\u001d\u0010]\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020\u0002¢\u0006\u0004\b]\u0010,J\u001d\u0010^\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u0010/\u001a\u00020 ¢\u0006\u0004\b^\u0010QJ\u001d\u0010_\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\b_\u0010,J\u001d\u0010`\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\u0006\u00101\u001a\u00020\u0002¢\u0006\u0004\b`\u0010,J\u0017\u0010a\u001a\u00020\u00132\u0006\u0010\u000e\u001a\u00020\bH\u0002¢\u0006\u0004\ba\u0010bJ\u0017\u0010c\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000bH\u0002¢\u0006\u0004\bc\u0010\u001dJ\u0011\u0010d\u001a\u0004\u0018\u00010\u0011H\u0002¢\u0006\u0004\bd\u0010eJ\u0011\u0010f\u001a\u0004\u0018\u00010\u0011H\u0002¢\u0006\u0004\bf\u0010eJ!\u0010g\u001a\u00020\u00132\u0006\u0010\u0010\u001a\u00020\u000b2\b\u0010-\u001a\u0004\u0018\u00010\u0018H\u0002¢\u0006\u0004\bg\u0010\u001bR\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0003\u0010hR\u0014\u0010i\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\bi\u0010jR\u0016\u0010l\u001a\u00020k8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bl\u0010mR\u0016\u0010n\u001a\u00020\u00028\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bn\u0010hR\u0016\u0010o\u001a\u00020\u00028\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bo\u0010hR\u0018\u0010p\u001a\u0004\u0018\u00010\u00118\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bp\u0010jR\u0018\u0010q\u001a\u0004\u0018\u00010\u00118\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bq\u0010jR\u0016\u0010r\u001a\u00020\u00028\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\br\u0010hR\u0018\u0010s\u001a\u0004\u0018\u00010\u00188\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bs\u0010tR\u0018\u0010u\u001a\u0004\u0018\u00010\u00118\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bu\u0010jR\u0018\u0010v\u001a\u0004\u0018\u00010\u00118\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bv\u0010jR\u0014\u0010w\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\bw\u0010jR\u0014\u0010x\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\bx\u0010jR\u0014\u0010y\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\by\u0010jR\u0014\u0010z\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\bz\u0010jR\u0014\u0010{\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\b{\u0010jR\u0014\u0010|\u001a\u00020\u00118\u0002X\u0082D¢\u0006\u0006\n\u0004\b|\u0010jR\u001b\u0010}\u001a\u00020 8\u0006X\u0086D¢\u0006\r\n\u0004\b}\u0010~\u001a\u0005\b\u007f\u0010\u0080\u0001R\u001e\u0010\u0081\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0081\u0001\u0010~\u001a\u0006\b\u0082\u0001\u0010\u0080\u0001R\u001e\u0010\u0083\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0083\u0001\u0010~\u001a\u0006\b\u0084\u0001\u0010\u0080\u0001R\u001e\u0010\u0085\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0085\u0001\u0010~\u001a\u0006\b\u0086\u0001\u0010\u0080\u0001R\u001e\u0010\u0087\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0087\u0001\u0010~\u001a\u0006\b\u0088\u0001\u0010\u0080\u0001R\u001e\u0010\u0089\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0089\u0001\u0010~\u001a\u0006\b\u008a\u0001\u0010\u0080\u0001R\u001e\u0010\u008b\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u008b\u0001\u0010~\u001a\u0006\b\u008c\u0001\u0010\u0080\u0001R\u001e\u0010\u008d\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u008d\u0001\u0010~\u001a\u0006\b\u008e\u0001\u0010\u0080\u0001R\u001e\u0010\u008f\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u008f\u0001\u0010~\u001a\u0006\b\u0090\u0001\u0010\u0080\u0001R\u001e\u0010\u0091\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0091\u0001\u0010~\u001a\u0006\b\u0092\u0001\u0010\u0080\u0001R\u001e\u0010\u0093\u0001\u001a\u00020 8\u0006X\u0086D¢\u0006\u000f\n\u0005\b\u0093\u0001\u0010~\u001a\u0006\b\u0094\u0001\u0010\u0080\u0001¨\u0006\u0096\u0001"}, d2 = {"Lcom/reactnativecommunity/webview/RNCWebViewManagerImpl;", "", "", "newArch", "<init>", "(Z)V", "Lcom/facebook/react/uimanager/ThemedReactContext;", "context", "Lcom/reactnativecommunity/webview/RNCWebView;", "createRNCWebViewInstance", "(Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/reactnativecommunity/webview/RNCWebView;", "Lcom/reactnativecommunity/webview/RNCWebViewWrapper;", "createViewInstance", "(Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/reactnativecommunity/webview/RNCWebViewWrapper;", "webView", "(Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/reactnativecommunity/webview/RNCWebView;)Lcom/reactnativecommunity/webview/RNCWebViewWrapper;", "viewWrapper", "", "userAgent", "Lzp/j0;", "setUserAgent", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;Ljava/lang/String;)V", "applicationName", "setApplicationNameForUserAgent", "Lcom/facebook/react/bridge/ReadableMap;", "credential", "setBasicAuthCredential", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;Lcom/facebook/react/bridge/ReadableMap;)V", "onAfterUpdateTransaction", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;)V", "onDropViewInstance", "", "", "getCommandsMap", "()Ljava/util/Map;", "commandId", "Lcom/facebook/react/bridge/ReadableArray;", "args", "receiveCommand", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V", "mixedContentMode", "setMixedContentMode", "allow", "setAllowUniversalAccessFromFileURLs", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;Z)V", "source", "setSource", f.VALUE, "setMessagingModuleName", "enabled", "setCacheEnabled", "setIncognito", "injectedJavaScript", "setInjectedJavaScript", "setInjectedJavaScriptBeforeContentLoaded", "setInjectedJavaScriptForMainFrameOnly", "setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly", "setInjectedJavaScriptObject", "setJavaScriptCanOpenWindowsAutomatically", "setShowsVerticalScrollIndicator", "setShowsHorizontalScrollIndicator", "setMessagingEnabled", "setMediaPlaybackRequiresUserAction", "setHasOnScroll", "setJavaScriptEnabled", "allowFileAccess", "setAllowFileAccess", "setAllowFileAccessFromFileURLs", "setAllowsFullscreenVideo", "layerTypeString", "setAndroidLayerType", "cacheModeString", "setCacheMode", "setDomStorageEnabled", "setDownloadingMessage", "(Ljava/lang/String;)V", "setForceDarkOn", "setGeolocationEnabled", "setLackPermissionToDownloadMessage", "setHasOnOpenWindowEvent", "setMinimumFontSize", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;I)V", "setAllowsProtectedMedia", "setMenuCustomItems", "(Lcom/reactnativecommunity/webview/RNCWebViewWrapper;Lcom/facebook/react/bridge/ReadableArray;)V", "setNestedScrollEnabled", "overScrollModeString", "setOverScrollMode", "disabled", "setSaveFormDataDisabled", "setScalesPageToFit", "setSetBuiltInZoomControls", "setSetDisplayZoomControls", "setSetSupportMultipleWindows", "setTextZoom", "setThirdPartyCookiesEnabled", "setWebviewDebuggingEnabled", "setupWebChromeClient", "(Lcom/reactnativecommunity/webview/RNCWebView;)V", "setUserAgentString", "getDownloadingMessageOrDefault", "()Ljava/lang/String;", "getLackPermissionToDownloadMessageOrDefault", "loadSource", "Z", "TAG", "Ljava/lang/String;", "Lcom/reactnativecommunity/webview/RNCWebViewConfig;", "mWebViewConfig", "Lcom/reactnativecommunity/webview/RNCWebViewConfig;", "mAllowsFullscreenVideo", "mAllowsProtectedMedia", "mDownloadingMessage", "mLackPermissionToDownloadMessage", "mHasOnOpenWindowEvent", "mPendingSource", "Lcom/facebook/react/bridge/ReadableMap;", "mUserAgent", "mUserAgentWithApplicationName", "HTML_ENCODING", "HTML_MIME_TYPE", "HTTP_METHOD_POST", "BLANK_URL", "DEFAULT_DOWNLOADING_MESSAGE", "DEFAULT_LACK_PERMISSION_TO_DOWNLOAD_MESSAGE", "COMMAND_GO_BACK", "I", "getCOMMAND_GO_BACK", "()I", "COMMAND_GO_FORWARD", "getCOMMAND_GO_FORWARD", "COMMAND_RELOAD", "getCOMMAND_RELOAD", "COMMAND_STOP_LOADING", "getCOMMAND_STOP_LOADING", "COMMAND_POST_MESSAGE", "getCOMMAND_POST_MESSAGE", "COMMAND_INJECT_JAVASCRIPT", "getCOMMAND_INJECT_JAVASCRIPT", "COMMAND_LOAD_URL", "getCOMMAND_LOAD_URL", "COMMAND_FOCUS", "getCOMMAND_FOCUS", "COMMAND_CLEAR_FORM_DATA", "getCOMMAND_CLEAR_FORM_DATA", "COMMAND_CLEAR_CACHE", "getCOMMAND_CLEAR_CACHE", "COMMAND_CLEAR_HISTORY", "getCOMMAND_CLEAR_HISTORY", "Companion", "react-native-webview_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
@Instrumented
public final class RNCWebViewManagerImpl {
@NotNull
public static final String NAME = "RNCWebView";
@NotNull
private final String BLANK_URL;
private final int COMMAND_CLEAR_CACHE;
private final int COMMAND_CLEAR_FORM_DATA;
private final int COMMAND_CLEAR_HISTORY;
private final int COMMAND_FOCUS;
private final int COMMAND_GO_BACK;
private final int COMMAND_GO_FORWARD;
private final int COMMAND_INJECT_JAVASCRIPT;
private final int COMMAND_LOAD_URL;
private final int COMMAND_POST_MESSAGE;
private final int COMMAND_RELOAD;
private final int COMMAND_STOP_LOADING;
@NotNull
private final String DEFAULT_DOWNLOADING_MESSAGE;
@NotNull
private final String DEFAULT_LACK_PERMISSION_TO_DOWNLOAD_MESSAGE;
@NotNull
private final String HTML_ENCODING;
@NotNull
private final String HTML_MIME_TYPE;
@NotNull
private final String HTTP_METHOD_POST;
@NotNull
private final String TAG;
private boolean mAllowsFullscreenVideo;
private boolean mAllowsProtectedMedia;
@Nullable
private String mDownloadingMessage;
private boolean mHasOnOpenWindowEvent;
@Nullable
private String mLackPermissionToDownloadMessage;
@Nullable
private ReadableMap mPendingSource;
@Nullable
private String mUserAgent;
@Nullable
private String mUserAgentWithApplicationName;
@NotNull
private RNCWebViewConfig mWebViewConfig;
private final boolean newArch;
public RNCWebViewManagerImpl() {
this(false, 1, null);
}
public static final void createViewInstance$lambda$1(RNCWebView rNCWebView, RNCWebViewManagerImpl rNCWebViewManagerImpl, String str, String str2, String str3, String str4, long j) {
rNCWebView.setIgnoreErrFailedForThisURL(str);
RNCWebViewModule nativeModule = rNCWebView.getReactApplicationContext().getNativeModule(RNCWebViewModule.class);
if (nativeModule == null) {
return;
}
try {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(str));
String guessFileName = URLUtil.guessFileName(str, str3, str4);
r.h(guessFileName);
String replace = RNCWebViewManagerImplKt.getInvalidCharRegex().replace(guessFileName, "_");
String l = a.l("Downloading ", replace);
try {
URL url = new URL(str);
request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(url.getProtocol() + "://" + url.getHost()));
} catch (MalformedURLException e) {
LogInstrumentation.w(rNCWebViewManagerImpl.TAG, "Error getting cookie for DownloadManager", e);
}
request.addRequestHeader("User-Agent", str2);
request.setTitle(replace);
request.setDescription(l);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(1);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, replace);
nativeModule.setDownloadRequest(request);
if (nativeModule.grantFileDownloaderPermissions(rNCWebViewManagerImpl.getDownloadingMessageOrDefault(), rNCWebViewManagerImpl.getLackPermissionToDownloadMessageOrDefault())) {
nativeModule.downloadFile(rNCWebViewManagerImpl.getDownloadingMessageOrDefault());
}
} catch (IllegalArgumentException e2) {
LogInstrumentation.w(rNCWebViewManagerImpl.TAG, "Unsupported URI, aborting download", e2);
}
}
private final String getDownloadingMessageOrDefault() {
String str = this.mDownloadingMessage;
return str == null ? this.DEFAULT_DOWNLOADING_MESSAGE : str;
}
private final String getLackPermissionToDownloadMessageOrDefault() {
String str = this.mLackPermissionToDownloadMessage;
return str == null ? this.DEFAULT_LACK_PERMISSION_TO_DOWNLOAD_MESSAGE : str;
}
private final void loadSource(RNCWebViewWrapper viewWrapper, ReadableMap source) {
byte[] bArr;
RNCWebView webView = viewWrapper.getWebView();
if (source != null) {
if (source.hasKey("html")) {
String string = source.getString("html");
String string2 = source.hasKey("baseUrl") ? source.getString("baseUrl") : "";
r.h(string);
webView.loadDataWithBaseURL(string2, string, this.HTML_MIME_TYPE, this.HTML_ENCODING, null);
return;
}
if (source.hasKey("uri")) {
String string3 = source.getString("uri");
String url = webView.getUrl();
if (url == null || !url.equals(string3)) {
if (source.hasKey("method") && q.v(source.getString("method"), this.HTTP_METHOD_POST, true)) {
if (source.hasKey(Message.BODY)) {
String string4 = source.getString(Message.BODY);
try {
r.h(string4);
Charset forName = Charset.forName("UTF-8");
r.j(forName, "forName(...)");
bArr = string4.getBytes(forName);
r.j(bArr, "getBytes(...)");
} catch (UnsupportedEncodingException unused) {
r.h(string4);
bArr = string4.getBytes(d.UTF_8);
r.j(bArr, "getBytes(...)");
}
} else {
bArr = null;
}
if (bArr == null) {
bArr = new byte[0];
}
r.h(string3);
webView.postUrl(string3, bArr);
return;
}
HashMap hashMap = new HashMap();
if (source.hasKey("headers")) {
if (this.newArch) {
ReadableArray array = source.getArray("headers");
r.h(array);
Iterator it = array.toArrayList().iterator();
r.j(it, "iterator(...)");
while (it.hasNext()) {
Object next = it.next();
r.i(next, "null cannot be cast to non-null type java.util.HashMap<kotlin.String, kotlin.String>");
HashMap hashMap2 = (HashMap) next;
String str = (String) hashMap2.get("name");
if (str == null) {
str = "";
}
String str2 = (String) hashMap2.get(f.VALUE);
if (str2 == null) {
str2 = "";
}
Locale locale = Locale.ENGLISH;
if ("user-agent".equals(androidx.datastore.preferences.protobuf.q.n(locale, "ENGLISH", str, locale, "toLowerCase(...)"))) {
webView.getSettings().setUserAgentString(str2);
} else {
hashMap.put(str, str2);
}
}
} else {
ReadableMap map = source.getMap("headers");
r.h(map);
ReadableMapKeySetIterator keySetIterator = map.keySetIterator();
while (keySetIterator.hasNextKey()) {
String nextKey = keySetIterator.nextKey();
Locale locale2 = Locale.ENGLISH;
if ("user-agent".equals(androidx.datastore.preferences.protobuf.q.n(locale2, "ENGLISH", nextKey, locale2, "toLowerCase(...)"))) {
webView.getSettings().setUserAgentString(map.getString(nextKey));
} else {
hashMap.put(nextKey, map.getString(nextKey));
}
}
}
}
r.h(string3);
webView.loadUrl(string3, hashMap);
return;
}
return;
}
}
webView.loadUrl(this.BLANK_URL);
}
public static final void mWebViewConfig$lambda$0(WebView webView) {
}
private final void setUserAgentString(RNCWebViewWrapper viewWrapper) {
RNCWebView webView = viewWrapper.getWebView();
if (this.mUserAgent != null) {
webView.getSettings().setUserAgentString(this.mUserAgent);
} else if (this.mUserAgentWithApplicationName != null) {
webView.getSettings().setUserAgentString(this.mUserAgentWithApplicationName);
} else {
webView.getSettings().setUserAgentString(WebSettings.getDefaultUserAgent(webView.getContext()));
}
}
private final void setupWebChromeClient(final RNCWebView webView) {
final Activity currentActivity = webView.getThemedReactContext().getCurrentActivity();
if (this.mAllowsFullscreenVideo && currentActivity != null) {
final int requestedOrientation = currentActivity.getRequestedOrientation();
RNCWebChromeClient rNCWebChromeClient = new RNCWebChromeClient(webView) {
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
@Override
public void onHideCustomView() {
if (this.mVideoView == null) {
return;
}
ViewGroup rootView = getRootView();
if (rootView.getRootView() != this.mWebView.getRootView()) {
this.mWebView.getRootView().setVisibility(0);
} else {
this.mWebView.setVisibility(0);
}
currentActivity.getWindow().clearFlags(512);
rootView.removeView(this.mVideoView);
this.mCustomViewCallback.onCustomViewHidden();
this.mVideoView = null;
this.mCustomViewCallback = null;
currentActivity.setRequestedOrientation(requestedOrientation);
this.mWebView.getThemedReactContext().removeLifecycleEventListener(this);
}
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
r.k(view, "view");
r.k(callback, "callback");
if (this.mVideoView != null) {
callback.onCustomViewHidden();
return;
}
this.mVideoView = view;
this.mCustomViewCallback = callback;
currentActivity.setRequestedOrientation(-1);
this.mVideoView.setSystemUiVisibility(7942);
currentActivity.getWindow().setFlags(512, 512);
this.mVideoView.setBackgroundColor(-16777216);
ViewGroup rootView = getRootView();
rootView.addView(this.mVideoView, RNCWebChromeClient.FULLSCREEN_LAYOUT_PARAMS);
if (rootView.getRootView() != this.mWebView.getRootView()) {
this.mWebView.getRootView().setVisibility(8);
} else {
this.mWebView.setVisibility(8);
}
this.mWebView.getThemedReactContext().addLifecycleEventListener(this);
}
};
rNCWebChromeClient.setAllowsProtectedMedia(this.mAllowsProtectedMedia);
rNCWebChromeClient.setHasOnOpenWindowEvent(this.mHasOnOpenWindowEvent);
webView.setWebChromeClient(rNCWebChromeClient);
return;
}
RNCWebChromeClient rNCWebChromeClient2 = (RNCWebChromeClient) webView.getWebChromeClient();
if (rNCWebChromeClient2 != null) {
rNCWebChromeClient2.onHideCustomView();
}
RNCWebChromeClient rNCWebChromeClient3 = new RNCWebChromeClient(webView) {
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
};
rNCWebChromeClient3.setAllowsProtectedMedia(this.mAllowsProtectedMedia);
rNCWebChromeClient3.setHasOnOpenWindowEvent(this.mHasOnOpenWindowEvent);
webView.setWebChromeClient(rNCWebChromeClient3);
}
@NotNull
public final RNCWebView createRNCWebViewInstance(@NotNull ThemedReactContext context) {
r.k(context, "context");
return new RNCWebView(context);
}
@NotNull
public final RNCWebViewWrapper createViewInstance(@NotNull ThemedReactContext context) {
r.k(context, "context");
return createViewInstance(context, createRNCWebViewInstance(context));
}
public final int getCOMMAND_CLEAR_CACHE() {
return this.COMMAND_CLEAR_CACHE;
}
public final int getCOMMAND_CLEAR_FORM_DATA() {
return this.COMMAND_CLEAR_FORM_DATA;
}
public final int getCOMMAND_CLEAR_HISTORY() {
return this.COMMAND_CLEAR_HISTORY;
}
public final int getCOMMAND_FOCUS() {
return this.COMMAND_FOCUS;
}
public final int getCOMMAND_GO_BACK() {
return this.COMMAND_GO_BACK;
}
public final int getCOMMAND_GO_FORWARD() {
return this.COMMAND_GO_FORWARD;
}
public final int getCOMMAND_INJECT_JAVASCRIPT() {
return this.COMMAND_INJECT_JAVASCRIPT;
}
public final int getCOMMAND_LOAD_URL() {
return this.COMMAND_LOAD_URL;
}
public final int getCOMMAND_POST_MESSAGE() {
return this.COMMAND_POST_MESSAGE;
}
public final int getCOMMAND_RELOAD() {
return this.COMMAND_RELOAD;
}
public final int getCOMMAND_STOP_LOADING() {
return this.COMMAND_STOP_LOADING;
}
@Nullable
public final Map<String, Integer> getCommandsMap() {
return MapBuilder.builder().put("goBack", Integer.valueOf(this.COMMAND_GO_BACK)).put("goForward", Integer.valueOf(this.COMMAND_GO_FORWARD)).put("reload", Integer.valueOf(this.COMMAND_RELOAD)).put("stopLoading", Integer.valueOf(this.COMMAND_STOP_LOADING)).put("postMessage", Integer.valueOf(this.COMMAND_POST_MESSAGE)).put("injectJavaScript", Integer.valueOf(this.COMMAND_INJECT_JAVASCRIPT)).put("loadUrl", Integer.valueOf(this.COMMAND_LOAD_URL)).put("requestFocus", Integer.valueOf(this.COMMAND_FOCUS)).put("clearFormData", Integer.valueOf(this.COMMAND_CLEAR_FORM_DATA)).put("clearCache", Integer.valueOf(this.COMMAND_CLEAR_CACHE)).put("clearHistory", Integer.valueOf(this.COMMAND_CLEAR_HISTORY)).build();
}
public final void onAfterUpdateTransaction(@NotNull RNCWebViewWrapper viewWrapper) {
r.k(viewWrapper, "viewWrapper");
ReadableMap readableMap = this.mPendingSource;
if (readableMap != null) {
loadSource(viewWrapper, readableMap);
}
this.mPendingSource = null;
}
public final void onDropViewInstance(@NotNull RNCWebViewWrapper viewWrapper) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
webView.getThemedReactContext().removeLifecycleEventListener(webView);
webView.cleanupCallbacksAndDestroy();
webView.mWebChromeClient = null;
}
public final void receiveCommand(@NotNull RNCWebViewWrapper viewWrapper, @NotNull String commandId, @NotNull ReadableArray args) {
r.k(viewWrapper, "viewWrapper");
r.k(commandId, "commandId");
r.k(args, "args");
RNCWebView webView = viewWrapper.getWebView();
switch (commandId.hashCode()) {
case -1241591313:
if (commandId.equals("goBack")) {
webView.goBack();
return;
}
return;
case -948122918:
if (commandId.equals("stopLoading")) {
webView.stopLoading();
return;
}
return;
case -934641255:
if (commandId.equals("reload")) {
webView.reload();
return;
}
return;
case -759238347:
if (commandId.equals("clearCache")) {
webView.clearCache(args.getBoolean(0));
return;
}
return;
case -318289731:
if (commandId.equals("goForward")) {
webView.goForward();
return;
}
return;
case -265032709:
if (commandId.equals("clearFormData")) {
webView.clearFormData();
return;
}
return;
case 336631465:
if (commandId.equals("loadUrl")) {
String string = args.getString(0);
if (string == null) {
throw new RuntimeException("Arguments for loading an url are null!");
}
webView.progressChangedFilter.setWaitingForCommandLoadUrl(false);
webView.loadUrl(string);
return;
}
return;
case 903120263:
if (commandId.equals("clearHistory")) {
webView.clearHistory();
return;
}
return;
case 1280029577:
if (commandId.equals("requestFocus")) {
webView.requestFocus();
return;
}
return;
case 1490029383:
if (commandId.equals("postMessage")) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("data", args.getString(0));
webView.evaluateJavascriptWithFallback("(function () {var event;var data = " + jSONObject + ";try {event = new MessageEvent('message', data);} catch (e) {event = document.createEvent('MessageEvent');event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);}document.dispatchEvent(event);})();");
return;
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
return;
case 2104576510:
if (commandId.equals("injectJavaScript")) {
webView.evaluateJavascriptWithFallback(args.getString(0));
return;
}
return;
default:
return;
}
}
public final void setAllowFileAccess(@NotNull RNCWebViewWrapper viewWrapper, boolean allowFileAccess) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowFileAccess(allowFileAccess);
}
public final void setAllowFileAccessFromFileURLs(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowFileAccessFromFileURLs(value);
}
public final void setAllowUniversalAccessFromFileURLs(@NotNull RNCWebViewWrapper viewWrapper, boolean allow) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowUniversalAccessFromFileURLs(allow);
}
public final void setAllowsFullscreenVideo(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
this.mAllowsFullscreenVideo = value;
setupWebChromeClient(webView);
}
public final void setAllowsProtectedMedia(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
this.mAllowsProtectedMedia = enabled;
WebChromeClient webChromeClient = webView.getWebChromeClient();
if (webChromeClient == null || !(webChromeClient instanceof RNCWebChromeClient)) {
return;
}
((RNCWebChromeClient) webChromeClient).setAllowsProtectedMedia(enabled);
}
public final void setAndroidLayerType(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String layerTypeString) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setLayerType(r.f(layerTypeString, "hardware") ? 2 : r.f(layerTypeString, "software") ? 1 : 0, null);
}
public final void setApplicationNameForUserAgent(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String applicationName) {
r.k(viewWrapper, "viewWrapper");
if (applicationName != null) {
this.mUserAgentWithApplicationName = t2.D(WebSettings.getDefaultUserAgent(viewWrapper.getWebView().getContext()), lr.f.SPACE, applicationName);
} else {
this.mUserAgentWithApplicationName = null;
}
setUserAgentString(viewWrapper);
}
public final void setBasicAuthCredential(@NotNull RNCWebViewWrapper viewWrapper, @Nullable ReadableMap credential) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setBasicAuthCredential((credential != null && credential.hasKey("username") && credential.hasKey(Consts.PASSWORD)) ? new RNCBasicAuthCredential(credential.getString("username"), credential.getString(Consts.PASSWORD)) : null);
}
public final void setCacheEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setCacheMode(enabled ? -1 : 2);
}
public final void setCacheMode(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String cacheModeString) {
r.k(viewWrapper, "viewWrapper");
WebSettings settings = viewWrapper.getWebView().getSettings();
int i = -1;
if (cacheModeString != null) {
switch (cacheModeString.hashCode()) {
case -2059164003:
if (cacheModeString.equals("LOAD_NO_CACHE")) {
i = 2;
break;
}
break;
case -1215135800:
cacheModeString.equals("LOAD_DEFAULT");
break;
case -873877826:
if (cacheModeString.equals("LOAD_CACHE_ELSE_NETWORK")) {
i = 1;
break;
}
break;
case 1548620642:
if (cacheModeString.equals("LOAD_CACHE_ONLY")) {
i = 3;
break;
}
break;
}
}
settings.setCacheMode(i);
}
public final void setDomStorageEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setDomStorageEnabled(value);
}
public final void setDownloadingMessage(@Nullable String value) {
this.mDownloadingMessage = value;
}
public final void setForceDarkOn(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
if (Build.VERSION.SDK_INT > 28) {
if (h.isSupported("FORCE_DARK")) {
int i = enabled ? 2 : 0;
WebSettings settings = webView.getSettings();
h hVar = h.FORCE_DARK;
if (hVar.isSupportedByFramework()) {
f4.d.g(settings, i);
} else {
if (!hVar.isSupportedByWebView()) {
throw h.getUnsupportedOperationException();
}
i.b().a(settings).a(i);
}
}
if (enabled && h.isSupported("FORCE_DARK_STRATEGY")) {
WebSettings settings2 = webView.getSettings();
if (!h.FORCE_DARK_STRATEGY.isSupportedByWebView()) {
throw h.getUnsupportedOperationException();
}
i.b().a(settings2).b();
}
}
}
public final void setGeolocationEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setGeolocationEnabled(value);
}
public final void setHasOnOpenWindowEvent(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
this.mHasOnOpenWindowEvent = value;
setupWebChromeClient(webView);
}
public final void setHasOnScroll(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setHasScrollEvent(value);
}
public final void setIncognito(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
if (enabled) {
CookieManager.getInstance().removeAllCookies(null);
webView.getSettings().setCacheMode(2);
webView.clearHistory();
webView.clearCache(true);
webView.clearFormData();
webView.getSettings().setSavePassword(false);
webView.getSettings().setSaveFormData(false);
}
}
public final void setInjectedJavaScript(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String injectedJavaScript) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().injectedJS = injectedJavaScript;
}
public final void setInjectedJavaScriptBeforeContentLoaded(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().injectedJSBeforeContentLoaded = value;
}
public final void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().injectedJavaScriptBeforeContentLoadedForMainFrameOnly = value;
}
public final void setInjectedJavaScriptForMainFrameOnly(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().injectedJavaScriptForMainFrameOnly = value;
}
public final void setInjectedJavaScriptObject(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setInjectedJavaScriptObject(value);
}
public final void setJavaScriptCanOpenWindowsAutomatically(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(value);
}
public final void setJavaScriptEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setJavaScriptEnabled(enabled);
}
public final void setLackPermissionToDownloadMessage(@Nullable String value) {
this.mLackPermissionToDownloadMessage = value;
}
public final void setMediaPlaybackRequiresUserAction(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setMediaPlaybackRequiresUserGesture(value);
}
public final void setMenuCustomItems(@NotNull RNCWebViewWrapper viewWrapper, @Nullable ReadableArray value) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
if (value == null) {
webView.setMenuCustomItems(null);
return;
}
ArrayList arrayList = value.toArrayList();
r.i(arrayList, "null cannot be cast to non-null type kotlin.collections.List<kotlin.collections.Map<kotlin.String, kotlin.String>>");
webView.setMenuCustomItems(arrayList);
}
public final void setMessagingEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setMessagingEnabled(value);
}
public final void setMessagingModuleName(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().messagingModuleName = value;
}
public final void setMinimumFontSize(@NotNull RNCWebViewWrapper viewWrapper, int value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setMinimumFontSize(value);
}
public final void setMixedContentMode(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String mixedContentMode) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
if (mixedContentMode == null || "never".equals(mixedContentMode)) {
webView.getSettings().setMixedContentMode(1);
} else if ("always".equals(mixedContentMode)) {
webView.getSettings().setMixedContentMode(0);
} else if ("compatibility".equals(mixedContentMode)) {
webView.getSettings().setMixedContentMode(2);
}
}
public final void setNestedScrollEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().nestedScrollEnabled = value;
}
public final void setOverScrollMode(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String overScrollModeString) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
int i = 0;
if (overScrollModeString != null) {
int hashCode = overScrollModeString.hashCode();
if (hashCode == -1414557169) {
overScrollModeString.equals("always");
} else if (hashCode != 104712844) {
if (hashCode == 951530617 && overScrollModeString.equals("content")) {
i = 1;
}
} else if (overScrollModeString.equals("never")) {
i = 2;
}
}
webView.setOverScrollMode(i);
}
public final void setSaveFormDataDisabled(@NotNull RNCWebViewWrapper viewWrapper, boolean disabled) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setSaveFormData(!disabled);
}
public final void setScalesPageToFit(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
RNCWebView webView = viewWrapper.getWebView();
webView.getSettings().setLoadWithOverviewMode(value);
webView.getSettings().setUseWideViewPort(value);
}
public final void setSetBuiltInZoomControls(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setBuiltInZoomControls(value);
}
public final void setSetDisplayZoomControls(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setDisplayZoomControls(value);
}
public final void setSetSupportMultipleWindows(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setSupportMultipleWindows(value);
}
public final void setShowsHorizontalScrollIndicator(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setHorizontalScrollBarEnabled(value);
}
public final void setShowsVerticalScrollIndicator(@NotNull RNCWebViewWrapper viewWrapper, boolean value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setVerticalScrollBarEnabled(value);
}
public final void setSource(@NotNull RNCWebViewWrapper viewWrapper, @Nullable ReadableMap source) {
r.k(viewWrapper, "viewWrapper");
this.mPendingSource = source;
}
public final void setTextZoom(@NotNull RNCWebViewWrapper viewWrapper, int value) {
r.k(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setTextZoom(value);
}
public final void setThirdPartyCookiesEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
CookieManager.getInstance().setAcceptThirdPartyCookies(viewWrapper.getWebView(), enabled);
}
public final void setUserAgent(@NotNull RNCWebViewWrapper viewWrapper, @Nullable String userAgent) {
r.k(viewWrapper, "viewWrapper");
this.mUserAgent = userAgent;
setUserAgentString(viewWrapper);
}
public final void setWebviewDebuggingEnabled(@NotNull RNCWebViewWrapper viewWrapper, boolean enabled) {
r.k(viewWrapper, "viewWrapper");
WebView.setWebContentsDebuggingEnabled(enabled);
}
public RNCWebViewManagerImpl(boolean z) {
this.newArch = z;
this.TAG = "RNCWebViewManagerImpl";
this.mWebViewConfig = new e(23);
this.HTML_ENCODING = "UTF-8";
this.HTML_MIME_TYPE = "text/html";
this.HTTP_METHOD_POST = "POST";
this.BLANK_URL = "about:blank";
this.DEFAULT_DOWNLOADING_MESSAGE = "Downloading";
this.DEFAULT_LACK_PERMISSION_TO_DOWNLOAD_MESSAGE = "Cannot download files as permission was denied. Please provide permission to write to storage, in order to download files.";
this.COMMAND_GO_BACK = 1;
this.COMMAND_GO_FORWARD = 2;
this.COMMAND_RELOAD = 3;
this.COMMAND_STOP_LOADING = 4;
this.COMMAND_POST_MESSAGE = 5;
this.COMMAND_INJECT_JAVASCRIPT = 6;
this.COMMAND_LOAD_URL = 7;
this.COMMAND_FOCUS = 8;
this.COMMAND_CLEAR_FORM_DATA = 1000;
this.COMMAND_CLEAR_CACHE = WebSocketProtocol.CLOSE_CLIENT_GOING_AWAY;
this.COMMAND_CLEAR_HISTORY = 1002;
}
@NotNull
public final RNCWebViewWrapper createViewInstance(@NotNull ThemedReactContext context, @NotNull final RNCWebView webView) {
r.k(context, "context");
r.k(webView, "webView");
setupWebChromeClient(webView);
context.addLifecycleEventListener(webView);
this.mWebViewConfig.configWebView(webView);
WebSettings settings = webView.getSettings();
r.j(settings, "getSettings(...)");
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setDomStorageEnabled(true);
settings.setSupportMultipleWindows(true);
settings.setAllowFileAccess(false);
settings.setAllowContentAccess(false);
settings.setAllowFileAccessFromFileURLs(false);
settings.setAllowUniversalAccessFromFileURLs(false);
settings.setMixedContentMode(1);
webView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
if (ReactBuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true);
}
webView.setDownloadListener(new DownloadListener() {
@Override
public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
RNCWebViewManagerImpl.createViewInstance$lambda$1(RNCWebView.this, this, str, str2, str3, str4, j);
}
});
return new RNCWebViewWrapper(context, webView);
}
public RNCWebViewManagerImpl(boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? false : z);
}
}