导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - FullscreenWebviewActivity.java 源代码

正在查看: RummyCircle v11000.89 应用的 FullscreenWebviewActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.games24x7.pgwebview.ui;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcelable;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.ConsoleMessage;
import android.webkit.CookieManager;
import android.webkit.PermissionRequest;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.activity.F;
import androidx.activity.p;
import androidx.appcompat.app.AppCompatActivity;
import androidx.camera.camera2.internal.C;
import androidx.camera.core.s0;
import androidx.core.app.j;
import androidx.core.view.G0;
import androidx.core.view.X;
import androidx.core.view.g0;
import androidx.core.view.j0;
import androidx.core.view.q0;
import androidx.room.v;
import com.appsflyer.c;
import com.appsflyer.internal.E;
import com.games24x7.pgwebview.communication.WebviewRequestEventHandler;
import com.games24x7.pgwebview.communication.external.eventbus.events.JsInterfaceHolder;
import com.games24x7.pgwebview.communication.internal.eventbus.event.FullscreenReqEvent;
import com.games24x7.pgwebview.communication.internal.eventbus.event.FullscreenWebviewEvent;
import com.games24x7.pgwebview.custom.PGWebView;
import com.games24x7.pgwebview.enums.WebReqEventType;
import com.games24x7.pgwebview.enums.WebviewEventType;
import com.games24x7.pgwebview.models.CustomWebviewResponse;
import com.games24x7.pgwebview.models.WebViewConfiguration;
import com.games24x7.pgwebview.util.a;
import com.games24x7.pgwebview.util.b;
import com.google.android.gms.common.ConnectionResult;
import com.google.firebase.perf.v1.h;
import com.google.gson.d;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.WeakHashMap;
import java.util.concurrent.ExecutionException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlin.text.o;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.eventbus.i;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
public final class FullscreenWebviewActivity extends AppCompatActivity {
    private final boolean clearPreviousSession;
    private CustomWebviewResponse customWebviewResponse;
    private int entryAnimationResource;
    private int exitAnimationResource;
    private boolean inProgress;
    private boolean isBackGroundTransparent;
    private boolean isEntryAnimationRequired;
    private boolean isExitAnimationRequired;
    private boolean isHtmlPayload;
    private Uri mCapturedImageURI;
    private ValueCallback<Uri[]> mFilePathCallback;
    private ValueCallback<Uri> mUploadMessage;
    private String orientation;
    private ProgressDialog progressDialog;
    private String url;
    private WebViewConfiguration webViewConfiguration;
    private RelativeLayout webViewLayout;
    private PGWebView webview;
    private boolean webviewLoadError;

    @NotNull
    private String webviewId = "";

    @NotNull
    private String webviewMetaData = "";
    private final String TAG = "FullscreenWebviewActivity";
    private final int FILECHOOSER_RESULTCODE = 2888;

    @NotNull
    private String htmlPayload = "";

    @Metadata
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[WebReqEventType.values().length];
            iArr[WebReqEventType.CLOSE.ordinal()] = 1;
            iArr[WebReqEventType.LOADURL.ordinal()] = 2;
            iArr[WebReqEventType.EXECUTESCRIPT.ordinal()] = 3;
            iArr[WebReqEventType.LOADDATA.ordinal()] = 4;
            iArr[WebReqEventType.LOADHTML.ordinal()] = 5;
            iArr[WebReqEventType.LOADFILE.ordinal()] = 6;
            iArr[WebReqEventType.STOPLOADING.ordinal()] = 7;
            iArr[WebReqEventType.RELOAD.ordinal()] = 8;
            iArr[WebReqEventType.CANGOBACK.ordinal()] = 9;
            iArr[WebReqEventType.CANGOFORWARD.ordinal()] = 10;
            iArr[WebReqEventType.GOFORWARD.ordinal()] = 11;
            iArr[WebReqEventType.GOBACK.ordinal()] = 12;
            iArr[WebReqEventType.SETBACKGROUNDRESOURCE.ordinal()] = 13;
            iArr[WebReqEventType.SETBACKGROUNDCOLOR.ordinal()] = 14;
            iArr[WebReqEventType.SHOWLOADER.ordinal()] = 15;
            iArr[WebReqEventType.HIDELOADER.ordinal()] = 16;
            $EnumSwitchMapping$0 = iArr;
        }
    }

    private final boolean canGoBack(String str) {
        boolean z;
        PGWebView pGWebView;
        try {
            pGWebView = this.webview;
        } catch (InterruptedException | ExecutionException unused) {
            z = false;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        z = pGWebView.canGoBack();
        sendWebviewEvent(new FullscreenWebviewEvent(str, WebviewEventType.CANGOBACK, new JSONObject().put("value", z), false, 8, null));
        return z;
    }

    private final boolean canGoForward(String str) {
        boolean z;
        PGWebView pGWebView;
        try {
            pGWebView = this.webview;
        } catch (InterruptedException | ExecutionException unused) {
            z = false;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        z = pGWebView.canGoForward();
        sendWebviewEvent(new FullscreenWebviewEvent(str, WebviewEventType.CANGOFORWARD, new JSONObject().put("value", z), false, 8, null));
        return z;
    }

    @SuppressLint({"ClickableViewAccessibility", "NewApi"})
    private final void configure() {
        if (this.clearPreviousSession) {
            CookieManager.getInstance().removeSessionCookies(null);
        }
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.webViewLayout = relativeLayout;
        relativeLayout.setBackgroundColor(0);
        try {
            RelativeLayout relativeLayout2 = this.webViewLayout;
            if (relativeLayout2 == null) {
                Intrinsics.q("webViewLayout");
                throw null;
            }
            PGWebView pGWebView = new PGWebView(this, relativeLayout2);
            this.webview = pGWebView;
            WebViewConfiguration webViewConfiguration = this.webViewConfiguration;
            if (webViewConfiguration == null) {
                Intrinsics.q("webViewConfiguration");
                throw null;
            }
            pGWebView.setupWebviewConfiguration(webViewConfiguration);
            String str = this.TAG;
            StringBuilder sb = new StringBuilder("");
            PGWebView pGWebView2 = this.webview;
            if (pGWebView2 == null) {
                Intrinsics.q("webview");
                throw null;
            }
            sb.append(pGWebView2);
            Log.d(str, sb.toString());
            sendWebviewCreatedEvent();
            PGWebView pGWebView3 = this.webview;
            if (pGWebView3 == null) {
                Intrinsics.q("webview");
                throw null;
            }
            pGWebView3.setOnTouchListener(new a());
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            PGWebView pGWebView4 = this.webview;
            if (pGWebView4 == null) {
                Intrinsics.q("webview");
                throw null;
            }
            pGWebView4.setBackgroundColor(0);
            RelativeLayout relativeLayout3 = this.webViewLayout;
            if (relativeLayout3 == null) {
                Intrinsics.q("webViewLayout");
                throw null;
            }
            relativeLayout3.setBackgroundColor(0);
            RelativeLayout relativeLayout4 = this.webViewLayout;
            if (relativeLayout4 == null) {
                Intrinsics.q("webViewLayout");
                throw null;
            }
            PGWebView pGWebView5 = this.webview;
            if (pGWebView5 == null) {
                Intrinsics.q("webview");
                throw null;
            }
            relativeLayout4.addView(pGWebView5, layoutParams);
            ProgressDialog progressDialog = new ProgressDialog(this, 1);
            this.progressDialog = progressDialog;
            progressDialog.setMessage("Loading ...");
            ProgressDialog progressDialog2 = this.progressDialog;
            if (progressDialog2 == null) {
                Intrinsics.q("progressDialog");
                throw null;
            }
            progressDialog2.setIndeterminate(true);
            ProgressDialog progressDialog3 = this.progressDialog;
            if (progressDialog3 == null) {
                Intrinsics.q("progressDialog");
                throw null;
            }
            progressDialog3.setCancelable(false);
            if (!isFinishing()) {
                try {
                    ProgressDialog progressDialog4 = this.progressDialog;
                    if (progressDialog4 == null) {
                        Intrinsics.q("progressDialog");
                        throw null;
                    }
                    progressDialog4.show();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (this.isEntryAnimationRequired) {
                overridePendingTransition(this.entryAnimationResource, 0);
            }
        } catch (Exception e2) {
            e2.printStackTrace();
            finish();
        }
    }

    public static final boolean m0configure$lambda3(View view, MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        if ((action != 0 && action != 1) || view.hasFocus()) {
            return false;
        }
        view.requestFocus();
        return false;
    }

    private final File createImageFile() {
        File imageFile = File.createTempFile("JPEG_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + '_', ".jpg", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES));
        StringBuilder sb = new StringBuilder("image: ");
        sb.append(imageFile);
        Log.d("imagefile", sb.toString());
        Intrinsics.checkNotNullExpressionValue(imageFile, "imageFile");
        return imageFile;
    }

    private final void evaluateJS(String str, String str2) {
        runOnUiThread(new C(this, str2, 7));
    }

    public static final void m1evaluateJS$lambda14(FullscreenWebviewActivity this$0, String js) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(js, "$js");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.evaluateJavascript(js, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void getConfig() {
        String str;
        Intent intent = getIntent();
        String stringExtra = intent.getStringExtra("url");
        this.url = stringExtra;
        if (stringExtra == null) {
            Uri data = intent.getData();
            if (data == null || (str = data.toString()) == null) {
                str = "";
            }
            this.url = str;
        }
        this.isBackGroundTransparent = intent.getBooleanExtra("isBackGroundTransparent", false);
        this.orientation = intent.getStringExtra("orientation");
        String stringExtra2 = intent.getStringExtra("id");
        this.webviewId = stringExtra2 != null ? stringExtra2 : "";
        this.customWebviewResponse = (CustomWebviewResponse) new d().k(intent.getStringExtra("webviewResponse"), new com.google.gson.reflect.a<CustomWebviewResponse>() {
        }.getType());
        Object k = new d().k(intent.getStringExtra("webviewConfig"), new com.google.gson.reflect.a<WebViewConfiguration>() {
        }.getType());
        Intrinsics.checkNotNullExpressionValue(k, "Gson().fromJson(\n       …tion>() {}.type\n        )");
        this.webViewConfiguration = (WebViewConfiguration) k;
        try {
            String stringExtra3 = intent.getStringExtra("metadata");
            if (stringExtra3 == null) {
                stringExtra3 = new JSONObject().toString();
                Intrinsics.checkNotNullExpressionValue(stringExtra3, "JSONObject().toString()");
            }
            this.webviewMetaData = stringExtra3;
            JSONObject jSONObject = new JSONObject(this.webviewMetaData);
            this.isEntryAnimationRequired = jSONObject.optBoolean("isEntryAnimationRequired");
            this.isHtmlPayload = jSONObject.optBoolean("isHtmlPayload");
        } catch (Exception unused) {
            Log.e(this.TAG, "getConfig :: Exception while getting the MetaData using the JSON Object");
        }
        if (this.isEntryAnimationRequired) {
            this.entryAnimationResource = new JSONObject(this.webviewMetaData).optInt("entryAnimationResource");
        }
        if (this.isHtmlPayload) {
            String optString = new JSONObject(this.webviewMetaData).optString("htmlPayload");
            Intrinsics.checkNotNullExpressionValue(optString, "JSONObject(webviewMetaDa….optString(\"htmlPayload\")");
            this.htmlPayload = optString;
        }
    }

    private final void goBack(String str) {
        goBackWebView();
    }

    private final void goBackWebView() {
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (!pGWebView.canGoBack()) {
            Log.i(this.TAG, "BACK BUTTON : can not go back, Finish");
            sendWebviewEvent(new FullscreenWebviewEvent(this.webviewId, WebviewEventType.CLOSED, null, false, 12, null));
            finish();
        } else {
            Log.i(this.TAG, "BACK BUTTON : can go back");
            PGWebView pGWebView2 = this.webview;
            if (pGWebView2 != null) {
                pGWebView2.goBack();
            } else {
                Intrinsics.q("webview");
                throw null;
            }
        }
    }

    private final void goForward(String str) {
        runOnUiThread(new s0(this, 7));
    }

    public static final void m2goForward$lambda13(FullscreenWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.goForward();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void hideProgressDialog() {
        ProgressDialog progressDialog = this.progressDialog;
        if (progressDialog == null) {
            Intrinsics.q("progressDialog");
            throw null;
        }
        if (progressDialog == null) {
            Intrinsics.q("progressDialog");
            throw null;
        }
        if (progressDialog.isShowing()) {
            ProgressDialog progressDialog2 = this.progressDialog;
            if (progressDialog2 != null) {
                progressDialog2.dismiss();
            } else {
                Intrinsics.q("progressDialog");
                throw null;
            }
        }
    }

    private final void hideSystemUI() {
        if (Build.VERSION.SDK_INT < 30) {
            View decorView = getWindow().getDecorView();
            Intrinsics.checkNotNullExpressionValue(decorView, "window.decorView");
            decorView.setSystemUiVisibility(3846);
        } else {
            j0.a(getWindow(), false);
            G0 g0 = new G0(getWindow(), getWindow().getDecorView());
            g0.a(7);
            g0.d();
        }
    }

    @SuppressLint({"JavascriptInterface"})
    private final void initialize() {
        WebViewClient webViewClient = new WebViewClient() {
            private boolean loadHtml;

            @Override
            public void onPageFinished(@NotNull WebView view, @NotNull String interceptURL) {
                PGWebView pGWebView;
                String str;
                String str2;
                String str3;
                ProgressDialog progressDialog;
                ProgressDialog progressDialog2;
                Intrinsics.checkNotNullParameter(view, "view");
                Intrinsics.checkNotNullParameter(interceptURL, "interceptURL");
                FullscreenWebviewActivity.this.url = interceptURL;
                if (FullscreenWebviewActivity.this.isFinishing()) {
                    return;
                }
                super.onPageFinished(view, interceptURL);
                FullscreenWebviewActivity.this.unHideParentLayout(view);
                try {
                    pGWebView = FullscreenWebviewActivity.this.webview;
                    if (pGWebView == null) {
                        Intrinsics.q("webview");
                        throw null;
                    }
                    pGWebView.loadUrl("javascript:document.addEventListener(DOMContentLoaded, function(event) { Android.documentLoaded();});");
                    Locale locale = Locale.getDefault();
                    Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
                    String lowerCase = interceptURL.toLowerCase(locale);
                    Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
                    str = FullscreenWebviewActivity.this.url;
                    if (StringsKt.E(lowerCase, String.valueOf(str), false)) {
                        view.clearHistory();
                    }
                    if (b.a(FullscreenWebviewActivity.this)) {
                        progressDialog = FullscreenWebviewActivity.this.progressDialog;
                        if (progressDialog == null) {
                            Intrinsics.q("progressDialog");
                            throw null;
                        }
                        if (progressDialog.isShowing()) {
                            progressDialog2 = FullscreenWebviewActivity.this.progressDialog;
                            if (progressDialog2 == null) {
                                Intrinsics.q("progressDialog");
                                throw null;
                            }
                            progressDialog2.dismiss();
                        }
                    }
                    FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                    str2 = fullscreenWebviewActivity.webviewId;
                    WebviewEventType webviewEventType = WebviewEventType.LOADED;
                    JSONObject jSONObject = new JSONObject();
                    str3 = FullscreenWebviewActivity.this.webviewId;
                    jSONObject.put("webviewId", str3);
                    jSONObject.put("url", interceptURL);
                    Unit unit = Unit.a;
                    fullscreenWebviewActivity.sendWebviewEvent(new FullscreenWebviewEvent(str2, webviewEventType, jSONObject, false, 8, null));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onPageStarted(@NotNull WebView view, @NotNull String url, Bitmap bitmap) {
                String str;
                String str2;
                Intrinsics.checkNotNullParameter(view, "view");
                Intrinsics.checkNotNullParameter(url, "url");
                super.onPageStarted(view, url, bitmap);
                FullscreenWebviewActivity.this.webviewLoadError = false;
                FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                str = fullscreenWebviewActivity.webviewId;
                WebviewEventType webviewEventType = WebviewEventType.STARTED_LOADING;
                JSONObject jSONObject = new JSONObject();
                str2 = FullscreenWebviewActivity.this.webviewId;
                jSONObject.put("webviewId", str2);
                jSONObject.put("url", url);
                Unit unit = Unit.a;
                fullscreenWebviewActivity.sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
            }

            @Override
            public void onReceivedError(@NotNull WebView view, int i, @NotNull String description, @NotNull String failingUrl) {
                String str;
                Intrinsics.checkNotNullParameter(view, "view");
                Intrinsics.checkNotNullParameter(description, "description");
                Intrinsics.checkNotNullParameter(failingUrl, "failingUrl");
                super.onReceivedError(view, i, description, failingUrl);
                FullscreenWebviewActivity.this.webviewLoadError = true;
                view.setBackgroundColor(-1);
                JSONObject put = new JSONObject().put("errorCode", i);
                put.put("description", description);
                put.put("failingUrl", failingUrl);
                FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                str = fullscreenWebviewActivity.webviewId;
                fullscreenWebviewActivity.sendWebviewEvent(new FullscreenWebviewEvent(str, WebviewEventType.LOADERROR, put, false));
            }

            @Override
            public boolean onRenderProcessGone(WebView webView, @NotNull RenderProcessGoneDetail detail) {
                String str;
                String str2;
                String str3;
                String str4;
                ViewParent parent;
                RelativeLayout relativeLayout;
                Intrinsics.checkNotNullParameter(detail, "detail");
                str = FullscreenWebviewActivity.this.TAG;
                StringBuilder a = com.games24x7.pgwebview.a.a("onRenderProcessGone ::  Stopping WebView crash :: Webview Id is :: ");
                str2 = FullscreenWebviewActivity.this.webviewId;
                a.append(str2);
                a.append(" :: Crash Details are :: ");
                a.append(j.a(detail));
                Log.e(str, a.toString());
                if (webView != null) {
                    relativeLayout = FullscreenWebviewActivity.this.webViewLayout;
                    if (relativeLayout == null) {
                        Intrinsics.q("webViewLayout");
                        throw null;
                    }
                    if (relativeLayout.indexOfChild(webView) == -1) {
                        return true;
                    }
                }
                FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                str3 = fullscreenWebviewActivity.webviewId;
                WebviewEventType webviewEventType = WebviewEventType.WEBVIEW_CRASH;
                JSONObject jSONObject = new JSONObject();
                str4 = FullscreenWebviewActivity.this.webviewId;
                jSONObject.put("webviewId", str4);
                jSONObject.put("url", webView != null ? webView.getUrl() : null);
                Unit unit = Unit.a;
                fullscreenWebviewActivity.sendWebviewEvent(new FullscreenWebviewEvent(str3, webviewEventType, jSONObject, false));
                if (webView != null && (parent = webView.getParent()) != null && (parent instanceof ViewGroup)) {
                    ((ViewGroup) parent).removeView(webView);
                }
                FullscreenWebviewActivity.this.finish();
                return true;
            }

            @Override
            @SuppressLint({"NewApi"})
            public WebResourceResponse shouldInterceptRequest(@NotNull WebView view, @NotNull WebResourceRequest webResourceRequest) {
                CustomWebviewResponse customWebviewResponse;
                CustomWebviewResponse customWebviewResponse2;
                CustomWebviewResponse customWebviewResponse3;
                String str;
                String str2;
                CustomWebviewResponse customWebviewResponse4;
                String str3;
                CustomWebviewResponse customWebviewResponse5;
                String str4;
                String str5;
                Intrinsics.checkNotNullParameter(view, "view");
                Intrinsics.checkNotNullParameter(webResourceRequest, "webResourceRequest");
                String uri = webResourceRequest.getUrl().toString();
                Intrinsics.checkNotNullExpressionValue(uri, "webResourceRequest.url.toString()");
                if (!FullscreenWebviewActivity.this.isFinishing() && o.e(uri, ".js")) {
                    customWebviewResponse = FullscreenWebviewActivity.this.customWebviewResponse;
                    if (customWebviewResponse != null) {
                        customWebviewResponse2 = FullscreenWebviewActivity.this.customWebviewResponse;
                        Intrinsics.c(customWebviewResponse2);
                        if (customWebviewResponse2.getWebViewResponseOverrideRequired()) {
                            customWebviewResponse3 = FullscreenWebviewActivity.this.customWebviewResponse;
                            Intrinsics.c(customWebviewResponse3);
                            if (!customWebviewResponse3.getCacheFolderMap().isEmpty()) {
                                try {
                                    File filesDir = FullscreenWebviewActivity.this.getFilesDir();
                                    Intrinsics.checkNotNullExpressionValue(filesDir, "filesDir");
                                    String b = b.b(uri);
                                    customWebviewResponse5 = FullscreenWebviewActivity.this.customWebviewResponse;
                                    Intrinsics.c(customWebviewResponse5);
                                    String str6 = customWebviewResponse5.getCacheFolderMap().get(b);
                                    if (str6 != null) {
                                        File file = new File(filesDir, str6);
                                        if (file.exists()) {
                                            WebResourceResponse a = b.a(file);
                                            return a == null ? super.shouldInterceptRequest(view, webResourceRequest) : a;
                                        }
                                    }
                                    FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                                    str4 = fullscreenWebviewActivity.webviewId;
                                    WebviewEventType webviewEventType = WebviewEventType.CACHE_MISSED;
                                    JSONObject jSONObject = new JSONObject();
                                    str5 = FullscreenWebviewActivity.this.webviewId;
                                    jSONObject.put("webviewId", str5);
                                    jSONObject.put("url", uri);
                                    Unit unit = Unit.a;
                                    fullscreenWebviewActivity.sendWebviewEvent(new FullscreenWebviewEvent(str4, webviewEventType, jSONObject, false, 8, null));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    FullscreenWebviewActivity fullscreenWebviewActivity2 = FullscreenWebviewActivity.this;
                                    str = fullscreenWebviewActivity2.webviewId;
                                    WebviewEventType webviewEventType2 = WebviewEventType.EXCEPTION;
                                    JSONObject jSONObject2 = new JSONObject();
                                    str2 = FullscreenWebviewActivity.this.webviewId;
                                    jSONObject2.put("webviewId", str2);
                                    jSONObject2.put("url", uri);
                                    Unit unit2 = Unit.a;
                                    fullscreenWebviewActivity2.sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType2, jSONObject2, false, 8, null));
                                }
                                customWebviewResponse4 = FullscreenWebviewActivity.this.customWebviewResponse;
                                if (customWebviewResponse4 != null) {
                                    FullscreenWebviewActivity fullscreenWebviewActivity3 = FullscreenWebviewActivity.this;
                                    if (customWebviewResponse4.getCustomAssetFileName().length() > 0 && !fullscreenWebviewActivity3.isFinishing()) {
                                        AssetManager assets = fullscreenWebviewActivity3.getAssets();
                                        Intrinsics.checkNotNullExpressionValue(assets, "assets");
                                        try {
                                            String localFilePath = webResourceRequest.getUrl().getPath();
                                            if (localFilePath != null) {
                                                str3 = fullscreenWebviewActivity3.TAG;
                                                Log.d(str3, "shouldInterceptRequest() :: localPath is ".concat(localFilePath));
                                                Intrinsics.checkNotNullExpressionValue(localFilePath, "localFilePath");
                                                if (!o.e(localFilePath, ".ico")) {
                                                    String str7 = b.a;
                                                    return new WebResourceResponse(b.c(StringsKt.V('/', localFilePath, localFilePath)), "UTF-8", assets.open(customWebviewResponse4.getCustomAssetFileName() + localFilePath));
                                                }
                                            }
                                        } catch (Exception e2) {
                                            e2.printStackTrace();
                                        }
                                    }
                                }
                                return super.shouldInterceptRequest(view, webResourceRequest);
                            }
                        }
                    }
                }
                return super.shouldInterceptRequest(view, webResourceRequest);
            }

            @Override
            public boolean shouldOverrideUrlLoading(@NotNull WebView view, WebResourceRequest webResourceRequest) {
                String str;
                String str2;
                String str3;
                String str4;
                String str5;
                String str6;
                String str7;
                String str8;
                String str9;
                Intrinsics.checkNotNullParameter(view, "view");
                try {
                    str4 = FullscreenWebviewActivity.this.url;
                    if (str4 != null) {
                        FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                        if (StringsKt.E(str4, "mailto:", false)) {
                            str8 = fullscreenWebviewActivity.url;
                            Uri parse = Uri.parse(str8);
                            Intent intent = new Intent("android.intent.action.SENDTO");
                            intent.setData(parse);
                            view.stopLoading();
                            fullscreenWebviewActivity.startActivity(Intent.createChooser(intent, "Send email"));
                            str9 = fullscreenWebviewActivity.url;
                            return shouldOverrideUrlLoading(view, str9);
                        }
                        if (StringsKt.E(str4, "tel:", false)) {
                            Intent intent2 = new Intent("android.intent.action.DIAL");
                            str5 = fullscreenWebviewActivity.url;
                            intent2.setData(Uri.parse(str5));
                            view.stopLoading();
                            str6 = fullscreenWebviewActivity.url;
                            fullscreenWebviewActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str6)));
                            str7 = fullscreenWebviewActivity.url;
                            return shouldOverrideUrlLoading(view, str7);
                        }
                    }
                } catch (Exception e) {
                    str = FullscreenWebviewActivity.this.TAG;
                    Log.e(str, "shouldOverrideUrlLoading :: Got crash :: Crash");
                    e.printStackTrace();
                }
                FullscreenWebviewActivity fullscreenWebviewActivity2 = FullscreenWebviewActivity.this;
                str2 = fullscreenWebviewActivity2.webviewId;
                WebviewEventType webviewEventType = WebviewEventType.SHOULD_OVERRIDE_URL;
                JSONObject jSONObject = new JSONObject();
                str3 = FullscreenWebviewActivity.this.webviewId;
                jSONObject.put("webviewId", str3);
                jSONObject.put("url", webResourceRequest != null ? webResourceRequest.getUrl() : null);
                Unit unit = Unit.a;
                fullscreenWebviewActivity2.sendWebviewEvent(new FullscreenWebviewEvent(str2, webviewEventType, jSONObject, true));
                return super.shouldOverrideUrlLoading(view, webResourceRequest);
            }
        };
        WebChromeClient webChromeClient = new WebChromeClient() {
            public static void openFileChooser$default(FullscreenWebviewActivity$initialize$webChromeClient$1 fullscreenWebviewActivity$initialize$webChromeClient$1, ValueCallback valueCallback, String str, int i, Object obj) {
                if ((i & 2) != 0) {
                    str = "";
                }
                fullscreenWebviewActivity$initialize$webChromeClient$1.openFileChooser(valueCallback, str);
            }

            @Override
            public boolean onConsoleMessage(@NotNull ConsoleMessage cm) {
                Intrinsics.checkNotNullParameter(cm, "cm");
                String format = String.format("%s @ line %d: %s", Arrays.copyOf(new Object[]{cm.message(), Integer.valueOf(cm.lineNumber()), cm.sourceId()}, 3));
                Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
                Log.i("webViewConsole", format);
                return super.onConsoleMessage(cm);
            }

            @Override
            @SuppressLint({"NewApi"})
            public void onPermissionRequest(@NotNull PermissionRequest request) {
                Intrinsics.checkNotNullParameter(request, "request");
                Log.d("", "onPermissionRequest");
                request.grant(request.getResources());
            }

            @Override
            public void onProgressChanged(@NotNull WebView view, int i) {
                ProgressDialog progressDialog;
                ProgressDialog progressDialog2;
                Intrinsics.checkNotNullParameter(view, "view");
                if (i >= 100) {
                    progressDialog = FullscreenWebviewActivity.this.progressDialog;
                    if (progressDialog == null) {
                        Intrinsics.q("progressDialog");
                        throw null;
                    }
                    if (progressDialog.isShowing()) {
                        try {
                            progressDialog2 = FullscreenWebviewActivity.this.progressDialog;
                            if (progressDialog2 != null) {
                                progressDialog2.dismiss();
                            } else {
                                Intrinsics.q("progressDialog");
                                throw null;
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }

            @Override
            public boolean onShowFileChooser(@NotNull WebView webView, @NotNull ValueCallback<Uri[]> filePathCallback, @NotNull WebChromeClient.FileChooserParams fileChooserParams) {
                String str;
                ValueCallback valueCallback;
                int i;
                Intrinsics.checkNotNullParameter(webView, "webView");
                Intrinsics.checkNotNullParameter(filePathCallback, "filePathCallback");
                Intrinsics.checkNotNullParameter(fileChooserParams, "fileChooserParams");
                str = FullscreenWebviewActivity.this.TAG;
                Log.e(str, "onShowFileChooser :: File chooser has been called fro chrome client...");
                FullscreenWebviewActivity.this.mFilePathCallback = filePathCallback;
                try {
                    Intent createIntent = fileChooserParams.createIntent();
                    FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                    i = fullscreenWebviewActivity.FILECHOOSER_RESULTCODE;
                    fullscreenWebviewActivity.startActivityForResult(createIntent, i);
                    return true;
                } catch (Exception e) {
                    e.printStackTrace();
                    valueCallback = FullscreenWebviewActivity.this.mFilePathCallback;
                    Intrinsics.c(valueCallback);
                    valueCallback.onReceiveValue(null);
                    FullscreenWebviewActivity.this.mFilePathCallback = null;
                    return false;
                }
            }

            public final void openFileChooser(ValueCallback<Uri> valueCallback, String str) {
                Uri uri;
                int i;
                FullscreenWebviewActivity.this.mUploadMessage = valueCallback;
                try {
                    File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "AndroidExampleFolder");
                    if (!file.exists()) {
                        file.mkdirs();
                    }
                    FullscreenWebviewActivity.this.mCapturedImageURI = Uri.fromFile(new File(file.toString() + File.separator + "IMG_" + System.currentTimeMillis() + ".jpg"));
                    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
                    uri = FullscreenWebviewActivity.this.mCapturedImageURI;
                    intent.putExtra("output", uri);
                    Intent intent2 = new Intent("android.intent.action.GET_CONTENT");
                    intent2.addCategory("android.intent.category.OPENABLE");
                    intent2.setType("image/*");
                    Intent createChooser = Intent.createChooser(intent2, "Image Chooser");
                    createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", new Parcelable[]{intent});
                    FullscreenWebviewActivity fullscreenWebviewActivity = FullscreenWebviewActivity.this;
                    i = fullscreenWebviewActivity.FILECHOOSER_RESULTCODE;
                    fullscreenWebviewActivity.startActivityForResult(createChooser, i);
                } catch (Exception e) {
                    Toast.makeText(FullscreenWebviewActivity.this.getBaseContext(), "Exception:" + e, 1).show();
                }
            }

            public final void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
                openFileChooser(valueCallback, str);
            }
        };
        List<JsInterfaceHolder> jsInterfaceList = WebviewRequestEventHandler.Companion.getJsInterfaceList(this.webviewId);
        if (jsInterfaceList != null) {
            for (JsInterfaceHolder jsInterfaceHolder : jsInterfaceList) {
                PGWebView pGWebView = this.webview;
                if (pGWebView == null) {
                    Intrinsics.q("webview");
                    throw null;
                }
                pGWebView.addJavascriptInterface(jsInterfaceHolder.getJsClass(), jsInterfaceHolder.getJsName());
            }
        }
        PGWebView pGWebView2 = this.webview;
        if (pGWebView2 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView2.setWebViewClient(webViewClient);
        PGWebView pGWebView3 = this.webview;
        if (pGWebView3 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView3.setWebChromeClient(webChromeClient);
    }

    private final void loadData(String str, String str2, String str3, String str4, String str5) {
        runOnUiThread(new b(this, str5, str2, str3, str4));
    }

    public static final void m3loadData$lambda8(FullscreenWebviewActivity this$0, String baseUrl, String data, String mimeType, String encoding) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(baseUrl, "$baseUrl");
        Intrinsics.checkNotNullParameter(data, "$data");
        Intrinsics.checkNotNullParameter(mimeType, "$mimeType");
        Intrinsics.checkNotNullParameter(encoding, "$encoding");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadFile(String str, String str2) {
        runOnUiThread(new p(this, str2, 12));
    }

    public static final void m4loadFile$lambda10(FullscreenWebviewActivity this$0, String filePath) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(filePath, "$filePath");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadUrl(filePath);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadHtml(String str, String str2, String str3) {
        runOnUiThread(new v(1, this, str3, str2));
    }

    public static final void m5loadHtml$lambda9(FullscreenWebviewActivity this$0, String baseUrl, String html) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(baseUrl, "$baseUrl");
        Intrinsics.checkNotNullParameter(html, "$html");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadDataWithBaseURL(baseUrl, html, null, null, null);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void loadUrl(String str, String str2) {
        String str3 = this.TAG;
        StringBuilder a = com.games24x7.pgwebview.a.a("loadUrlWebview :: Loading url into webviewId as ");
        a.append(this.webviewId);
        a.append(" :: Url is ");
        a.append(str2);
        Log.i(str3, a.toString());
        WebViewConfiguration webViewConfiguration = this.webViewConfiguration;
        if (webViewConfiguration == null) {
            Intrinsics.q("webViewConfiguration");
            throw null;
        }
        if (Intrinsics.a(webViewConfiguration.getEnableEvaluateJs(), Boolean.TRUE) && StringsKt.E(str2, "javascript:", false)) {
            evaluateJS(this.webviewId, str2);
        } else {
            runOnUiThread(new E(this, str2, 1));
        }
    }

    public static final void m6loadUrl$lambda15(FullscreenWebviewActivity this$0, String url) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(url, "$url");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.loadUrl(url);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    public static final void m7onRequest$lambda21(FullscreenWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        this$0.showProgressDialog();
    }

    public static final void m8onRequest$lambda22(FullscreenWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        this$0.hideProgressDialog();
    }

    private final void reload(String str) {
        runOnUiThread(new androidx.camera.camera2.internal.o(this, 8));
    }

    public static final void m9reload$lambda12(FullscreenWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.reload();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    private final void sendWebviewCreatedEvent() {
        sendWebviewEvent(new FullscreenWebviewEvent(this.webviewId, WebviewEventType.CREATED, null, false, 12, null));
    }

    public final void sendWebviewEvent(FullscreenWebviewEvent fullscreenWebviewEvent) {
        org.greenrobot.eventbus.b.c().i(fullscreenWebviewEvent);
    }

    private final void setBackgroundColor(String str, JSONObject jSONObject) {
        try {
            Intrinsics.c(jSONObject);
            int optInt = jSONObject.optInt("resId");
            PGWebView pGWebView = this.webview;
            if (pGWebView != null) {
                pGWebView.setBackgroundColor(optInt);
            } else {
                Intrinsics.q("webview");
                throw null;
            }
        } catch (Exception e) {
            Log.e(this.TAG, "setBackgroundColor :: Exception while parsing the Resource Id");
            e.printStackTrace();
        }
    }

    private final void setBackgroundResource(String str, JSONObject jSONObject) {
        try {
            Intrinsics.c(jSONObject);
            int optInt = jSONObject.optInt("resId");
            PGWebView pGWebView = this.webview;
            if (pGWebView != null) {
                pGWebView.setBackgroundResource(optInt);
            } else {
                Intrinsics.q("webview");
                throw null;
            }
        } catch (Exception e) {
            Log.e(this.TAG, "setBackgroundResource :: Exception while parsing the Resource Id");
            e.printStackTrace();
        }
    }

    @SuppressLint({"SourceLockedOrientationActivity"})
    private final void setOrientation() {
        try {
            setRequestedOrientation(Intrinsics.a("portrait", this.orientation) ? 1 : 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private final void showDialog(String str) {
        new AlertDialog.Builder(this).setMessage(str).setPositiveButton("Ok", (DialogInterface.OnClickListener) null).show();
    }

    private final void showFullScreen() {
        j0.a(getWindow(), false);
        RelativeLayout relativeLayout = this.webViewLayout;
        if (relativeLayout == null) {
            Intrinsics.q("webViewLayout");
            throw null;
        }
        View rootView = relativeLayout.getRootView();
        com.games24x7.pgpayment.a aVar = new com.games24x7.pgpayment.a(2);
        WeakHashMap<View, g0> weakHashMap = X.a;
        X.d.u(rootView, aVar);
        G0 g0 = new G0(getWindow(), getWindow().getDecorView());
        g0.a(7);
        g0.d();
        g0.c(false);
        g0.b(false);
    }

    public static final q0 m10showFullScreen$lambda23(View view, q0 q0Var) {
        androidx.core.graphics.b f = q0Var.a.f(128);
        Intrinsics.checkNotNullExpressionValue(f, "insets.getInsets(WindowI…pat.Type.displayCutout())");
        view.setPadding(Math.max(view.getPaddingLeft(), f.a), Math.max(view.getPaddingTop(), f.b), Math.max(view.getPaddingRight(), f.c), Math.max(view.getPaddingBottom(), f.d));
        return q0Var;
    }

    private final void showProgressDialog() {
        ProgressDialog progressDialog = this.progressDialog;
        if (progressDialog == null) {
            Intrinsics.q("progressDialog");
            throw null;
        }
        if (progressDialog == null) {
            Intrinsics.q("progressDialog");
            throw null;
        }
        if (progressDialog.isShowing()) {
            return;
        }
        ProgressDialog progressDialog2 = this.progressDialog;
        if (progressDialog2 != null) {
            progressDialog2.show();
        } else {
            Intrinsics.q("progressDialog");
            throw null;
        }
    }

    private final void stopLoading(String str) {
        runOnUiThread(new F(this, 10));
    }

    public static final void m11stopLoading$lambda11(FullscreenWebviewActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PGWebView pGWebView = this$0.webview;
        if (pGWebView != null) {
            pGWebView.stopLoading();
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    public final void unHideParentLayout(WebView webView) {
        String str = this.TAG;
        StringBuilder a = com.games24x7.pgwebview.a.a("unHideParentLayout :: Setting Background Color :: ");
        a.append(this.isBackGroundTransparent);
        Log.e(str, a.toString());
        if (!this.isBackGroundTransparent) {
            webView.setBackgroundColor(-1);
            return;
        }
        webView.setBackgroundColor(0);
        RelativeLayout relativeLayout = this.webViewLayout;
        if (relativeLayout != null) {
            relativeLayout.setBackgroundColor(0);
        } else {
            Intrinsics.q("webViewLayout");
            throw null;
        }
    }

    @Override
    public boolean dispatchTouchEvent(@NotNull MotionEvent ev) {
        Intrinsics.checkNotNullParameter(ev, "ev");
        if (this.inProgress) {
            return true;
        }
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public void finish() {
        if (!isFinishing()) {
            ProgressDialog progressDialog = this.progressDialog;
            if (progressDialog == null) {
                Intrinsics.q("progressDialog");
                throw null;
            }
            if (progressDialog == null) {
                Intrinsics.q("progressDialog");
                throw null;
            }
            if (progressDialog.isShowing()) {
                ProgressDialog progressDialog2 = this.progressDialog;
                if (progressDialog2 == null) {
                    Intrinsics.q("progressDialog");
                    throw null;
                }
                progressDialog2.dismiss();
            }
        }
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.FINISH;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
        super.finish();
        if (this.isExitAnimationRequired) {
            overridePendingTransition(0, this.exitAnimationResource);
        }
    }

    public final boolean getInProgress() {
        return this.inProgress;
    }

    public final boolean isBackGroundTransparent() {
        return this.isBackGroundTransparent;
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        Bundle extras;
        super.onActivityResult(i, i2, intent);
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_ACTIVITY_RESULT;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        jSONObject.put("requestCode", i);
        jSONObject.put("resultCode", i2);
        jSONObject.put("intentDataInJSON", (intent == null || (extras = intent.getExtras()) == null) ? null : b.a(extras));
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
        if (i == this.FILECHOOSER_RESULTCODE) {
            if (i2 != -1 || intent == null) {
                ValueCallback<Uri[]> valueCallback = this.mFilePathCallback;
                if (valueCallback == null) {
                    return;
                } else {
                    valueCallback.onReceiveValue(null);
                }
            } else {
                if (this.mFilePathCallback == null) {
                    return;
                }
                Uri[] parseResult = WebChromeClient.FileChooserParams.parseResult(i2, intent);
                ValueCallback<Uri[]> valueCallback2 = this.mFilePathCallback;
                Intrinsics.c(valueCallback2);
                valueCallback2.onReceiveValue(parseResult);
            }
            this.mFilePathCallback = null;
        }
    }

    @Override
    public void onBackPressed() {
        Log.i(this.TAG, "BACK CLICKED");
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_BACK_PRESSED;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
    }

    @Override
    public void onCreate(Bundle bundle) {
        getWindow().setBackgroundDrawable(new ColorDrawable(0));
        supportRequestWindowFeature(1);
        getWindow().setFlags(LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY, LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY);
        super.onCreate(bundle);
        getConfig();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_CREATE;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
        configure();
        if (Build.VERSION.SDK_INT >= 35) {
            showFullScreen();
        }
        setOrientation();
        RelativeLayout relativeLayout = this.webViewLayout;
        if (relativeLayout == null) {
            Intrinsics.q("webViewLayout");
            throw null;
        }
        setContentView(relativeLayout);
        a.C0040a.a(this);
        initialize();
        String str2 = this.url;
        if (str2 != null) {
            PGWebView pGWebView = this.webview;
            if (pGWebView == null) {
                Intrinsics.q("webview");
                throw null;
            }
            pGWebView.loadUrl(str2);
        }
        if (this.isHtmlPayload) {
            String str3 = this.webviewId;
            String str4 = this.htmlPayload;
            String str5 = this.url;
            if (str5 == null) {
                str5 = "";
            }
            loadHtml(str3, str4, str5);
        }
    }

    @Override
    public void onDestroy() {
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        pGWebView.destroy();
        super.onDestroy();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_DESTROY;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView2 = this.webview;
        if (pGWebView2 == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView2.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
    }

    @Override
    public void onNewIntent(@NotNull Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        super.onNewIntent(intent);
        Uri data = intent.getData();
        if (data == null) {
            return;
        }
        String uri = data.toString();
        Intrinsics.checkNotNullExpressionValue(uri, "uri.toString()");
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        if (pGWebView != null) {
            pGWebView.loadUrl(uri);
        } else {
            Intrinsics.q("webview");
            throw null;
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_PAUSE;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        PGWebView pGWebView = this.webview;
        if (pGWebView == null) {
            Intrinsics.q("webview");
            throw null;
        }
        String url = pGWebView.getUrl();
        if (url == null) {
            url = "";
        }
        jSONObject.put("url", url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
    }

    @i(threadMode = ThreadMode.MAIN_ORDERED)
    public final void onRequest(@NotNull FullscreenReqEvent event) {
        Runnable cVar;
        Intrinsics.checkNotNullParameter(event, "event");
        Log.e(this.TAG, "onRequested " + event);
        switch (WhenMappings.$EnumSwitchMapping$0[event.getWebReqEventType().ordinal()]) {
            case 1:
                try {
                    JSONObject payload = event.getPayload();
                    Boolean valueOf = payload != null ? Boolean.valueOf(payload.optBoolean("isExitAnimationRequired")) : null;
                    Intrinsics.c(valueOf);
                    this.isExitAnimationRequired = valueOf.booleanValue();
                    this.exitAnimationResource = event.getPayload().optInt("exitAnimationResource");
                    finish();
                    return;
                } catch (Exception unused) {
                    Log.e(this.TAG, "onRequest :: Close Request Exception ...");
                    return;
                }
            case 2:
                JSONObject payload2 = event.getPayload();
                String string = payload2 != null ? payload2.getString("url") : null;
                loadUrl(event.getId(), string != null ? string : "");
                return;
            case 3:
                JSONObject payload3 = event.getPayload();
                String string2 = payload3 != null ? payload3.getString("script") : null;
                evaluateJS(event.getId(), string2 != null ? string2 : "");
                return;
            case 4:
                JSONObject payload4 = event.getPayload();
                String string3 = payload4 != null ? payload4.getString("data") : null;
                String str = string3 == null ? "" : string3;
                JSONObject payload5 = event.getPayload();
                String string4 = payload5 != null ? payload5.getString("mimeType") : null;
                String str2 = string4 == null ? "" : string4;
                JSONObject payload6 = event.getPayload();
                String string5 = payload6 != null ? payload6.getString("encoding") : null;
                String str3 = string5 == null ? "" : string5;
                JSONObject payload7 = event.getPayload();
                String string6 = payload7 != null ? payload7.getString("baseUrl") : null;
                loadData(event.getId(), str, str2, str3, string6 == null ? "" : string6);
                return;
            case 5:
                JSONObject payload8 = event.getPayload();
                String string7 = payload8 != null ? payload8.getString("html") : null;
                if (string7 == null) {
                    string7 = "";
                }
                JSONObject payload9 = event.getPayload();
                String string8 = payload9 != null ? payload9.getString("baseUrl") : null;
                loadHtml(event.getId(), string7, string8 != null ? string8 : "");
                return;
            case 6:
                JSONObject payload10 = event.getPayload();
                String string9 = payload10 != null ? payload10.getString("filePath") : null;
                loadFile(event.getId(), string9 != null ? string9 : "");
                return;
            case 7:
                stopLoading(event.getId());
                return;
            case 8:
                reload(event.getId());
                return;
            case 9:
                canGoBack(event.getId());
                return;
            case 10:
                canGoForward(event.getId());
                return;
            case 11:
                goForward(event.getId());
                return;
            case h.CUSTOM_ATTRIBUTES_FIELD_NUMBER:
                goBack(event.getId());
                return;
            case 13:
                setBackgroundResource(event.getId(), event.getPayload());
                return;
            case ConnectionResult.TIMEOUT:
                setBackgroundColor(event.getId(), event.getPayload());
                return;
            case ConnectionResult.INTERRUPTED:
                cVar = new c(this, 2);
                break;
            case ConnectionResult.API_UNAVAILABLE:
                cVar = new com.appsflyer.b(this, 1);
                break;
            default:
                return;
        }
        runOnUiThread(cVar);
    }

    @Override
    public void onRestart() {
        super.onRestart();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_RESTART;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
    }

    @Override
    public void onResume() {
        super.onResume();
        String str = this.webviewId;
        WebviewEventType webviewEventType = WebviewEventType.ON_RESUME;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("webviewId", this.webviewId);
        jSONObject.put("url", this.url);
        Unit unit = Unit.a;
        sendWebviewEvent(new FullscreenWebviewEvent(str, webviewEventType, jSONObject, true));
    }

    @Override
    public void onStart() {
        super.onStart();
        org.greenrobot.eventbus.b.c().m(this);
    }

    @Override
    public void onStop() {
        super.onStop();
        org.greenrobot.eventbus.b.c().o(this);
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        if (z) {
            hideSystemUI();
        }
    }

    public final void setBackGroundTransparent(boolean z) {
        this.isBackGroundTransparent = z;
    }

    public final void setInProgress(boolean z) {
        this.inProgress = z;
    }
}