NetCapture v2.1.82021972349版本的 MD5 值为:dfbd8054127041af5d65fa43eaf2e1d0

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


package com.minhui.networkcapture.versioncheck;

import android.app.Activity;
import android.content.DialogInterface;
import android.os.Handler;
import android.util.Log;
import androidx.appcompat.app.AlertDialog;
import com.google.gson.Gson;
import com.minhui.networkcapture.R;
import com.minhui.networkcapture.utils.ContextUtil;
import com.minhui.vpn.parser.ShowData;
import com.minhui.vpn.utils.ThreadProxy;
import com.minhui.vpn.utils.Utils;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class VersionCheckUtil {
    public static final String CHECK_URL = "http://zhuminh.com:8080/SSLCapture/pro/info";
    public static final String CHECK_URL_QA = "http://zhuminh.com:8080/SSLCapture/pro/info_qa";
    public static final String PR_DOWNLOAD = "http://sj.qq.com/myapp/detail.htm?apkName=";
    public static final String QA = "qa";
    public static final String QA_DOWNLOAD = "https://www.pgyer.com/xHw3";
    private static final int RESPONSE_OK = 200;
    public static final String TAG = "VersionCheckUtil";

    public static void checkTime(final Activity activity) {
        if (ContextUtil.isGooglePlayChannel(activity.getApplicationContext())) {
            return;
        }
        final Handler handler = new Handler();
        ThreadProxy.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                InputStream inputStream;
                HttpURLConnection httpURLConnection;
                HttpURLConnection httpURLConnection2 = null;
                r1 = null;
                InputStream inputStream2 = null;
                httpURLConnection2 = null;
                try {
                    httpURLConnection = (HttpURLConnection) new URL(VersionCheckUtil.CHECK_URL).openConnection();
                } catch (Exception e) {
                    e = e;
                    inputStream = null;
                } catch (Throwable th) {
                    th = th;
                    inputStream = null;
                }
                try {
                    httpURLConnection.connect();
                    if (httpURLConnection.getResponseCode() != 200) {
                        if (httpURLConnection != null) {
                            try {
                                httpURLConnection.disconnect();
                            } catch (Exception unused) {
                            }
                        }
                        Utils.close(null);
                        return;
                    }
                    inputStream2 = httpURLConnection.getInputStream();
                    StringBuilder sb = new StringBuilder();
                    byte[] bArr = new byte[1024];
                    while (true) {
                        int read = inputStream2.read(bArr);
                        if (read == -1) {
                            break;
                        } else {
                            sb.append(new String(bArr, 0, read, ShowData.DEFAULT_CHARSET));
                        }
                    }
                    final VersionInfo versionInfo = (VersionInfo) new Gson().fromJson(sb.toString(), VersionInfo.class);
                    Log.i(VersionCheckUtil.TAG, versionInfo.toString());
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            VersionCheckUtil.handleCheckResult(activity, versionInfo);
                        }
                    });
                    if (httpURLConnection != null) {
                        try {
                            httpURLConnection.disconnect();
                        } catch (Exception unused2) {
                        }
                    }
                    Utils.close(inputStream2);
                } catch (Exception e2) {
                    e = e2;
                    InputStream inputStream3 = inputStream2;
                    httpURLConnection2 = httpURLConnection;
                    inputStream = inputStream3;
                    try {
                        e.printStackTrace();
                        if (httpURLConnection2 != null) {
                            try {
                                httpURLConnection2.disconnect();
                            } catch (Exception unused3) {
                            }
                        }
                        Utils.close(inputStream);
                    } catch (Throwable th2) {
                        th = th2;
                        if (httpURLConnection2 != null) {
                            try {
                                httpURLConnection2.disconnect();
                            } catch (Exception unused4) {
                            }
                        }
                        Utils.close(inputStream);
                        throw th;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    InputStream inputStream4 = inputStream2;
                    httpURLConnection2 = httpURLConnection;
                    inputStream = inputStream4;
                    if (httpURLConnection2 != null) {
                    }
                    Utils.close(inputStream);
                    throw th;
                }
            }
        });
    }

    public static void handleCheckResult(final Activity activity, VersionInfo versionInfo) {
        if (versionInfo == null || versionInfo.versionCode <= 61 || activity == null || activity.isDestroyed() || activity.isFinishing() || ContextUtil.isGooglePlayChannel(activity.getApplicationContext())) {
            return;
        }
        new AlertDialog.Builder(activity).setMessage(String.format(activity.getString(R.string.new_app_has_available), versionInfo.versionName)).setPositiveButton(activity.getString(R.string.upgrade), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                ContextUtil.launchBrowser(activity, VersionCheckUtil.PR_DOWNLOAD + activity.getPackageName());
                dialogInterface.dismiss();
            }
        }).setNegativeButton(activity.getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        }).show().setCanceledOnTouchOutside(false);
    }
}