米游社.apk(点击下载) / c.java


package com.tencent.mm.opensdk.diffdev.a;

import android.os.AsyncTask;
import com.tencent.mm.opensdk.diffdev.OAuthErrCode;
import com.tencent.mm.opensdk.diffdev.OAuthListener;
import com.tencent.mm.opensdk.utils.Log;
import io.rong.imlib.filetransfer.download.BaseDownloadRequest;
import org.json.JSONObject;

/* access modifiers changed from: package-private */
public class c extends AsyncTask<Void, Void, a> {

    /* renamed from: a  reason: collision with root package name */
    private String f41600a;

    /* renamed from: b  reason: collision with root package name */
    private String f41601b;

    /* renamed from: c  reason: collision with root package name */
    private OAuthListener f41602c;

    /* renamed from: d  reason: collision with root package name */
    private int f41603d;

    public static class a {

        /* renamed from: a  reason: collision with root package name */
        public OAuthErrCode f41604a;

        /* renamed from: b  reason: collision with root package name */
        public String f41605b;

        /* renamed from: c  reason: collision with root package name */
        public int f41606c;
    }

    public c(String str, OAuthListener oAuthListener) {
        this.f41600a = str;
        this.f41602c = oAuthListener;
        this.f41601b = String.format("https://long.open.weixin.qq.com/connect/l/qrconnect?f=json&uuid=%s", str);
    }

    /* Return type fixed from 'java.lang.Object' to match base method */
    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x012f  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x0168 A[SYNTHETIC] */
    @Override // android.os.AsyncTask
    public a doInBackground(Void[] voidArr) {
        a aVar;
        OAuthErrCode oAuthErrCode;
        String str;
        OAuthErrCode oAuthErrCode2;
        OAuthErrCode oAuthErrCode3;
        String str2;
        OAuthErrCode oAuthErrCode4;
        Thread.currentThread().setName("OpenSdkNoopingTask");
        String str3 = this.f41600a;
        if (str3 == null || str3.length() == 0) {
            Log.e("MicroMsg.SDK.NoopingTask", "run fail, uuid is null");
            aVar = new a();
        } else {
            Log.i("MicroMsg.SDK.NoopingTask", "doInBackground start " + isCancelled());
            while (!isCancelled()) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(this.f41601b);
                if (this.f41603d == 0) {
                    str = "";
                } else {
                    str = "&last=" + this.f41603d;
                }
                sb2.append(str);
                String sb3 = sb2.toString();
                long currentTimeMillis = System.currentTimeMillis();
                byte[] a10 = com.tencent.mm.opensdk.channel.a.a.a(sb3, (int) BaseDownloadRequest.TIMEOUT);
                long currentTimeMillis2 = System.currentTimeMillis();
                aVar = new a();
                Log.d("MicroMsg.SDK.NoopingResult", "star parse NoopingResult");
                if (a10 == null || a10.length == 0) {
                    Log.e("MicroMsg.SDK.NoopingResult", "parse fail, buf is null");
                    oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NetworkErr;
                } else {
                    try {
                    } catch (Exception e10) {
                        str2 = String.format("parse fail, build String fail, ex = %s", e10.getMessage());
                        Log.e("MicroMsg.SDK.NoopingResult", str2);
                        oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr;
                        aVar.f41604a = oAuthErrCode3;
                        Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                        oAuthErrCode2 = aVar.f41604a;
                        if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                        }
                        return aVar;
                    }
                    try {
                        JSONObject jSONObject = new JSONObject(new String(a10, "utf-8"));
                        int i10 = jSONObject.getInt("wx_errcode");
                        aVar.f41606c = i10;
                        Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(i10)));
                        int i11 = aVar.f41606c;
                        if (i11 != 408) {
                            if (i11 != 500) {
                                switch (i11) {
                                    case 402:
                                        oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Timeout;
                                        aVar.f41604a = oAuthErrCode4;
                                        break;
                                    case 403:
                                        oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_Cancel;
                                        aVar.f41604a = oAuthErrCode4;
                                        break;
                                    case 405:
                                        aVar.f41604a = OAuthErrCode.WechatAuth_Err_OK;
                                        aVar.f41605b = jSONObject.getString("wx_code");
                                        break;
                                }
                                Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                                oAuthErrCode2 = aVar.f41604a;
                                if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                                    int i12 = aVar.f41606c;
                                    this.f41603d = i12;
                                    if (i12 == d.UUID_SCANED.a()) {
                                        this.f41602c.onQrcodeScanned();
                                    } else if (aVar.f41606c != d.UUID_KEEP_CONNECT.a() && aVar.f41606c == d.UUID_CONFIRM.a()) {
                                        String str4 = aVar.f41605b;
                                        if (str4 == null || str4.length() == 0) {
                                            Log.e("MicroMsg.SDK.NoopingTask", "nooping fail, confirm with an empty code!!!");
                                        }
                                    }
                                } else {
                                    Log.e("MicroMsg.SDK.NoopingTask", String.format("nooping fail, errCode = %s, uuidStatusCode = %d", oAuthErrCode2.toString(), Integer.valueOf(aVar.f41606c)));
                                }
                                return aVar;
                            }
                            oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_NormalErr;
                            aVar.f41604a = oAuthErrCode4;
                            Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                            oAuthErrCode2 = aVar.f41604a;
                            if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                            }
                            return aVar;
                        }
                        oAuthErrCode4 = OAuthErrCode.WechatAuth_Err_OK;
                        aVar.f41604a = oAuthErrCode4;
                    } catch (Exception e11) {
                        str2 = String.format("parse json fail, ex = %s", e11.getMessage());
                        Log.e("MicroMsg.SDK.NoopingResult", str2);
                        oAuthErrCode3 = OAuthErrCode.WechatAuth_Err_NormalErr;
                        aVar.f41604a = oAuthErrCode3;
                        Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                        oAuthErrCode2 = aVar.f41604a;
                        if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                        }
                        return aVar;
                    }
                    Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                    oAuthErrCode2 = aVar.f41604a;
                    if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                    }
                    return aVar;
                }
                aVar.f41604a = oAuthErrCode3;
                Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb3, aVar.f41604a.toString(), Integer.valueOf(aVar.f41606c), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                oAuthErrCode2 = aVar.f41604a;
                if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
                }
                return aVar;
            }
            Log.i("MicroMsg.SDK.NoopingTask", "IDiffDevOAuth.stopAuth / detach invoked");
            aVar = new a();
            oAuthErrCode = OAuthErrCode.WechatAuth_Err_Auth_Stopped;
            aVar.f41604a = oAuthErrCode;
            return aVar;
        }
        oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
        aVar.f41604a = oAuthErrCode;
        return aVar;
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    @Override // android.os.AsyncTask
    public void onPostExecute(a aVar) {
        a aVar2 = aVar;
        this.f41602c.onAuthFinish(aVar2.f41604a, aVar2.f41605b);
    }
}