9055彩票.apk(点击下载) / f.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 org.json.JSONObject;

/* access modifiers changed from: package-private */
public final class f extends AsyncTask<Void, Void, a> {
    private OAuthListener m;
    private String p;
    private String url;
    private int v;

    static class a {
        public OAuthErrCode o;
        public String w;
        public int x;

        a() {
        }

        public static a b(byte[] bArr) {
            OAuthErrCode oAuthErrCode;
            Object[] objArr;
            String str;
            OAuthErrCode oAuthErrCode2;
            a aVar = new a();
            if (bArr == null || bArr.length == 0) {
                Log.e("MicroMsg.SDK.NoopingResult", "parse fail, buf is null");
                oAuthErrCode = OAuthErrCode.WechatAuth_Err_NetworkErr;
            } else {
                try {
                    try {
                        JSONObject jSONObject = new JSONObject(new String(bArr, "utf-8"));
                        aVar.x = jSONObject.getInt("wx_errcode");
                        Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(aVar.x)));
                        int i = aVar.x;
                        if (i == 408) {
                            oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_OK;
                        } else if (i != 500) {
                            switch (i) {
                                case 402:
                                    oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_Timeout;
                                    break;
                                case 403:
                                    oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_Cancel;
                                    break;
                                case 404:
                                    oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_OK;
                                    break;
                                case 405:
                                    aVar.o = OAuthErrCode.WechatAuth_Err_OK;
                                    aVar.w = jSONObject.getString("wx_code");
                                    break;
                                default:
                                    oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_NormalErr;
                                    break;
                            }
                            return aVar;
                        } else {
                            oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_NormalErr;
                        }
                        aVar.o = oAuthErrCode2;
                        return aVar;
                    } catch (Exception e) {
                        objArr = new Object[]{e.getMessage()};
                        str = "parse json fail, ex = %s";
                        Log.e("MicroMsg.SDK.NoopingResult", String.format(str, objArr));
                        oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
                        aVar.o = oAuthErrCode;
                        return aVar;
                    }
                } catch (Exception e2) {
                    objArr = new Object[]{e2.getMessage()};
                    str = "parse fail, build String fail, ex = %s";
                    Log.e("MicroMsg.SDK.NoopingResult", String.format(str, objArr));
                    oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
                    aVar.o = oAuthErrCode;
                    return aVar;
                }
            }
            aVar.o = oAuthErrCode;
            return aVar;
        }
    }

    public f(String str, OAuthListener oAuthListener) {
        this.p = str;
        this.m = oAuthListener;
        this.url = 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[]] */
    /* access modifiers changed from: protected */
    @Override // android.os.AsyncTask
    public final /* synthetic */ a doInBackground(Void[] voidArr) {
        a aVar;
        OAuthErrCode oAuthErrCode;
        String str;
        String str2 = this.p;
        if (str2 == null || str2.length() == 0) {
            Log.e("MicroMsg.SDK.NoopingTask", "run fail, uuid is null");
            aVar = new a();
            oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
        } else {
            while (!isCancelled()) {
                StringBuilder sb = new StringBuilder();
                sb.append(this.url);
                if (this.v == 0) {
                    str = "";
                } else {
                    str = "&last=" + this.v;
                }
                sb.append(str);
                String sb2 = sb.toString();
                long currentTimeMillis = System.currentTimeMillis();
                byte[] a2 = e.a(sb2, 60000);
                long currentTimeMillis2 = System.currentTimeMillis();
                a b2 = a.b(a2);
                Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb2, b2.o.toString(), Integer.valueOf(b2.x), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
                if (b2.o == OAuthErrCode.WechatAuth_Err_OK) {
                    this.v = b2.x;
                    if (b2.x == g.UUID_SCANED.getCode()) {
                        this.m.onQrcodeScanned();
                    } else if (b2.x != g.UUID_KEEP_CONNECT.getCode() && b2.x == g.UUID_CONFIRM.getCode()) {
                        if (b2.w == null || b2.w.length() == 0) {
                            Log.e("MicroMsg.SDK.NoopingTask", "nooping fail, confirm with an empty code!!!");
                            b2.o = OAuthErrCode.WechatAuth_Err_NormalErr;
                        }
                        return b2;
                    }
                } else {
                    Log.e("MicroMsg.SDK.NoopingTask", String.format("nooping fail, errCode = %s, uuidStatusCode = %d", b2.o.toString(), Integer.valueOf(b2.x)));
                    return b2;
                }
            }
            Log.i("MicroMsg.SDK.NoopingTask", "IDiffDevOAuth.stopAuth / detach invoked");
            aVar = new a();
            oAuthErrCode = OAuthErrCode.WechatAuth_Err_Auth_Stopped;
        }
        aVar.o = oAuthErrCode;
        return aVar;
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    /* access modifiers changed from: protected */
    @Override // android.os.AsyncTask
    public final /* synthetic */ void onPostExecute(a aVar) {
        a aVar2 = aVar;
        this.m.onAuthFinish(aVar2.o, aVar2.w);
    }
}