BTGO游戏盒 v3.4.80版本的 MD5 值为:000032bab1addaabfdc671ee6a7087ab

以下内容为反编译后的 AppGameWebActivity.java 源代码,内容仅作参考


package com.bbbtgo.android.ui.activity;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebStorage;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.core.app.NotificationCompat;
import androidx.exifinterface.media.ExifInterface;
import butterknife.BindView;
import com.alipay.sdk.widget.j;
import com.bbbtgo.android.R;
import com.bbbtgo.android.ui.activity.AppGameWebActivity;
import com.bbbtgo.sdk.common.base.BaseTitleActivity;
import com.bbbtgo.sdk.common.entity.AppInfo;
import com.bbbtgo.sdk.common.entity.JumpInfo;
import com.bbbtgo.sdk.common.entity.ShareInfo;
import com.bbbtgo.sdk.common.user.UserInfo;
import com.efs.sdk.base.core.util.NetworkUtil;
import com.google.gson.Gson;
import com.qiyukf.module.log.entry.LogConstants;
import com.qiyukf.module.zip4j.util.InternalZipConstants;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import m1.h0;
import m5.i;
import m5.n;
import m5.v;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import t4.h;
import u1.f0;
import x1.s;
import y4.g;

public class AppGameWebActivity extends BaseTitleActivity implements f0.a, s.b {

    @BindView
    public ProgressBar mProgress;

    @BindView
    public WebView mWebView;

    public ShareInfo f4440o;

    public boolean f4441p;

    public boolean f4442q;

    public boolean f4443r;

    public Handler f4444s;

    public String f4438m = "";

    public String f4439n = "";

    public class JavaWebExternal {
        public JavaWebExternal() {
        }

        @JavascriptInterface
        public void callPhone(String str) {
            n4.b.b("AppGameWebActivity", "callPhone");
            AppGameWebActivity.this.n5(str);
        }

        @JavascriptInterface
        public void copyText(String str) {
            n4.b.b("AppGameWebActivity", "copyText");
            AppGameWebActivity.this.o5(str);
        }

        @JavascriptInterface
        public void deleteDownload(String str) {
            n4.b.b("AppGameWebActivity", "deleteDownload");
            AppGameWebActivity.this.p5(str);
        }

        @JavascriptInterface
        public void finish() {
            n4.b.b("AppGameWebActivity", LogConstants.UPLOAD_FINISH);
            AppGameWebActivity.this.q5();
        }

        @JavascriptInterface
        public void getAppState(String str) {
            n4.b.b("AppGameWebActivity", "initAppState");
            AppGameWebActivity.this.r5(str);
        }

        @JavascriptInterface
        public String getCommonParam() {
            n4.b.b("AppGameWebActivity", "getCommonParam");
            return AppGameWebActivity.this.s5();
        }

        @JavascriptInterface
        public String getDeviceInfo() {
            n4.b.b("AppGameWebActivity", "getDeviceInfo");
            return AppGameWebActivity.this.t5();
        }

        @JavascriptInterface
        public int getNetType() {
            n4.b.b("AppGameWebActivity", "getNetType");
            return AppGameWebActivity.this.u5();
        }

        @JavascriptInterface
        public String getUserInfo() {
            n4.b.b("AppGameWebActivity", "getUserInfo");
            return AppGameWebActivity.this.v5();
        }

        @JavascriptInterface
        public void goBack() {
            n4.b.b("AppGameWebActivity", "goBack");
            AppGameWebActivity.this.w5();
        }

        @JavascriptInterface
        public int installApp(String str) {
            n4.b.b("AppGameWebActivity", "installApp");
            return AppGameWebActivity.this.x5(str);
        }

        @JavascriptInterface
        public void invokeLogin() {
            n4.b.b("AppGameWebActivity", "invokeLogin");
            AppGameWebActivity.this.y5();
        }

        @JavascriptInterface
        public void joinQQGroup(String str, String str2) {
            n4.b.b("AppGameWebActivity", "joinQQGroup");
            AppGameWebActivity.this.z5(str, str2);
        }

        @JavascriptInterface
        public void jumpToNativePage(String str) {
            n4.b.b("AppGameWebActivity", "jumpToNativePage");
            AppGameWebActivity.this.A5(str);
        }

        @JavascriptInterface
        public void openApp(String str) {
            n4.b.b("AppGameWebActivity", "openApp");
            AppGameWebActivity.this.B5(str);
        }

        @JavascriptInterface
        public void openBrowser(String str) {
            n4.b.b("AppGameWebActivity", "openBrowser");
            AppGameWebActivity.this.C5(str);
        }

        @JavascriptInterface
        public void openQQChat(String str) {
            n4.b.b("AppGameWebActivity", "openQQChat");
            AppGameWebActivity.this.D5(str);
        }

        @JavascriptInterface
        public void openUrl(String str) {
            n4.b.b("AppGameWebActivity", "openUrl");
            AppGameWebActivity.this.E5(str);
        }

        @JavascriptInterface
        public void setScreenMode(int i10) {
            n4.b.b("AppGameWebActivity", "setScreenMode");
            AppGameWebActivity.this.F5(i10);
        }

        @JavascriptInterface
        public void setShareData(String str) {
            n4.b.b("AppGameWebActivity", "setShareData");
            AppGameWebActivity.this.G5(str);
        }

        @JavascriptInterface
        public void setTitle(String str) {
            n4.b.b("AppGameWebActivity", j.f2134d);
            AppGameWebActivity.this.H5(str);
        }

        @JavascriptInterface
        public void share(String str) {
            n4.b.b("AppGameWebActivity", "share");
            AppGameWebActivity.this.I5(str);
        }

        @JavascriptInterface
        public void showTitle(int i10) {
            n4.b.b("AppGameWebActivity", "setIsNav");
            AppGameWebActivity.this.J5(i10);
        }

        @JavascriptInterface
        public void showToast(String str) {
            n4.b.b("AppGameWebActivity", "showToast");
            AppGameWebActivity.this.K5(str);
        }

        @JavascriptInterface
        public int startDownload(String str) {
            n4.b.b("AppGameWebActivity", "startDownload");
            return AppGameWebActivity.this.L5(str);
        }

        @JavascriptInterface
        public void stopDownload(String str) {
            n4.b.b("AppGameWebActivity", "stopDownload");
            AppGameWebActivity.this.M5(str);
        }
    }

    public class a implements Runnable {

        public class ViewOnClickListenerC0052a implements View.OnClickListener {
            public ViewOnClickListenerC0052a() {
            }

            @Override
            public void onClick(View view) {
                if (AppGameWebActivity.this.f4440o == null) {
                    AppGameWebActivity.this.f4440o = new ShareInfo();
                    AppGameWebActivity.this.f4440o.h(AppGameWebActivity.this.f4438m);
                    AppGameWebActivity.this.f4440o.i(AppGameWebActivity.this.f4439n);
                }
                AppGameWebActivity appGameWebActivity = AppGameWebActivity.this;
                s.f(appGameWebActivity, appGameWebActivity.f4440o);
            }
        }

        public a() {
        }

        @Override
        public void run() {
            AppGameWebActivity.this.j5(R.id.iv_title_share, new ViewOnClickListenerC0052a());
        }
    }

    public class b implements Runnable {

        public final String f4448a;

        public b(String str) {
            this.f4448a = str;
        }

        @Override
        public void run() {
            s.g(AppGameWebActivity.this, ShareInfo.e(this.f4448a), AppGameWebActivity.this);
        }
    }

    public class c extends WebChromeClient {
        public c() {
        }

        @Override
        public void onProgressChanged(WebView webView, int i10) {
            super.onProgressChanged(webView, i10);
            n4.b.b("AppGameWebActivity", "newProgress:" + i10);
            AppGameWebActivity.this.mProgress.setProgress(i10);
        }

        public void onReachedMaxAppCacheSize(long j10, long j11, WebStorage.QuotaUpdater quotaUpdater) {
            quotaUpdater.updateQuota(j10 * 2);
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            n4.b.b("AppGameWebActivity", "Title:" + str);
            if (!TextUtils.isEmpty(str) && TextUtils.isEmpty(AppGameWebActivity.this.f4438m)) {
                AppGameWebActivity.this.f4438m = str;
            }
            AppGameWebActivity appGameWebActivity = AppGameWebActivity.this;
            appGameWebActivity.N1(appGameWebActivity.f4438m);
        }
    }

    public static class d extends Handler {

        public WeakReference<AppGameWebActivity> f4451a;

        public d(AppGameWebActivity appGameWebActivity) {
            this.f4451a = new WeakReference<>(appGameWebActivity);
        }

        @Override
        public void handleMessage(Message message) {
            super.handleMessage(message);
            AppGameWebActivity appGameWebActivity = this.f4451a.get();
            if (appGameWebActivity != null && !appGameWebActivity.f4442q) {
                int i10 = message.what;
                if (i10 == 4) {
                    if (message.arg1 == 0) {
                        appGameWebActivity.mProgress.setVisibility(8);
                        appGameWebActivity.f8624h.setVisibility(8);
                        return;
                    } else {
                        appGameWebActivity.f8624h.setVisibility(0);
                        return;
                    }
                }
                if (i10 == 0) {
                    appGameWebActivity.o6();
                    return;
                }
                if (i10 == 1) {
                    appGameWebActivity.n6();
                } else if (i10 == 2) {
                    appGameWebActivity.m6();
                } else if (i10 == 3) {
                    appGameWebActivity.mWebView.loadUrl((String) message.obj);
                }
            }
        }
    }

    public class e extends WebViewClient {
        public e() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            n4.b.b("AppGameWebActivity", "Loaded Url is " + webView.getUrl());
            if (!AppGameWebActivity.this.f4441p && !TextUtils.isEmpty(str)) {
                AppGameWebActivity.this.f4444s.sendEmptyMessageDelayed(0, 400L);
            } else {
                AppGameWebActivity.this.f4444s.sendEmptyMessage(2);
            }
        }

        @Override
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            super.onReceivedError(webView, webResourceRequest, webResourceError);
            AppGameWebActivity.this.f4441p = true;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            n4.b.b("AppGameWebActivity", "shouldOverrideUrlLoading url is " + str);
            if (!TextUtils.isEmpty(str)) {
                if (!str.toLowerCase().startsWith("http") && !str.toLowerCase().startsWith(com.alipay.sdk.cons.b.f1878a)) {
                    if (str.startsWith("weixin:")) {
                        try {
                            Intent intent = new Intent();
                            intent.setAction("android.intent.action.VIEW");
                            intent.setData(Uri.parse(str));
                            AppGameWebActivity.this.startActivity(intent);
                        } catch (Exception unused) {
                            AppGameWebActivity.this.Y4("未检测到微信客户端,请安装后重试。");
                        }
                        return true;
                    }
                    if (!str.startsWith("alipays:") && !str.startsWith("alipay")) {
                        try {
                            AppGameWebActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                        } catch (Exception e10) {
                            e10.printStackTrace();
                        }
                        return true;
                    }
                    try {
                        AppGameWebActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                    } catch (Exception unused2) {
                        AppGameWebActivity.this.Y4("未检测到支付宝客户端,请安装后重试。");
                    }
                    return true;
                }
                if (str.contains("tenpay")) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("Referer", "https://pay.ipaynow.cn");
                    webView.loadUrl(str, hashMap);
                    return true;
                }
                AppGameWebActivity.this.j6(str);
                return true;
            }
            return false;
        }
    }

    public void h6() {
        N1(this.f4438m);
    }

    public void i6() {
        try {
            View findViewById = findViewById(R.id.iv_title_share);
            if (findViewById != null) {
                findViewById.setVisibility(8);
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public void A5(String str) {
        try {
            JumpInfo n10 = JumpInfo.n(str);
            if (n10 != null) {
                n10.r(M4());
            }
            h0.b(n10);
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public void B5(String str) {
        n4.b.b("AppGameWebActivity", "_openApp" + str);
        q1.d.J(this, str);
    }

    public void C5(String str) {
        q1.d.N(str);
    }

    public void D5(String str) {
        if (!TextUtils.isEmpty(str) && str.startsWith("http://")) {
            v.L("", str);
        } else {
            v.L(str, "");
        }
    }

    public void E5(String str) {
        h0.v1(str, "", M4());
    }

    public void F5(int i10) {
        int i11 = 1;
        if (i10 == 1) {
            i11 = 6;
        } else if (i10 == 2) {
            i11 = 4;
        }
        setRequestedOrientation(i11);
    }

    public void G5(String str) {
        if (MockActivity.f5113s) {
            return;
        }
        if (!TextUtils.isEmpty(str)) {
            try {
                this.f4440o = ShareInfo.e(str);
                runOnUiThread(new a());
                return;
            } catch (Exception e10) {
                e10.printStackTrace();
                return;
            }
        }
        g6();
    }

    public void H5(String str) {
        this.f4438m = str;
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                AppGameWebActivity.this.h6();
            }
        });
    }

    @Override
    public void I1(String str) {
        n4.b.b("AppGameWebActivity", "invokeLoginCallBack");
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:invokeLoginCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    public void I5(String str) {
        if (!MockActivity.f5113s && !TextUtils.isEmpty(str)) {
            try {
                runOnUiThread(new b(str));
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
    }

    public void J5(int i10) {
        boolean z10;
        if (i10 == 0) {
            z10 = true;
        } else {
            z10 = false;
        }
        this.f4443r = z10;
        Message message = new Message();
        message.what = 4;
        message.arg1 = i10;
        this.f4444s.sendMessage(message);
    }

    public void K5(String str) {
        Y4(str);
    }

    @Override
    public int L4() {
        return R.layout.app_activity_game_web;
    }

    public int L5(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            AppInfo appInfo = new AppInfo();
            appInfo.N0(jSONObject.optString("appId"));
            appInfo.O0(jSONObject.optString("appName"));
            appInfo.Y0(jSONObject.optString("packageName"));
            appInfo.R0(jSONObject.optString("fileHash"));
            appInfo.Q0(jSONObject.optString("downloadUrl"));
            appInfo.c1(jSONObject.getLong("fileSize"));
            appInfo.e1(jSONObject.optString("versionName"));
            appInfo.d1(jSONObject.optInt("versionCode"));
            appInfo.U0(jSONObject.optString("iconUrl"));
            if (h.d()) {
                j1.b.g(appInfo);
                o1.d.n(appInfo, "H5页面", d1(), M4());
                return 1;
            }
            W3(appInfo.u());
            return 1;
        } catch (Exception e10) {
            e10.printStackTrace();
            return 0;
        }
    }

    public void M5(String str) {
        j1.b.z(str);
    }

    @Override
    public void N1(String str) {
        super.N1(str);
        B2("H5页面");
    }

    @Override
    public void Q2(String str) {
        n4.b.b("AppGameWebActivity", "deleteDownloadCallBack. hash=" + str);
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:deleteDownloadCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    @Override
    public void S4() {
        super.S4();
        if ("邀请赚钱".equals(this.f4438m)) {
            HashMap hashMap = new HashMap();
            hashMap.put("entranceID", ExifInterface.GPS_MEASUREMENT_2D);
            hashMap.put("entranceName", "邀请赚钱");
            hashMap.put("duration", String.valueOf(this.f8533b));
            n1.a.b("NEW_ACTION_DURATION_HOME_NAVIGATE_ENTRANCE", hashMap);
        }
    }

    @Override
    public void T0(p4.j jVar) {
        long j10;
        if (jVar == null) {
            return;
        }
        AppInfo appInfo = new AppInfo();
        appInfo.R0(jVar.y());
        appInfo.N0(jVar.d());
        appInfo.Y0(jVar.m());
        String y10 = jVar.y();
        int f62 = f6(appInfo);
        long v10 = jVar.v();
        long x10 = jVar.x();
        long j11 = v10 - x10;
        int e10 = jVar.C().e();
        int m10 = j1.b.m(jVar);
        if (e10 == 0) {
            j10 = -1;
        } else {
            j10 = (long) (j11 / (e10 * 1024));
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("fileId", jVar.d());
            jSONObject.put("fileHash", y10);
            jSONObject.put("state", f62);
            jSONObject.put("fileSize", v10);
            jSONObject.put("readSize", x10);
            jSONObject.put(NotificationCompat.CATEGORY_PROGRESS, String.valueOf(m10));
            jSONObject.put("speed", String.valueOf(e10));
            jSONObject.put("leftTime", String.valueOf(j10));
            String jSONObject2 = jSONObject.toString();
            n4.b.b("AppGameWebActivity", "progressChangeCallBack. jsonStr=" + jSONObject2);
            Message message = new Message();
            message.what = 3;
            message.obj = "javascript:progressChangeCallBack('" + jSONObject2 + "')";
            this.f4444s.sendMessage(message);
        } catch (JSONException e11) {
            e11.printStackTrace();
        }
    }

    @Override
    public void V2(String str) {
        n4.b.b("AppGameWebActivity", "uninstallAppCallBack");
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:uninstallAppCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    @Override
    public void W3(String str) {
        n4.b.b("AppGameWebActivity", "downloadErrorCallBack");
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:downloadErrorCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    @Override
    public void Z1(int i10, k1.d dVar, ShareInfo shareInfo) {
        if (dVar == null) {
            return;
        }
        int b10 = dVar.b();
        try {
            Message message = new Message();
            message.what = 3;
            message.obj = "javascript:clickShare('" + b10 + "','" + n.e(shareInfo) + "')";
            this.f4444s.sendMessage(message);
            StringBuilder sb = new StringBuilder();
            sb.append("onShareOptionSelected shareId = ");
            sb.append(b10);
            n4.b.b("AppGameWebActivity", sb.toString());
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    @Override
    public l4.e a5() {
        return new f0(this);
    }

    public void e6(String str) {
        n4.b.b("AppGameWebActivity", "getAppStateCallBack. jsonAppList=" + str);
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:getAppStateCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    public final int f6(AppInfo appInfo) {
        boolean z10;
        if (appInfo == null || TextUtils.isEmpty(appInfo.u())) {
            return 0;
        }
        String u10 = appInfo.u();
        String c02 = appInfo.c0();
        boolean b10 = q1.d.b(c02);
        boolean q10 = j1.b.q(u10);
        boolean o10 = g.o(u10);
        boolean r10 = j1.b.r(u10);
        if (!o10) {
            z10 = g.p(u10);
        } else {
            z10 = false;
        }
        if (o10) {
            return 3;
        }
        if (z10) {
            return 4;
        }
        if (r10) {
            return 5;
        }
        if (a5.g.f().l(c02)) {
            return 6;
        }
        if (b10) {
            return 2;
        }
        if (!q10) {
            return 0;
        }
        return 1;
    }

    public final void g6() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                AppGameWebActivity.this.i6();
            }
        });
    }

    public final void initView() {
        d5(false);
        N1("加载中");
        h5(true, R.drawable.app_ic_title_close);
        l6();
        this.f4444s = new d(this);
        j6(this.f4439n);
    }

    public final void j6(String str) {
        if (!TextUtils.isEmpty(str) && this.mWebView != null) {
            this.f4439n = str;
            if (str.toLowerCase().contains("youyo88.com") || this.f4439n.toLowerCase().contains("bbbtgo") || this.f4439n.toLowerCase().contains("api2.app.bbbtgo.com".toLowerCase()) || this.f4439n.toLowerCase().contains("api.union.youyo88.com".toLowerCase()) || this.f4439n.toLowerCase().contains("159.75.36.74:7702".toLowerCase())) {
                str = this.f4439n + v4.b.g(!this.f4439n.contains("?"), v4.b.h());
            }
            this.f4444s.sendEmptyMessage(1);
            this.mWebView.loadUrl(str);
        }
    }

    public void k6() {
        n4.b.b("AppGameWebActivity", "onResumeCallBack");
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:backReload()";
        this.f4444s.sendMessage(message);
    }

    public final void l6() {
        this.mWebView.addJavascriptInterface(new JavaWebExternal(), "BTGO");
        this.mWebView.setWebChromeClient(new c());
        this.mWebView.setWebViewClient(new e());
        this.mWebView.setHorizontalScrollBarEnabled(false);
        WebView.setWebContentsDebuggingEnabled(true);
        CookieManager.getInstance().setAcceptThirdPartyCookies(this.mWebView, true);
        WebSettings settings = this.mWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDefaultTextEncodingName("utf-8");
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setUserAgentString(settings.getUserAgentString() + "|BTGO/1/" + i.L() + InternalZipConstants.ZIP_FILE_SEPARATOR + i.i());
        settings.setAppCachePath(getCacheDir().getAbsolutePath());
        try {
            settings.setAppCacheEnabled(true);
            settings.setAppCachePath(getDir("cache", 0).getAbsolutePath());
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        try {
            settings.setDatabaseEnabled(true);
            settings.setDatabasePath(getDir("database", 0).getAbsolutePath());
        } catch (Exception e11) {
            e11.printStackTrace();
        }
        int i10 = Build.VERSION.SDK_INT;
        settings.setLoadsImagesAutomatically(true);
        settings.setDomStorageEnabled(true);
        if (h.d()) {
            settings.setCacheMode(-1);
        } else {
            settings.setCacheMode(1);
        }
        if (i10 >= 26) {
            try {
                settings.setSafeBrowsingEnabled(false);
            } catch (Exception e12) {
                e12.printStackTrace();
            }
        }
        n4.b.b("AppGameWebActivity", "mode:" + this.mWebView.getSettings().getCacheMode());
    }

    public final void m6() {
        this.mProgress.setVisibility(8);
    }

    public void n5(String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                startActivity(new Intent("android.intent.action.DIAL", Uri.parse("tel:" + str)));
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public void n6() {
        if (!this.f4443r) {
            this.mProgress.setVisibility(0);
        }
    }

    public void o5(String str) {
        v.f(str);
    }

    public final void o6() {
        this.mProgress.setVisibility(8);
        WebView webView = this.mWebView;
        if (webView != null && !webView.getSettings().getLoadsImagesAutomatically()) {
            this.mWebView.getSettings().setLoadsImagesAutomatically(true);
        }
    }

    @Override
    public void onBackPressed() {
        if (this.mWebView.canGoBack()) {
            this.mWebView.goBack();
        } else {
            finish();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            this.f4439n = extras.getString("web_url");
            if (extras.containsKey("title")) {
                this.f4438m = extras.getString("title");
            }
            n4.b.b("AppGameWebActivity", "mUrl is " + this.f4439n);
        }
        super.onCreate(bundle);
        initView();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.f4442q = true;
        WebView webView = this.mWebView;
        if (webView != null) {
            webView.removeAllViews();
            this.mWebView.stopLoading();
            this.mWebView.destroy();
            this.mWebView = null;
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        k6();
    }

    public void p5(String str) {
        p4.j l10 = g.l(str);
        if (l10 != null) {
            j1.b.a(l10, true);
        }
    }

    public void q5() {
        finish();
    }

    public void r5(String str) {
        String str2;
        JSONArray jSONArray;
        JSONArray jSONArray2;
        int i10;
        long j10;
        long j11;
        long j12;
        long j13;
        int i11;
        long j14;
        PackageInfo n02;
        p4.j l10;
        long g10;
        AppGameWebActivity appGameWebActivity = this;
        try {
            JSONArray jSONArray3 = new JSONArray(str);
            if (jSONArray3.length() > 0) {
                JSONArray jSONArray4 = new JSONArray();
                int i12 = 0;
                while (i12 < jSONArray3.length()) {
                    try {
                        JSONObject jSONObject = jSONArray3.getJSONObject(i12);
                        String optString = jSONObject.optString("appId");
                        String optString2 = jSONObject.optString("fileHash");
                        String optString3 = jSONObject.optString("packageName");
                        AppInfo appInfo = new AppInfo();
                        appInfo.N0(optString);
                        appInfo.R0(optString2);
                        appInfo.Y0(optString3);
                        int f62 = appGameWebActivity.f6(appInfo);
                        String str3 = "";
                        if (f62 != 3 && f62 != 5) {
                            str2 = "";
                        } else {
                            p4.j l11 = g.l(optString2);
                            String valueOf = String.valueOf(j1.b.m(l11));
                            if (f62 == 3) {
                                str3 = j1.b.o(l11).replace("KB/s", "");
                            }
                            str2 = str3;
                            str3 = valueOf;
                        }
                        int i13 = -1;
                        if (f62 != 0 && (l10 = g.l(optString2)) != null) {
                            if (l10.n() != null) {
                                i13 = Integer.parseInt(l10.n());
                            }
                            if (f62 != 1 && f62 != 2) {
                                g10 = 0;
                                long v10 = l10.v();
                                long x10 = l10.x();
                                jSONArray2 = jSONArray4;
                                i10 = i13;
                                j11 = g10;
                                j12 = x10;
                                jSONArray = jSONArray3;
                                j10 = v10;
                            }
                            g10 = l10.C().g();
                            long v102 = l10.v();
                            long x102 = l10.x();
                            jSONArray2 = jSONArray4;
                            i10 = i13;
                            j11 = g10;
                            j12 = x102;
                            jSONArray = jSONArray3;
                            j10 = v102;
                        } else {
                            jSONArray = jSONArray3;
                            jSONArray2 = jSONArray4;
                            i10 = -1;
                            j10 = 0;
                            j11 = 0;
                            j12 = 0;
                        }
                        if (f62 == 2 && (n02 = q1.d.n0(appGameWebActivity, optString3)) != null) {
                            j13 = j10;
                            j14 = n02.firstInstallTime;
                            i11 = n02.versionCode;
                        } else {
                            j13 = j10;
                            i11 = i10;
                            j14 = 0;
                        }
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("appId", optString);
                        jSONObject2.put("fileHash", optString2);
                        jSONObject2.put("packageName", optString3);
                        jSONObject2.put("state", f62);
                        jSONObject2.put("versionCode", i11);
                        jSONObject2.put(NotificationCompat.CATEGORY_PROGRESS, str3);
                        jSONObject2.put("speed", str2);
                        jSONObject2.put("firstInstallTime", j14);
                        jSONObject2.put("downloadTime", j11);
                        jSONObject2.put("fileSize", j13);
                        jSONObject2.put("readSize", j12);
                        JSONArray jSONArray5 = jSONArray2;
                        jSONArray5.put(jSONObject2);
                        i12++;
                        appGameWebActivity = this;
                        jSONArray4 = jSONArray5;
                        jSONArray3 = jSONArray;
                    } catch (Exception e10) {
                        e = e10;
                        e.printStackTrace();
                        return;
                    }
                }
                e6(jSONArray4.toString());
            }
        } catch (Exception e11) {
            e = e11;
        }
    }

    public String s5() {
        try {
            return new JSONObject(v4.b.h()).toString();
        } catch (Exception e10) {
            e10.printStackTrace();
            return "";
        }
    }

    public String t5() {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("platform", 1);
            jSONObject.put("mid", v.q());
            jSONObject.put("imei", i.x());
            jSONObject.put("mac", v.p());
            jSONObject.put("model", i.z());
            jSONObject.put("osvc", q1.d.t0());
            jSONObject.put("osvn", q1.d.u0());
            jSONObject.put("dm", q1.d.q0());
            jSONObject.put("vc", q1.d.w0());
            jSONObject.put("vn", q1.d.x0());
            jSONObject.put("chl", i.i());
            return jSONObject.toString();
        } catch (JSONException e10) {
            e10.printStackTrace();
            return "";
        }
    }

    @Override
    public void u3(String str) {
        n4.b.b("AppGameWebActivity", "installAppCallBack");
        Message message = new Message();
        message.what = 3;
        message.obj = "javascript:installAppCallBack('" + str + "')";
        this.f4444s.sendMessage(message);
    }

    public int u5() {
        String b10 = h.b();
        if (!TextUtils.isEmpty(b10)) {
            if (NetworkUtil.NETWORK_TYPE_WIFI.equals(b10)) {
                return 1;
            }
            if ("2G".equals(b10)) {
                return 2;
            }
            if ("3G".equals(b10)) {
                return 3;
            }
            if ("4G".equals(b10)) {
                return 4;
            }
            return 0;
        }
        return 0;
    }

    public String v5() {
        if (l5.a.J()) {
            try {
                UserInfo i10 = l5.a.i();
                if (i10 == null) {
                    return "";
                }
                return new Gson().v(i10);
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }
        return "";
    }

    public void w5() {
        if (this.mWebView.canGoBack()) {
            this.mWebView.goBack();
        }
    }

    public int x5(String str) {
        n4.b.b("AppGameWebActivity", "_installApp" + str);
        String d10 = j1.b.d(j1.b.c(g.l(str)));
        if (!t4.d.n(d10)) {
            j1.b.s(str);
            return 1;
        }
        if (q1.d.m0(this, d10) == null) {
            t4.d.e(d10);
            j1.b.s(str);
            return 2;
        }
        a5.g.f().i(d10);
        return 0;
    }

    public void y5() {
        if (!l5.a.J()) {
            h0.G1();
        }
    }

    public void z5(String str, String str2) {
        v.E(str, str2);
    }
}