WJBET v2.4.39版本的 MD5 值为:a1cc3f24c34b916fdf36d9b31dec8203

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


package prod.apptest.com.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.alipay.mobile.security.bio.utils.HanziToPinyin;
import com.alipay.mobile.security.bio.workspace.Env;
import com.alipay.zoloz.config.ConfigDataParser;
import com.ap.zoloz.hummer.api.BaseFacade;
import com.ap.zoloz.hummer.api.ZLZConstants;
import com.ap.zoloz.hummer.biz.HummerConstants;
import com.ap.zoloz.hummer.connect.api.ConnectFacade;
import com.ap.zoloz.hummer.connect.api.ConnectRequest;
import com.ap.zoloz.hummer.connect.api.ConnectResponse;
import com.ap.zoloz.hummer.connect.api.IConnectCallback;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.login.LoginBehavior;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.githang.statusbar.StatusBarCompat;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.util.CollectionUtils;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.common.net.HttpHeaders;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FacebookAuthProvider;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.GetTokenResult;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.auth.OAuthProvider;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import com.hjq.toast.ToastUtils;
import com.lzy.okgo.cookie.SerializableCookie;
import com.xiasuhuei321.loadingdialog.view.LoadingDialog;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java8.util.Maps;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONException;
import org.json.JSONObject;
import prod.app_playpixf2.com.R;
import prod.apptest.com.AppTestApp;
import prod.apptest.com.activity.BaseVasSonicWebActivity;
import prod.apptest.com.api.RetrofitClient;
import prod.apptest.com.base.WebResourceRequestAdapter;
import prod.apptest.com.base.WebResourceResponseAdapter;
import prod.apptest.com.dialog.LoadingIndicatorDialog;
import prod.apptest.com.js.JSAndroid;
import prod.apptest.com.net.HttpVolley;
import prod.apptest.com.net.Updateinfo;
import prod.apptest.com.utils.AndroidBug5497Workaround;
import prod.apptest.com.utils.CProgressDialogUtils;
import prod.apptest.com.utils.DownloadApk;
import prod.apptest.com.utils.LogUtils;
import prod.apptest.com.utils.NotchScreenCheck;
import prod.apptest.com.utils.OkGoUpdateHttpUtil;
import prod.apptest.com.utils.StringUtil;
import prod.apptest.com.webview.WebViewCacheInterceptorInst;
import pushlive.lbd.com.updateapp.UpdateAppBean;
import pushlive.lbd.com.updateapp.UpdateAppManager;
import pushlive.lbd.com.updateapp.UpdateCallback;
import pushlive.lbd.com.updateapp.listener.ExceptionHandler;
import pushlive.lbd.com.updateapp.listener.IUpdateDialogFragmentListener;
import pushlive.lbd.com.updateapp.utils.AppUpdateUtils;
public abstract class BaseVasSonicWebActivity extends AppCompatActivity {
    private static final String ERR_NET = "net::";
    private static final String FIREBASE_TWITTER = "twitter.com";
    public static final int MODE_SONIC_WITH_OFFLINE_CACHE = 2;
    private static final int PERMISSION_REQUEST_CODE_STORAGE = 1;
    private static final int REQUEST_CODE_ALBUM = 1;
    private static final int REQUEST_CODE_CAMERA = 2;
    private static final int REQUEST_CODE_PERMISSION_CAMERA = 3;
    private static final Set<String> offlineResources = new HashSet();
    public static boolean openCheck2 = false;
    private AlertDialog alertDialog;
    private Button btnTest;
    private WebChromeClient.CustomViewCallback callback;
    protected LoadingIndicatorDialog dialog;
    private ViewGroup frameLayout;
    private GoogleSignInClient googleSignInClient;
    boolean isLandscape;
    private String mCurrentPhotoPath;
    private Handler mHandler;
    private HttpVolley mHttpVolley;
    private String mLastPhothPath;
    protected LoadingDialog mLoadingDialog;
    private ProgressBar mProgressBar;
    private Thread mThread;
    private View mView;
    private Activity mactivity;
    private String oauthCallback;
    private RelativeLayout rl_loading;
    private RelativeLayout rl_progressBar;
    private TextView tvTest;
    private TextView tv_progress;
    private Updateinfo updateInfo;
    private ValueCallback<Uri> uploadMessage;
    private ValueCallback<Uri[]> uploadMessageAboveL;
    private WebSettings webSettings;
    private WebView webView;
    private boolean noNetwork = false;
    private long mStart = 0;
    private String result = "";
    private String apiURL = "";
    private boolean ischeck = false;
    private Handler handlerse = new Handler();
    private final int version = Build.VERSION.SDK_INT;
    private OkHttpClient client = new OkHttpClient();
    private final ActivityResultLauncher<Intent> googleSignInLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
        @Override
        public final void onActivityResult(Object obj) {
            BaseVasSonicWebActivity.this.m2255lambda$new$2$prodapptestcomactivityBaseVasSonicWebActivity((ActivityResult) obj);
        }
    });
    private final ActivityResultLauncher<String> requestPermissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new ActivityResultCallback() {
        @Override
        public final void onActivityResult(Object obj) {
            BaseVasSonicWebActivity.this.m2256lambda$new$4$prodapptestcomactivityBaseVasSonicWebActivity((Boolean) obj);
        }
    });

    protected abstract boolean forceOpenBrowser();

    protected abstract int getContentViewId();

    protected abstract int getFrameLayoutId();

    protected abstract Class getOpenWindowClass();

    protected abstract String getTag();

    protected abstract int getWebViewId();

    protected abstract boolean isAutoCloseSplash();

    protected abstract boolean isFullyOpenVideo();

    protected abstract boolean isIndexNoCache();

    protected abstract boolean isSupportStaticAssets();

    protected abstract boolean isSupportZoom();

    protected void onWebViewDidLoad(boolean z) {
    }

    protected abstract boolean screenNoSleep();

    protected abstract boolean shouldInterceptRequest();

    protected abstract boolean usingLoading();

    public void m2255lambda$new$2$prodapptestcomactivityBaseVasSonicWebActivity(ActivityResult activityResult) {
        Task<GoogleSignInAccount> signedInAccountFromIntent = GoogleSignIn.getSignedInAccountFromIntent(activityResult.getData());
        if (signedInAccountFromIntent.isSuccessful()) {
            try {
                GoogleSignInAccount result = signedInAccountFromIntent.getResult(ApiException.class);
                if (result != null) {
                    AuthCredential credential = GoogleAuthProvider.getCredential(result.getIdToken(), null);
                    final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
                    firebaseAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener() {
                        @Override
                        public final void onComplete(Task task) {
                            BaseVasSonicWebActivity.this.m2254lambda$new$1$prodapptestcomactivityBaseVasSonicWebActivity(firebaseAuth, task);
                        }
                    });
                }
            } catch (Exception e) {
                LogUtils.w("signInWithCredential:google:failure", e);
                this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", this.oauthCallback, e.getMessage()));
            }
        }
    }

    public void m2254lambda$new$1$prodapptestcomactivityBaseVasSonicWebActivity(FirebaseAuth firebaseAuth, Task task) {
        if (task.isSuccessful()) {
            LogUtils.d("signInWithCredential:google:success");
            final Task<GetTokenResult> idToken = firebaseAuth.getCurrentUser().getIdToken(true);
            idToken.addOnCompleteListener(this, new OnCompleteListener() {
                @Override
                public final void onComplete(Task task2) {
                    BaseVasSonicWebActivity.this.m2253lambda$new$0$prodapptestcomactivityBaseVasSonicWebActivity(idToken, task2);
                }
            });
            return;
        }
        LogUtils.w("signInWithCredential:google:failure", task.getException());
        this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", this.oauthCallback, task.getException()));
    }

    public void m2253lambda$new$0$prodapptestcomactivityBaseVasSonicWebActivity(Task task, Task task2) {
        this.webView.loadUrl(String.format("javascript:window.%s('%s')", this.oauthCallback, ((GetTokenResult) task.getResult()).getToken()));
    }

    private void fetchOfflineResources() {
        Set<String> set = offlineResources;
        if (CollectionUtils.isEmpty(set)) {
            try {
                String[] list = getAssets().list("offline");
                if (list != null) {
                    Collections.addAll(set, list);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected boolean hasNetwork() {
        return !this.noNetwork;
    }

    public void m2264x462216d8() {
        this.rl_loading.setVisibility(0);
    }

    public void showSplash() {
        this.webView.post(new Runnable() {
            @Override
            public final void run() {
                BaseVasSonicWebActivity.this.m2264x462216d8();
            }
        });
    }

    public void m2256lambda$new$4$prodapptestcomactivityBaseVasSonicWebActivity(Boolean bool) {
        if (bool.booleanValue()) {
            LogUtils.i("Get permissions for push");
        } else {
            showNotificationMsg();
        }
    }

    public void requestPushPermission() {
        if (Build.VERSION.SDK_INT >= 33) {
            new Handler(Looper.myLooper()).postDelayed(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2258xf6dd2074();
                }
            }, 3000L);
        }
    }

    public void m2258xf6dd2074() {
        if (ContextCompat.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
            return;
        }
        if (shouldShowRequestPermissionRationale("android.permission.POST_NOTIFICATIONS")) {
            showNotificationMsg();
        } else {
            this.requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
        }
    }

    private void showNotificationMsg() {
        new Handler(Looper.myLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                BaseVasSonicWebActivity.this.m2263xf5c0c956();
            }
        }, 1000L);
    }

    public void m2263xf5c0c956() {
        ToastUtils.show((CharSequence) getResources().getString(R.string.request_push_permission));
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        LogUtils.d("onCreate");
        fetchOfflineResources();
        init();
        this.mStart = System.currentTimeMillis();
        this.mactivity = this;
        this.mHttpVolley = new HttpVolley(this);
        getWindow().setFormat(-3);
        getWindow().setSoftInputMode(18);
        getWindow().addFlags(16777216);
        LogUtils.d("UserAgent= {}", RetrofitClient.getUserAgent());
        setContentView(getContentViewId());
        AndroidBug5497Workaround.assistActivity(this);
        this.dialog = new LoadingIndicatorDialog(this);
        this.webView = (WebView) findViewById(getWebViewId());
        this.frameLayout = (ViewGroup) findViewById(getFrameLayoutId());
        this.rl_loading = (RelativeLayout) findViewById(R.id.loading);
        if (usingLoading()) {
            LoadingDialog loadingDialog = new LoadingDialog(this);
            this.mLoadingDialog = loadingDialog;
            loadingDialog.setLoadingText((String) getResources().getText(R.string.mloading_dialog)).setLoadStyle(1).show();
        }
        this.mHandler = new TakePhotoHandler(this);
        bindFacebookEvent();
        bindGoogle();
        setScreenSleepOrAwake();
    }

    private void bindGoogle() {
        try {
            this.googleSignInClient = GoogleSignIn.getClient(getApplicationContext(), new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(getString(R.string.google_web_client_id)).requestProfile().requestEmail().build());
        } catch (Exception unused) {
        }
    }

    public void setScreenSleepOrAwake() {
        try {
            if (screenNoSleep()) {
                getWindow().addFlags(128);
            } else {
                getWindow().clearFlags(128);
            }
        } catch (Exception e) {
            LogUtils.w("setScreenSleepOrAwake", e);
        }
    }

    public static String decodeBase64(String str) {
        try {
            return new String(Base64.decode(str, 0), StandardCharsets.UTF_8);
        } catch (Exception e) {
            LogUtils.w("decodeBase64 failed", e);
            return "";
        }
    }

    public void handleDeeplink(String str) {
        try {
            LogUtils.d("galaxy handleDeeplink: {}", str);
            JsonObject jsonObject = (JsonObject) new Gson().fromJson(str, (Class<Object>) JsonObject.class);
            String decodeBase64 = decodeBase64(jsonObject.get("cfg").getAsString());
            if (StringUtil.isBlank(decodeBase64)) {
                ToastUtils.show((CharSequence) "Invalid cfg params");
            } else {
                startZoloz(decodeBase64, jsonObject.get(SerializableCookie.DOMAIN).getAsString(), jsonObject.get("orderId").getAsString(), jsonObject.get("faceCode").getAsString());
            }
        } catch (JsonSyntaxException e) {
            LogUtils.d("galaxy handleDeeplink failed: {} ", str, e);
        }
    }

    public void startZoloz(final String str, final String str2, final String str3, final String str4) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                BaseVasSonicWebActivity.this.m2266xed676a99(str, str2, str3, str4);
            }
        });
    }

    public void m2266xed676a99(String str, final String str2, final String str3, final String str4) {
        try {
            LogUtils.d("galaxy startZoloz: {}", str);
            ConnectFacade connectFacade = ConnectFacade.getInstance();
            ConnectRequest connectRequest = new ConnectRequest();
            connectFacade.setContext(this);
            HashMap hashMap = new HashMap();
            hashMap.put("public_key", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA21r96JWO/S3J3SzpiyGI3EuCijfxs+acsfzzihKZHssXfhemX7iC3uQ9EsPTBifH/oG9uhNDlQz/JfuCRYLZWm2LWs6SgQEqZcdm7Ga0CUQr2N7Ik7SLN3gqSMn2/Ow9z3mnNYBj4+eNNMKFS13/3/L+a/nOTy7BCCRtP5ATnhI0LKUEKcQgpp8CEMh4ueAOYacP2UCawXc31Lx1kCJQ3/dXospKLjbnvKTqJdDB4ULKQIKSs5NdDOtDYKNE8gzL4P8CkFerOevWlLXNTqSbmnqxs7FemcaAVgv+tQGVXFlsrl60Ei/rAqbtYITpHYWuaj8LGmaw6Od/Y0JYGe8sbwIDAQAB");
            hashMap.put(ZLZConstants.CONTEXT, this);
            hashMap.put(ZLZConstants.LOCALE, "zh_tw_#hant");
            hashMap.put(HummerConstants.AUTH_TYPE, "CONNECT");
            connectRequest.bizConfig = hashMap;
            connectRequest.connectConfig = str;
            connectRequest.connectId = BaseFacade.getFlowId(str);
            connectFacade.startConnect(connectRequest, new IConnectCallback() {
                @Override
                public final void onCompletion(ConnectResponse connectResponse) {
                    BaseVasSonicWebActivity.this.m2265xa9dc4cd8(str2, str3, str4, connectResponse);
                }
            });
        } catch (Exception e) {
            LogUtils.d("galaxy startZoloz failed:", e);
        }
    }

    public void m2265xa9dc4cd8(String str, String str2, String str3, ConnectResponse connectResponse) {
        String connectResponse2 = connectResponse.toString();
        LogUtils.d("galaxy startConnect onCompletion: {}", connectResponse2);
        if (connectResponse2.contains("code = 1000")) {
            handlePaymentCheck(str, str2, str3);
        }
    }

    private void handlePaymentCheck(String str, String str2, String str3) {
        if (!StringUtil.isBlank(str)) {
            String format = String.format("%sapi/payment_direct/passface?order=%s", str, str2);
            if (!StringUtil.isBlank(str3)) {
                format = format + "&face_code=" + str3;
            }
            LogUtils.d("Galaxy Payment Check URL: {}", format);
            this.client.newCall(new Request.Builder().url(format).get().build()).enqueue(new AnonymousClass1());
            return;
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                ToastUtils.show((CharSequence) "Payment Check Invalid Params");
            }
        });
    }

    public class AnonymousClass1 implements Callback {
        AnonymousClass1() {
        }

        @Override
        public void onFailure(Call call, IOException iOException) {
            LogUtils.d("galaxy PaymentCheck Call onFailure", iOException);
            BaseVasSonicWebActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    ToastUtils.show((CharSequence) "Request Failed");
                }
            });
        }

        @Override
        public void onResponse(Call call, Response response) throws IOException {
            LogUtils.d("galaxy Response onSuccess", response.body());
            if (response.isSuccessful() && response.body() != null) {
                if (((JsonObject) new Gson().fromJson(response.body().string(), (Class<Object>) JsonObject.class)).get("status").getAsInt() != 1) {
                    return;
                }
                BaseVasSonicWebActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        ToastUtils.show((CharSequence) "Deposit Successful");
                    }
                });
                return;
            }
            BaseVasSonicWebActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    ToastUtils.show((CharSequence) "Deposit Failed");
                }
            });
        }
    }

    private void bindFacebookEvent() {
        CallbackManager create = CallbackManager.Factory.create();
        LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
        if (loginButton != null) {
            loginButton.setPermissions("email", "public_profile");
            loginButton.setLoginBehavior(LoginBehavior.WEB_ONLY);
            loginButton.registerCallback(create, new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    LogUtils.d("facebook:onSuccess: {}", loginResult.getAccessToken());
                    BaseVasSonicWebActivity.this.handleFacebookAccessToken(loginResult.getAccessToken());
                }

                @Override
                public void onCancel() {
                    LogUtils.d("facebook:onCancel");
                }

                @Override
                public void onError(FacebookException facebookException) {
                    LogUtils.d("facebook:onError", facebookException);
                }
            });
        }
    }

    public void handleFacebookAccessToken(AccessToken accessToken) {
        LogUtils.d("handleFacebookAccessToken: {}", accessToken);
        AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
        final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
        firebaseAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener() {
            @Override
            public final void onComplete(Task task) {
                BaseVasSonicWebActivity.this.m2248x26451de2(firebaseAuth, task);
            }
        });
    }

    public void m2248x26451de2(FirebaseAuth firebaseAuth, Task task) {
        if (task.isSuccessful()) {
            LogUtils.d("signInWithCredential:facebook:success");
            final Task<GetTokenResult> idToken = firebaseAuth.getCurrentUser().getIdToken(true);
            idToken.addOnCompleteListener(this, new OnCompleteListener() {
                @Override
                public final void onComplete(Task task2) {
                    BaseVasSonicWebActivity.this.m2247xe2ba0021(idToken, task2);
                }
            });
            return;
        }
        LogUtils.w("signInWithCredential:facebook:failure", task.getException());
        this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", this.oauthCallback, task.getException()));
    }

    public void m2247xe2ba0021(Task task, Task task2) {
        this.webView.loadUrl(String.format("javascript:window.%s('%s')", this.oauthCallback, ((GetTokenResult) task.getResult()).getToken()));
    }

    private void init() {
        if ((getIntent().getFlags() & 4194304) != 0) {
            finish();
        }
    }

    public void initSonicSession(String str) {
        this.noNetwork = false;
        this.apiURL = str;
        LogUtils.d("Ready load apiURL={}", str);
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        checkOrientation(configuration);
    }

    private void checkOrientation(Configuration configuration) {
        if (configuration.orientation == 2) {
            this.isLandscape = true;
        } else {
            this.isLandscape = false;
        }
    }

    public void resize() {
        int i;
        int identifier = getApplicationContext().getResources().getIdentifier("status_bar_height", "dimen", "android");
        int dimensionPixelSize = identifier > 0 ? getApplicationContext().getResources().getDimensionPixelSize(identifier) : 0;
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int i2 = displayMetrics.widthPixels;
        if (this.isLandscape) {
            i = displayMetrics.heightPixels;
        } else if (NotchScreenCheck.hasSafeAreaOffset(this)) {
            i = displayMetrics.heightPixels - 10;
        } else {
            i = displayMetrics.heightPixels - dimensionPixelSize;
        }
        ViewGroup.LayoutParams layoutParams = this.webView.getLayoutParams();
        layoutParams.width = i2;
        layoutParams.height = i;
        this.webView.setLayoutParams(layoutParams);
    }

    public void googleLoginHandler(String str) {
        this.oauthCallback = str;
        this.googleSignInLauncher.launch(this.googleSignInClient.getSignInIntent());
    }

    static class TakePhotoHandler extends Handler {
        private BaseVasSonicWebActivity activity;

        TakePhotoHandler(BaseVasSonicWebActivity baseVasSonicWebActivity) {
            this.activity = baseVasSonicWebActivity;
        }

        @Override
        public void handleMessage(Message message) {
            super.handleMessage(message);
            this.activity.takePhoto();
        }
    }

    @Override
    public void onDestroy() {
        WebView webView = this.webView;
        if (webView != null) {
            ViewParent parent = webView.getParent();
            if (parent != null) {
                ((ViewGroup) parent).removeView(this.webView);
            }
            this.webView.getSettings().setJavaScriptEnabled(false);
            this.webView.clearHistory();
            this.webView.clearView();
            this.webView.removeAllViews();
            this.webView.destroy();
            getWindow().clearFlags(128);
        }
        this.mThread = null;
        this.mHandler = null;
        super.onDestroy();
    }

    public void uploadPicture() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getResources().getString(R.string.uploadPicture));
        builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public final void onCancel(DialogInterface dialogInterface) {
                BaseVasSonicWebActivity.this.m2267x8b54e22d(dialogInterface);
            }
        });
        builder.setPositiveButton(getResources().getString(R.string.camera), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                BaseVasSonicWebActivity.this.m2269x126b1daf(dialogInterface, i);
            }
        });
        builder.setNegativeButton(getResources().getString(R.string.album), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                BaseVasSonicWebActivity.this.m2270x55f63b70(dialogInterface, i);
            }
        });
        builder.create().show();
    }

    public void m2267x8b54e22d(DialogInterface dialogInterface) {
        ValueCallback<Uri> valueCallback = this.uploadMessage;
        if (valueCallback != null) {
            valueCallback.onReceiveValue(null);
            this.uploadMessage = null;
        }
        ValueCallback<Uri[]> valueCallback2 = this.uploadMessageAboveL;
        if (valueCallback2 != null) {
            valueCallback2.onReceiveValue(null);
            this.uploadMessageAboveL = null;
        }
    }

    public void m2269x126b1daf(DialogInterface dialogInterface, int i) {
        if (!TextUtils.isEmpty(this.mLastPhothPath)) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2268xcedfffee();
                }
            });
            this.mThread = thread;
            thread.start();
        } else if (ActivityCompat.checkSelfPermission(this, "android.permission.CAMERA") == 0) {
            takePhoto();
        } else {
            ActivityCompat.requestPermissions(this, new String[]{"android.permission.CAMERA"}, 3);
        }
    }

    public void m2268xcedfffee() {
        new File(this.mLastPhothPath).delete();
        this.mHandler.sendEmptyMessage(1);
    }

    public void m2270x55f63b70(DialogInterface dialogInterface, int i) {
        chooseAlbumPic();
    }

    private void chooseAlbumPic() {
        Intent intent = new Intent("android.intent.action.GET_CONTENT");
        intent.addCategory("android.intent.category.OPENABLE");
        intent.setType("image/*");
        startActivityForResult(Intent.createChooser(intent, "Image Chooser"), 1);
    }

    public void takePhoto() {
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        File externalFilesDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
        File file = new File(externalFilesDir, UUID.randomUUID() + "_upload.png");
        if (Build.VERSION.SDK_INT >= 24) {
            intent.setFlags(1);
            intent.putExtra("output", FileProvider.getUriForFile(this, "prod.app_playpixf2.com.fileProvider", file));
        } else {
            intent.putExtra("output", Uri.fromFile(file));
        }
        this.mCurrentPhotoPath = file.getAbsolutePath();
        startActivityForResult(intent, 2);
    }

    @Override
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (!(iArr == null && iArr.length == 0) && i == 3) {
            if (iArr[0] == 0) {
                takePhoto();
            } else {
                new AlertDialog.Builder(this).setTitle(getResources().getString(R.string.PERMISSION1)).setMessage(getResources().getString(R.string.PERMISSION2)).setNegativeButton(getResources().getString(R.string.PERMISSION3), (DialogInterface.OnClickListener) null).setPositiveButton(getResources().getString(R.string.PERMISSION4), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i2) {
                        Intent intent = new Intent();
                        intent.addFlags(268435456);
                        intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
                        intent.setData(Uri.fromParts("package", BaseVasSonicWebActivity.this.getPackageName(), null));
                        BaseVasSonicWebActivity.this.startActivity(intent);
                    }
                }).create().show();
            }
        }
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        Uri data;
        super.onActivityResult(i, i2, intent);
        if (i == 1 || i == 2) {
            ValueCallback<Uri> valueCallback = this.uploadMessage;
            if (valueCallback == null && this.uploadMessageAboveL == null) {
                return;
            }
            if (i2 != -1) {
                if (valueCallback != null) {
                    valueCallback.onReceiveValue(null);
                    this.uploadMessage = null;
                }
                ValueCallback<Uri[]> valueCallback2 = this.uploadMessageAboveL;
                if (valueCallback2 != null) {
                    valueCallback2.onReceiveValue(null);
                    this.uploadMessageAboveL = null;
                }
            }
            if (i2 == -1) {
                if (i != 1) {
                    if (i == 2 && !TextUtils.isEmpty(this.mCurrentPhotoPath)) {
                        File file = new File(this.mCurrentPhotoPath);
                        sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
                        data = Uri.fromFile(file);
                        this.mLastPhothPath = this.mCurrentPhotoPath;
                    }
                    data = null;
                } else {
                    if (intent != null) {
                        data = intent.getData();
                    }
                    data = null;
                }
                ValueCallback<Uri> valueCallback3 = this.uploadMessage;
                if (valueCallback3 != null) {
                    valueCallback3.onReceiveValue(data);
                    this.uploadMessage = null;
                }
                ValueCallback<Uri[]> valueCallback4 = this.uploadMessageAboveL;
                if (valueCallback4 != null) {
                    valueCallback4.onReceiveValue(new Uri[]{data});
                    this.uploadMessageAboveL = null;
                }
            }
        }
    }

    public void facebookLogin(String str) {
        this.oauthCallback = str;
        if (AccessToken.getCurrentAccessToken() != null) {
            AccessToken.setCurrentAccessToken(null);
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                BaseVasSonicWebActivity.this.m2245x5180446b();
            }
        });
    }

    public void m2245x5180446b() {
        findViewById(R.id.login_button).performClick();
    }

    public void oauthLogin(String str, String str2) {
        this.oauthCallback = str2;
        bindOauthEvent(OAuthProvider.newBuilder(str));
    }

    private void bindOauthEvent(OAuthProvider.Builder builder) {
        FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
        Task<AuthResult> pendingAuthResult = firebaseAuth.getPendingAuthResult();
        if (pendingAuthResult != null) {
            handleSignInResult(pendingAuthResult);
        } else {
            startSignInFlow(firebaseAuth, builder);
        }
    }

    private void handleSignInResult(Task<AuthResult> task) {
        task.addOnSuccessListener(new OnSuccessListener<AuthResult>() {
            @Override
            public void onSuccess(AuthResult authResult) {
                LogUtils.d("handleSignInResult:onSuccess: {}");
                final Task<GetTokenResult> idToken = authResult.getUser().getIdToken(true);
                idToken.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
                    @Override
                    public void onComplete(Task<GetTokenResult> task2) {
                        BaseVasSonicWebActivity.this.webView.loadUrl(String.format("javascript:window.%s('%s')", BaseVasSonicWebActivity.this.oauthCallback, ((GetTokenResult) idToken.getResult()).getToken()));
                    }
                });
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(Exception exc) {
                LogUtils.d("handleSignInResult:onFailure: {}", exc);
                BaseVasSonicWebActivity.this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", BaseVasSonicWebActivity.this.oauthCallback, exc));
            }
        });
    }

    private void startSignInFlow(FirebaseAuth firebaseAuth, OAuthProvider.Builder builder) {
        firebaseAuth.startActivityForSignInWithProvider(this, builder.build()).addOnSuccessListener(new OnSuccessListener<AuthResult>() {
            @Override
            public void onSuccess(AuthResult authResult) {
                LogUtils.d("startSignInFlow:onSuccess: {}");
                final Task<GetTokenResult> idToken = authResult.getUser().getIdToken(true);
                idToken.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
                    @Override
                    public void onComplete(Task<GetTokenResult> task) {
                        String token = ((GetTokenResult) idToken.getResult()).getToken();
                        LogUtils.d("onComplete:{}:", token);
                        BaseVasSonicWebActivity.this.webView.loadUrl(String.format("javascript:window.%s('%s')", BaseVasSonicWebActivity.this.oauthCallback, token));
                    }
                });
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(Exception exc) {
                LogUtils.d("startSignInFlow:onFailure: {}", exc);
                BaseVasSonicWebActivity.this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", BaseVasSonicWebActivity.this.oauthCallback, exc));
            }
        });
    }

    public void initView() {
        getIntent();
        this.webView.addJavascriptInterface(new JavaScriptInterface(this.mactivity), "JSInterface");
        this.webView.addJavascriptInterface(new JSAndroid(this.mactivity), "Android");
        this.webView.addJavascriptInterface(new JavaScriptInterface_LaunchOpen(this.mactivity), "LaunchOpen");
        this.webView.addJavascriptInterface(new JavaScriptInterface_LaunchClose(this.mactivity), "LaunchClose");
        this.webView.addJavascriptInterface(new JavaScriptInterface_Color(this.mactivity), "Color");
        this.webView.addJavascriptInterface(new JavaScriptInterface_LogOpen(this.mactivity), "LogOpen");
        this.webView.addJavascriptInterface(new JavaScriptInterface_LogClose(this.mactivity), "LogClose");
        this.webView.addJavascriptInterface(new JavaScriptInterface_LogTest(this.mactivity), "LogTest");
        this.webView.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                BaseVasSonicWebActivity.this.m2249xa9b7cfc0(str, str2, str3, str4, j);
            }
        });
        if (!getString(R.string.google_web_client_id).startsWith("${")) {
            this.webView.addJavascriptInterface(new JSAndroid(this.mactivity) {
                @JavascriptInterface
                public void googleLogin(String str) {
                    Log.d("window.Android", "call: window.Android.googleLogin('" + str + "')");
                    try {
                        BaseVasSonicWebActivity.this.googleLoginHandler(str);
                    } catch (Exception e) {
                        Log.e("window.Android", "window.Android.googleLogin failure", e);
                    }
                }
            }, "Android");
        }
        this.webView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public final boolean onLongClick(View view) {
                return BaseVasSonicWebActivity.this.m2252xfec299d8(view);
            }
        });
        if ((getApplicationInfo().flags & 2) != 0) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
        final boolean shouldInterceptRequest = shouldInterceptRequest();
        this.webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
                String uri = webResourceRequest.getUrl().toString();
                if (uri.startsWith("http")) {
                    webView.loadUrl(uri);
                } else {
                    try {
                        Intent intent = new Intent("android.intent.action.VIEW", webResourceRequest.getUrl());
                        intent.addFlags(268435456);
                        BaseVasSonicWebActivity.this.startActivity(intent);
                    } catch (Exception e) {
                        LogUtils.w("webview shouldOverrideUrlLoading failure", e);
                    }
                    webView.stopLoading();
                }
                return super.shouldOverrideUrlLoading(webView, webResourceRequest);
            }

            @Override
            public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                super.onPageStarted(webView, str, bitmap);
                BaseVasSonicWebActivity.this.mStart = System.currentTimeMillis();
            }

            @Override
            public void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                LogUtils.i("onPageFinished url={} ({}ms)", str, Long.valueOf(System.currentTimeMillis() - BaseVasSonicWebActivity.this.mStart));
                CookieManager cookieManager = CookieManager.getInstance();
                cookieManager.setAcceptThirdPartyCookies(BaseVasSonicWebActivity.this.webView, true);
                LogUtils.d("onPageFinished Cookies= {}", cookieManager.getCookie(str));
                BaseVasSonicWebActivity.this.setRequestedOrientation(-1);
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
                return shouldInterceptRequest(webView, webResourceRequest.getUrl().toString());
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
                String str2;
                if (shouldInterceptRequest && !StringUtil.isBlank(str)) {
                    boolean z = false;
                    boolean z2 = StringUtil.isNotBlank(BaseVasSonicWebActivity.this.apiURL) && RetrofitClient.getCleanURL(BaseVasSonicWebActivity.this.apiURL).equals(RetrofitClient.getCleanURL(str));
                    if ((!StringUtil.isNotBlank(BaseVasSonicWebActivity.this.apiURL) || z2) && !BaseVasSonicWebActivity.this.apiURL.matches(".*(192|127|10).*")) {
                        int lastIndexOf = str.lastIndexOf(ConfigDataParser.FILE_SUBFIX_UI_CONFIG);
                        if (BaseVasSonicWebActivity.this.isSupportStaticAssets() && lastIndexOf != -1) {
                            String substring = str.substring(lastIndexOf + 1);
                            if (BaseVasSonicWebActivity.offlineResources.contains(substring)) {
                                if (substring.endsWith(".js")) {
                                    str2 = "application/x-javascript";
                                } else {
                                    str2 = substring.endsWith(".css") ? "text/css" : "text/html";
                                }
                                String str3 = str2;
                                try {
                                    InputStream open = BaseVasSonicWebActivity.this.getAssets().open("offline/" + substring);
                                    LogUtils.i("Use offline resource for: " + str);
                                    if (Build.VERSION.SDK_INT >= 21) {
                                        return new WebResourceResponse(str3, StandardCharsets.UTF_8.name(), 200, "OK", Maps.of(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*"), open);
                                    }
                                    return new WebResourceResponse(str3, StandardCharsets.UTF_8.name(), open);
                                } catch (IOException e) {
                                    LogUtils.e("Use offline resource", e);
                                }
                            }
                        }
                        WebResourceResponseAdapter adapter = WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(str));
                        if (z2 && !AppTestApp.IS_SINGLE_LINE && str.contains("/m/index.html")) {
                            if (adapter == null) {
                                BaseVasSonicWebActivity.this.noNetwork = true;
                                AppTestApp.instance.addBlackLine(str);
                                return null;
                            }
                            if (adapter.getStatusCode() / 100 == 2 || adapter.getStatusCode() == 304) {
                                z = true;
                            }
                            if (!z) {
                                BaseVasSonicWebActivity.this.noNetwork = true;
                                AppTestApp.instance.addBlackLine(str);
                                return null;
                            }
                            String string = getString(adapter.getCloneData());
                            if (!StringUtil.containsIgnoreCase(string, "\"root\"") && !StringUtil.containsIgnoreCase(string, "ucbet") && !StringUtil.containsIgnoreCase(string, "\"brand=\"")) {
                                BaseVasSonicWebActivity.this.noNetwork = true;
                                AppTestApp.instance.addBlackLine(str);
                                return null;
                            }
                        }
                        return adapter;
                    }
                    return null;
                }
                return null;
            }

            private String getString(InputStream inputStream) {
                if (inputStream == null) {
                    return null;
                }
                StringBuilder sb = new StringBuilder();
                try {
                    try {
                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name())));
                        while (true) {
                            try {
                                int read = bufferedReader.read();
                                if (read == -1) {
                                    break;
                                }
                                sb.append((char) read);
                            } catch (Throwable th) {
                                try {
                                    bufferedReader.close();
                                } catch (Throwable th2) {
                                    th.addSuppressed(th2);
                                }
                                throw th;
                            }
                        }
                        bufferedReader.close();
                        try {
                            inputStream.close();
                        } catch (Exception unused) {
                        }
                        return sb.toString();
                    } catch (Exception unused2) {
                        return null;
                    }
                } catch (IOException unused3) {
                    inputStream.close();
                    return null;
                } catch (Throwable th3) {
                    try {
                        inputStream.close();
                    } catch (Exception unused4) {
                    }
                    throw th3;
                }
            }

            @Override
            public void onReceivedError(WebView webView, int i, String str, String str2) {
                super.onReceivedError(webView, i, str, str2);
                LogUtils.e("onReceivedError: " + str2 + HanziToPinyin.Token.SEPARATOR + i + HanziToPinyin.Token.SEPARATOR + str);
                if (StringUtil.isNotBlank(str) && str.startsWith(BaseVasSonicWebActivity.ERR_NET)) {
                    BaseVasSonicWebActivity.this.noNetwork = true;
                }
            }

            @Override
            public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
                super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
                String uri = webResourceRequest.getUrl().toString();
                LogUtils.e("onReceivedHttpError: " + uri + HanziToPinyin.Token.SEPARATOR + webResourceResponse.getStatusCode());
                int statusCode = webResourceResponse.getStatusCode();
                if (Objects.equals(uri, BaseVasSonicWebActivity.this.apiURL)) {
                    if (404 == statusCode || 500 == statusCode) {
                        BaseVasSonicWebActivity.this.noNetwork = true;
                    }
                }
            }

            @Override
            public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
                sslErrorHandler.proceed();
            }
        });
        this.webView.setWebChromeClient(new ChromeClients());
        this.webView.removeJavascriptInterface("searchBoxJavaBridge_");
        this.webView.getSettings().setUserAgentString(RetrofitClient.getUserAgent());
        WebSettings settings = this.webView.getSettings();
        this.webSettings = settings;
        settings.setJavaScriptEnabled(true);
        if (isSupportZoom()) {
            this.webSettings.setSupportZoom(true);
            this.webSettings.setBuiltInZoomControls(true);
        }
        this.webSettings.setDisplayZoomControls(false);
        this.webSettings.setTextZoom(100);
        this.webSettings.setBlockNetworkImage(true);
        this.webSettings.setAllowContentAccess(true);
        this.webSettings.setAllowFileAccess(true);
        this.webSettings.setDatabaseEnabled(true);
        this.webSettings.setDomStorageEnabled(true);
        this.webSettings.setSavePassword(false);
        this.webSettings.setSaveFormData(false);
        this.webSettings.setUseWideViewPort(true);
        this.webSettings.setLoadWithOverviewMode(true);
        this.webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        this.webSettings.setSupportMultipleWindows(true);
        this.webSettings.setMediaPlaybackRequiresUserGesture(false);
        this.webSettings.setCacheMode(-1);
        this.webSettings.setMinimumFontSize(1);
        this.webSettings.setMinimumLogicalFontSize(1);
        if (Build.VERSION.SDK_INT >= 21) {
            this.webSettings.setMixedContentMode(0);
        } else {
            try {
                WebSettings.class.getMethod("setMixedContentMode", Integer.TYPE).invoke(this.webSettings, 2);
                Log.i("WebSettings", "Successfully set MIXED_CONTENT_COMPATIBILITY_MODE");
            } catch (Exception e) {
                Log.e("WebSettings", "Error calling setMixedContentMode: " + e.getMessage(), e);
            }
        }
        this.webView.loadUrl(this.apiURL);
        WebViewCacheInterceptorInst.getInstance().loadUrl(this.apiURL, this.webView.getSettings().getUserAgentString());
    }

    public void m2249xa9b7cfc0(String str, String str2, String str3, String str4, long j) {
        ProgressDialog progressDialog = new ProgressDialog(this);
        progressDialog.setProgressStyle(1);
        progressDialog.setProgressNumberFormat("%1d MB / %2d MB");
        progressDialog.setCancelable(false);
        progressDialog.show();
        new Thread(new DownloadApk(progressDialog, this, str)).start();
    }

    public boolean m2252xfec299d8(View view) {
        WebView.HitTestResult hitTestResult = this.webView.getHitTestResult();
        int type = hitTestResult.getType();
        if (type == 5 || type == 8) {
            final String extra = hitTestResult.getExtra();
            String[] strArr = {getString(R.string.save_image), getString(R.string.cancel)};
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setItems(strArr, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    BaseVasSonicWebActivity.this.m2251x30ce0b42(extra, dialogInterface, i);
                }
            });
            builder.show();
        } else if (type != 9) {
            return true;
        }
        return false;
    }

    public void m2251x30ce0b42(final String str, DialogInterface dialogInterface, int i) {
        if (i == 0) {
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2250xed42ed81(str);
                }
            }).start();
        }
    }

    public void m2250xed42ed81(String str) {
        if (URLUtil.isValidUrl(str)) {
            url2bitmap(str);
        } else {
            savePictureBase64(str);
        }
    }

    public void url2bitmap(String str) {
        try {
            URLConnection openConnection = new URL(str).openConnection();
            int contentLength = ((HttpURLConnection) openConnection).getContentLength();
            openConnection.connect();
            InputStream inputStream = openConnection.getInputStream();
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, contentLength);
            Bitmap decodeStream = BitmapFactory.decodeStream(bufferedInputStream);
            if (decodeStream != null) {
                save2Album(decodeStream);
            }
            bufferedInputStream.close();
            if (inputStream != null) {
                inputStream.close();
            }
        } catch (Exception e) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2271xd129f3c();
                }
            });
            LogUtils.e("save Bitmap image failed", e);
        }
    }

    public void m2271xd129f3c() {
        ToastUtils.show(getResources().getText(R.string.save_failed));
    }

    private void save2Album(Bitmap bitmap) {
        final File file = new File(Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM + File.separator + "Camera" + File.separator, System.currentTimeMillis() + ".jpg");
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2259x97df6875(file);
                }
            });
            fileOutputStream.close();
        } catch (Exception e) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2260xdb6a8636();
                }
            });
            LogUtils.e("save Bitmap image failed", e);
        }
    }

    public void m2259x97df6875(File file) {
        sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
        ToastUtils.show(getResources().getText(R.string.save_success));
    }

    public void m2260xdb6a8636() {
        ToastUtils.show(getResources().getText(R.string.save_failed));
    }

    private boolean savePictureBase64(String str) {
        String substring = str.substring(str.indexOf(",") + 1);
        File file = new File(Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM + File.separator + "Camera" + File.separator, System.currentTimeMillis() + ".png");
        String file2 = file.toString();
        byte[] decode = Base64.decode(substring, 0);
        int length = decode.length;
        for (int i = 0; i < length; i++) {
            byte b = decode[i];
            if (b <= 0) {
                decode[i] = (byte) (b + 256);
            }
        }
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(file2);
            fileOutputStream.write(decode);
            fileOutputStream.flush();
            final Intent intent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
            intent.setData(Uri.fromFile(file));
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2261xe62f3dbb(intent);
                }
            });
            fileOutputStream.close();
            return true;
        } catch (Exception e) {
            LogUtils.e("save base64 image failed", e);
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    BaseVasSonicWebActivity.this.m2262x29ba5b7c();
                }
            });
            return false;
        }
    }

    public void m2261xe62f3dbb(Intent intent) {
        sendBroadcast(intent);
        ToastUtils.show(getResources().getText(R.string.save_success));
    }

    public void m2262x29ba5b7c() {
        ToastUtils.show(getResources().getText(R.string.save_failed));
    }

    @Override
    public void onResume() {
        super.onResume();
        WebView webView = this.webView;
        if (webView != null) {
            webView.onResume();
            this.webView.resumeTimers();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        WebView webView = this.webView;
        if (webView != null) {
            webView.onPause();
            this.webView.pauseTimers();
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        String url = StringUtil.isBlank(this.webView.getUrl()) ? "" : this.webView.getUrl();
        LogUtils.d("onKeyDown url={}", url);
        if (i == 4 && this.webView.canGoBack()) {
            LogUtils.d("onKeyDown goBack url={}", url);
            this.webView.goBack();
            return true;
        } else if (isFinishing()) {
            return super.onKeyDown(i, keyEvent);
        } else {
            if (i == 25 || i == 24 || i == 164) {
                return super.onKeyDown(i, keyEvent);
            }
            AlertDialog create = new AlertDialog.Builder(this).setTitle(getResources().getString(R.string.alertDialog1)).setMessage(getResources().getString(R.string.alertDialog2)).setNeutralButton(getResources().getString(R.string.alertDialog3), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    dialogInterface.dismiss();
                }
            }).setPositiveButton(getResources().getString(R.string.alertDialog4), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    BaseVasSonicWebActivity.this.m2257xdf1f93ec(dialogInterface, i2);
                }
            }).create();
            this.alertDialog = create;
            create.setCancelable(false);
            this.alertDialog.show();
            return super.onKeyDown(i, keyEvent);
        }
    }

    public void m2257xdf1f93ec(DialogInterface dialogInterface, int i) {
        finish();
        dialogInterface.dismiss();
    }

    public class ChromeClients extends WebChromeClient {
        ChromeClients() {
        }

        @Override
        public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            super.onShowCustomView(view, customViewCallback);
            if (BaseVasSonicWebActivity.this.webView.getUrl().matches(".*/m/lotto.*?-h5/.*") || !BaseVasSonicWebActivity.this.isFullyOpenVideo()) {
                customViewCallback.onCustomViewHidden();
                return;
            }
            BaseVasSonicWebActivity.this.setRequestedOrientation(0);
            BaseVasSonicWebActivity.this.getWindow().setFlags(1024, 1024);
            if (BaseVasSonicWebActivity.this.mView != null) {
                BaseVasSonicWebActivity.this.callback.onCustomViewHidden();
                return;
            }
            BaseVasSonicWebActivity.this.mView = view;
            DisplayMetrics displayMetrics = new DisplayMetrics();
            BaseVasSonicWebActivity.this.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
            BaseVasSonicWebActivity.this.frameLayout.addView(BaseVasSonicWebActivity.this.mView, new ViewGroup.LayoutParams(displayMetrics.widthPixels, displayMetrics.heightPixels));
            BaseVasSonicWebActivity.this.callback = customViewCallback;
            BaseVasSonicWebActivity.this.webView.setVisibility(8);
            BaseVasSonicWebActivity.this.frameLayout.setVisibility(0);
        }

        @Override
        public void onHideCustomView() {
            BaseVasSonicWebActivity.this.webView.setVisibility(0);
            if (BaseVasSonicWebActivity.this.mView == null) {
                return;
            }
            BaseVasSonicWebActivity.this.frameLayout.setVisibility(8);
            BaseVasSonicWebActivity.this.frameLayout.removeView(BaseVasSonicWebActivity.this.mView);
            BaseVasSonicWebActivity.this.callback.onCustomViewHidden();
            BaseVasSonicWebActivity.this.mView = null;
            super.onHideCustomView();
            BaseVasSonicWebActivity.this.setRequestedOrientation(1);
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            new AlertDialog.Builder(BaseVasSonicWebActivity.this).setMessage(str2).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.dismiss();
                }
            }).show();
            jsResult.cancel();
            return true;
        }

        @Override
        public boolean onCreateWindow(WebView webView, boolean z, boolean z2, Message message) {
            WebView webView2 = new WebView(BaseVasSonicWebActivity.this);
            webView2.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView webView3, WebResourceRequest webResourceRequest) {
                    BaseVasSonicWebActivity.this.openSystemBrowser(webResourceRequest.getUrl());
                    return true;
                }

                @Override
                public WebResourceResponse shouldInterceptRequest(WebView webView3, String str) {
                    return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(str));
                }

                @Override
                public WebResourceResponse shouldInterceptRequest(WebView webView3, WebResourceRequest webResourceRequest) {
                    return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(WebResourceRequestAdapter.adapter(webResourceRequest)));
                }

                @Override
                public void onReceivedSslError(WebView webView3, SslErrorHandler sslErrorHandler, SslError sslError) {
                    sslErrorHandler.proceed();
                }
            });
            ((WebView.WebViewTransport) message.obj).setWebView(webView2);
            message.sendToTarget();
            return true;
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            LogUtils.e("webview onProgressChanged: " + i);
            if (i >= 100) {
                BaseVasSonicWebActivity.this.webSettings.setBlockNetworkImage(false);
                if (!BaseVasSonicWebActivity.this.webSettings.getLoadsImagesAutomatically()) {
                    BaseVasSonicWebActivity.this.webSettings.setLoadsImagesAutomatically(true);
                }
                int i2 = BaseVasSonicWebActivity.this.isAutoCloseSplash() ? 500 : 10000;
                BaseVasSonicWebActivity baseVasSonicWebActivity = BaseVasSonicWebActivity.this;
                baseVasSonicWebActivity.onWebViewDidLoad(true ^ baseVasSonicWebActivity.noNetwork);
                if (BaseVasSonicWebActivity.this.noNetwork) {
                    return;
                }
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.ChromeClients.this.m2272x4826464a();
                    }
                }, i2);
            }
        }

        public void m2272x4826464a() {
            if (BaseVasSonicWebActivity.this.rl_loading.getVisibility() != 8) {
                BaseVasSonicWebActivity.this.rl_loading.setVisibility(8);
                BaseVasSonicWebActivity.this.dialog.cancel();
            }
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str) {
            Log.i(Env.NAME_TEST, "openFileChooser 1");
            BaseVasSonicWebActivity baseVasSonicWebActivity = BaseVasSonicWebActivity.this;
            baseVasSonicWebActivity.uploadMessage = baseVasSonicWebActivity.uploadMessage;
            BaseVasSonicWebActivity.this.uploadPicture();
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback) {
            Log.i(Env.NAME_TEST, "openFileChooser 2");
            BaseVasSonicWebActivity baseVasSonicWebActivity = BaseVasSonicWebActivity.this;
            baseVasSonicWebActivity.uploadMessage = baseVasSonicWebActivity.uploadMessage;
            BaseVasSonicWebActivity.this.uploadPicture();
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
            Log.i(Env.NAME_TEST, "openFileChooser 3");
            BaseVasSonicWebActivity baseVasSonicWebActivity = BaseVasSonicWebActivity.this;
            baseVasSonicWebActivity.uploadMessage = baseVasSonicWebActivity.uploadMessage;
            BaseVasSonicWebActivity.this.uploadPicture();
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            Log.i(Env.NAME_TEST, "openFileChooser 4:" + valueCallback.toString());
            BaseVasSonicWebActivity.this.uploadMessageAboveL = valueCallback;
            BaseVasSonicWebActivity.this.uploadPicture();
            return true;
        }
    }

    public void openSystemBrowser(Uri uri) {
        try {
            Intent parseUri = Intent.parseUri(uri.toString(), 1);
            parseUri.addCategory("android.intent.category.BROWSABLE");
            parseUri.setComponent(null);
            startActivity(parseUri);
        } catch (Exception e) {
            LogUtils.e("openSystemBrowser failure", e);
        }
    }

    public class JavaScriptInterface {
        private Activity activity;

        public JavaScriptInterface(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void clearCache() {
            LogUtils.d("clearCache x5");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2273xb281acee();
                    }
                });
            } catch (Exception e) {
                LogUtils.d("error= " + e);
            }
            LogUtils.d("clearCache2");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2274x95ad602f();
                    }
                });
            } catch (Exception e2) {
                LogUtils.d("error= " + e2);
            }
            LogUtils.d("clearCache3");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2275x78d91370();
                    }
                });
            } catch (Exception e3) {
                LogUtils.d("error= " + e3);
            }
            LogUtils.d("clearCache4");
            try {
                BaseVasSonicWebActivity.this.getCacheDir().delete();
            } catch (Exception e4) {
                LogUtils.d("error= " + e4);
            }
            LogUtils.d("clearCache5");
            ToastUtils.show((CharSequence) BaseVasSonicWebActivity.this.getResources().getString(R.string.cleanCache));
            LogUtils.d("clearCache6");
            try {
                CookieSyncManager.createInstance(BaseVasSonicWebActivity.this.mactivity);
                CookieManager.getInstance().removeAllCookie();
            } catch (Exception e5) {
                LogUtils.d("error= " + e5);
            }
            LogUtils.d("clearCache8");
        }

        public void m2273xb281acee() {
            BaseVasSonicWebActivity.this.webView.clearCache(true);
        }

        public void m2274x95ad602f() {
            BaseVasSonicWebActivity.this.webView.clearHistory();
        }

        public void m2275x78d91370() {
            BaseVasSonicWebActivity.this.webView.clearFormData();
        }

        @JavascriptInterface
        public void clearCache(final String str) {
            LogUtils.d("clearCache x5");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2276x5c04c6b1();
                    }
                });
            } catch (Exception e) {
                LogUtils.d("error= " + e);
            }
            LogUtils.d("clearCache2");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2277x3f3079f2();
                    }
                });
            } catch (Exception e2) {
                LogUtils.d("error= " + e2);
            }
            LogUtils.d("clearCache3");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface.this.m2278x225c2d33();
                    }
                });
            } catch (Exception e3) {
                LogUtils.d("error= " + e3);
            }
            LogUtils.d("clearCache4");
            try {
                BaseVasSonicWebActivity.this.getCacheDir().delete();
            } catch (Exception e4) {
                LogUtils.d("error= " + e4);
            }
            LogUtils.d("clearCache5");
            ToastUtils.show((CharSequence) BaseVasSonicWebActivity.this.getResources().getString(R.string.cleanCache));
            LogUtils.d("clearCache6");
            try {
                CookieSyncManager.createInstance(BaseVasSonicWebActivity.this.mactivity);
                CookieManager.getInstance().removeAllCookie();
            } catch (Exception e5) {
                LogUtils.d("error= " + e5);
            }
            LogUtils.d("clearCache8");
            try {
                if (BaseVasSonicWebActivity.this.version < 18) {
                    BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                        @Override
                        public final void run() {
                            BaseVasSonicWebActivity.JavaScriptInterface.this.m2279x587e074(str);
                        }
                    });
                } else {
                    BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                        @Override
                        public final void run() {
                            BaseVasSonicWebActivity.JavaScriptInterface.this.m2280xcbdf46f6(str);
                        }
                    });
                }
                Log.e("X5_Activitys ", "callJS= " + str);
            } catch (Exception e6) {
                Log.e("X5_Activitys ", "callJS error= " + e6);
            }
        }

        public void m2276x5c04c6b1() {
            BaseVasSonicWebActivity.this.webView.clearCache(true);
        }

        public void m2277x3f3079f2() {
            BaseVasSonicWebActivity.this.webView.clearHistory();
        }

        public void m2278x225c2d33() {
            BaseVasSonicWebActivity.this.webView.clearFormData();
        }

        public void m2279x587e074(String str) {
            WebView webView = BaseVasSonicWebActivity.this.webView;
            webView.loadUrl("javascript:" + str);
        }

        public void m2280xcbdf46f6(String str) {
            WebView webView = BaseVasSonicWebActivity.this.webView;
            webView.evaluateJavascript("javascript:" + str, new ValueCallback() {
                @Override
                public final void onReceiveValue(Object obj) {
                    Log.e("X5_Activitys ", "callJS onReceiveValue= " + ((String) obj));
                }
            });
        }
    }

    public void generateFcmToken(final String str) {
        FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener() {
            @Override
            public final void onComplete(Task task) {
                BaseVasSonicWebActivity.this.m2246x672fb737(str, task);
            }
        });
    }

    public void m2246x672fb737(String str, Task task) {
        if (!task.isSuccessful()) {
            LogUtils.d("fetching FCM registration token failed", task.getException());
            this.webView.loadUrl(String.format("javascript:window.%s('Failure: %s')", str, task.getException()));
            return;
        }
        String str2 = (String) task.getResult();
        LogUtils.d("generate fcm token={}", str2);
        this.webView.loadUrl(String.format("javascript:window.%s('%s')", str, str2));
    }

    public class JavaScriptInterface_LaunchOpen {
        private Activity activity;

        public JavaScriptInterface_LaunchOpen(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void Open() {
            LogUtils.d("Open");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LaunchOpen.this.m2284xed681799();
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2284xed681799() {
            BaseVasSonicWebActivity.this.rl_loading.setVisibility(0);
            BaseVasSonicWebActivity.this.dialog.show();
        }
    }

    public class JavaScriptInterface_LaunchClose {
        private Activity activity;

        public JavaScriptInterface_LaunchClose(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void Close() {
            LogUtils.d("window.LaunchClose.Close()");
            try {
                BaseVasSonicWebActivity.this.webView.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LaunchClose.this.m2282x35f7921d();
                    }
                }, 500L);
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2282x35f7921d() {
            BaseVasSonicWebActivity.this.rl_loading.setVisibility(8);
            BaseVasSonicWebActivity.this.dialog.cancel();
        }

        @JavascriptInterface
        public void Close(int i) {
            LogUtils.d("Close " + i);
            try {
                Thread.sleep(i);
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LaunchClose.this.m2283xdd736bde();
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2283xdd736bde() {
            BaseVasSonicWebActivity.this.rl_loading.setVisibility(8);
            BaseVasSonicWebActivity.this.dialog.cancel();
        }
    }

    public class JavaScriptInterface_Color {
        private Activity activity;

        public JavaScriptInterface_Color(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void setColors(final String str) {
            LogUtils.d("setColors= " + str);
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_Color.this.m2281xf67ac915(str);
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2281xf67ac915(String str) {
            StatusBarCompat.setStatusBarColor(BaseVasSonicWebActivity.this, Color.parseColor(str));
        }
    }

    public class JavaScriptInterface_LogOpen {
        private Activity activity;

        public JavaScriptInterface_LogOpen(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void Open() {
            Log.e("Web", "LogOpen");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LogOpen.this.m2286x7127d232();
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2286x7127d232() {
            BaseVasSonicWebActivity.this.btnTest.setVisibility(0);
            BaseVasSonicWebActivity.this.tvTest.setVisibility(0);
        }
    }

    public class JavaScriptInterface_LogClose {
        private Activity activity;

        public JavaScriptInterface_LogClose(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void Close() {
            LogUtils.d("LogOpen");
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LogClose.this.m2285x5917fbfc();
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2285x5917fbfc() {
            BaseVasSonicWebActivity.this.btnTest.setVisibility(8);
            BaseVasSonicWebActivity.this.tvTest.setVisibility(8);
        }
    }

    public class JavaScriptInterface_LogTest {
        private Activity activity;

        public JavaScriptInterface_LogTest(Activity activity) {
            this.activity = activity;
        }

        @JavascriptInterface
        public void setText(final String str) {
            LogUtils.d("setText= " + str);
            try {
                BaseVasSonicWebActivity.this.webView.post(new Runnable() {
                    @Override
                    public final void run() {
                        BaseVasSonicWebActivity.JavaScriptInterface_LogTest.this.m2287xe553ea25(str);
                    }
                });
            } catch (Exception e) {
                LogUtils.e("error= " + e);
            }
        }

        public void m2287xe553ea25(String str) {
            TextView textView = BaseVasSonicWebActivity.this.tvTest;
            textView.setText(BaseVasSonicWebActivity.this.tvTest.getText().toString() + "\n" + str);
        }
    }

    public static boolean compareVersions(String str, String str2) {
        if (str != null && str2 != null && !TextUtils.equals(str, "") && !TextUtils.equals(str2, "")) {
            String[] split = str.split("\\.");
            String[] split2 = str2.split("\\.");
            if (split.length == split2.length) {
                for (int i = 0; i < split.length; i++) {
                    if (Integer.parseInt(split[i]) > Integer.parseInt(split2[i])) {
                        return true;
                    }
                    if (Integer.parseInt(split[i]) < Integer.parseInt(split2[i])) {
                        return false;
                    }
                    Integer.parseInt(split[i]);
                    Integer.parseInt(split2[i]);
                }
            } else if (split.length > split2.length) {
                int i2 = 0;
                while (i2 < split2.length) {
                    if (Integer.parseInt(split[i2]) > Integer.parseInt(split2[i2])) {
                        return true;
                    }
                    if (Integer.parseInt(split[i2]) < Integer.parseInt(split2[i2])) {
                        return false;
                    }
                    if (Integer.parseInt(split[i2]) == Integer.parseInt(split2[i2]) && split2.length != 1 && i2 == split2.length - 1) {
                        while (i2 < split.length && Integer.parseInt(split[i2]) == 0) {
                            if (i2 == split.length - 1) {
                                return false;
                            }
                            i2++;
                        }
                        return true;
                    }
                    i2++;
                }
            } else {
                for (int i3 = 0; i3 < split.length; i3++) {
                    if (Integer.parseInt(split[i3]) > Integer.parseInt(split2[i3])) {
                        return true;
                    }
                    if (Integer.parseInt(split[i3]) < Integer.parseInt(split2[i3])) {
                        return false;
                    }
                    if (Integer.parseInt(split[i3]) == Integer.parseInt(split2[i3]) && split.length != 1 && i3 == split.length - 1) {
                        return false;
                    }
                }
            }
        }
        return false;
    }

    public void constraintUpdate() {
        HashMap hashMap = new HashMap();
        hashMap.put("appKey", "ab55ce55Ac4bcP408cPb8c1Aaeac179c5f6f");
        hashMap.put("appVersion", AppUpdateUtils.getVersionName(this));
        hashMap.put("key1", "value2");
        hashMap.put("key2", "value3");
        new UpdateAppManager.Builder().setActivity(this).setHttpManager(new OkGoUpdateHttpUtil()).setUpdateUrl(this.updateInfo.getUrl()).handleException(new ExceptionHandler() {
            @Override
            public final void onException(Exception exc) {
                exc.printStackTrace();
            }
        }).setPost(false).setParams(hashMap).setTopPic(R.mipmap.top_8).setThemeColor(-21411).setUpdateDialogFragmentListener(new IUpdateDialogFragmentListener() {
            @Override
            public void onUpdateNotifyDialogCancel(UpdateAppBean updateAppBean) {
            }
        }).build().checkNewApp(new UpdateCallback() {
            @Override
            public UpdateAppBean parseJson(String str) {
                UpdateAppBean updateAppBean = new UpdateAppBean();
                try {
                    new JSONObject(str);
                    updateAppBean.setUpdate("Yes").setNewVersion(BaseVasSonicWebActivity.this.updateInfo.getVersion()).setApkFileUrl(BaseVasSonicWebActivity.this.updateInfo.getUrl()).setUpdateLog(BaseVasSonicWebActivity.this.updateInfo.getDescription()).setTargetSize("7M").setConstraint(true).setNewMd5("b97bea014531123f94c3ba7b7afbaad2");
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                return updateAppBean;
            }

            @Override
            public void hasNewApp(UpdateAppBean updateAppBean, UpdateAppManager updateAppManager) {
                updateAppManager.showDialogFragment();
            }

            @Override
            public void onBefore() {
                CProgressDialogUtils.showProgressDialog(BaseVasSonicWebActivity.this);
            }

            @Override
            public void onAfter() {
                CProgressDialogUtils.cancelProgressDialog(BaseVasSonicWebActivity.this);
            }

            @Override
            public void noNewApp(String str) {
                ToastUtils.show((CharSequence) "没有新版本");
            }
        });
    }
}