Initial commit
This commit is contained in:
88
sources/com/tencent/mm/opensdk/diffdev/a/a.java
Normal file
88
sources/com/tencent/mm/opensdk/diffdev/a/a.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import com.tencent.mm.opensdk.diffdev.IDiffDevOAuth;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthListener;
|
||||
import com.tencent.mm.opensdk.utils.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class a implements IDiffDevOAuth {
|
||||
private d Z;
|
||||
private Handler handler = null;
|
||||
private List<OAuthListener> Y = new ArrayList();
|
||||
private OAuthListener aa = new b(this);
|
||||
|
||||
static /* synthetic */ d c(a aVar) {
|
||||
aVar.Z = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final void addListener(OAuthListener oAuthListener) {
|
||||
if (this.Y.contains(oAuthListener)) {
|
||||
return;
|
||||
}
|
||||
this.Y.add(oAuthListener);
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final boolean auth(String str, String str2, String str3, String str4, String str5, OAuthListener oAuthListener) {
|
||||
Log.i("MicroMsg.SDK.DiffDevOAuth", "start auth, appId = " + str);
|
||||
if (str == null || str.length() <= 0 || str2 == null || str2.length() <= 0) {
|
||||
Log.d("MicroMsg.SDK.DiffDevOAuth", String.format("auth fail, invalid argument, appId = %s, scope = %s", str, str2));
|
||||
return false;
|
||||
}
|
||||
if (this.handler == null) {
|
||||
this.handler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
addListener(oAuthListener);
|
||||
if (this.Z != null) {
|
||||
Log.d("MicroMsg.SDK.DiffDevOAuth", "auth, already running, no need to start auth again");
|
||||
return true;
|
||||
}
|
||||
this.Z = new d(str, str2, str3, str4, str5, this.aa);
|
||||
d dVar = this.Z;
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
dVar.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
|
||||
} else {
|
||||
dVar.execute(new Void[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final void detach() {
|
||||
Log.i("MicroMsg.SDK.DiffDevOAuth", "detach");
|
||||
this.Y.clear();
|
||||
stopAuth();
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final void removeAllListeners() {
|
||||
this.Y.clear();
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final void removeListener(OAuthListener oAuthListener) {
|
||||
this.Y.remove(oAuthListener);
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.IDiffDevOAuth
|
||||
public final boolean stopAuth() {
|
||||
boolean z;
|
||||
Log.i("MicroMsg.SDK.DiffDevOAuth", "stopAuth");
|
||||
try {
|
||||
z = this.Z == null ? true : this.Z.q();
|
||||
} catch (Exception e) {
|
||||
Log.w("MicroMsg.SDK.DiffDevOAuth", "stopAuth fail, ex = " + e.getMessage());
|
||||
z = false;
|
||||
}
|
||||
this.Z = null;
|
||||
return z;
|
||||
}
|
||||
}
|
57
sources/com/tencent/mm/opensdk/diffdev/a/b.java
Normal file
57
sources/com/tencent/mm/opensdk/diffdev/a/b.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import android.os.Handler;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthErrCode;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthListener;
|
||||
import com.tencent.mm.opensdk.utils.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class b implements OAuthListener {
|
||||
final /* synthetic */ a ab;
|
||||
|
||||
b(a aVar) {
|
||||
this.ab = aVar;
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.OAuthListener
|
||||
public final void onAuthFinish(OAuthErrCode oAuthErrCode, String str) {
|
||||
List list;
|
||||
Log.d("MicroMsg.SDK.ListenerWrapper", String.format("onAuthFinish, errCode = %s, authCode = %s", oAuthErrCode.toString(), str));
|
||||
a.c(this.ab);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
list = this.ab.Y;
|
||||
arrayList.addAll(list);
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
((OAuthListener) it.next()).onAuthFinish(oAuthErrCode, str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.OAuthListener
|
||||
public final void onAuthGotQrcode(String str, byte[] bArr) {
|
||||
List list;
|
||||
Log.d("MicroMsg.SDK.ListenerWrapper", "onAuthGotQrcode, qrcodeImgPath = " + str);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
list = this.ab.Y;
|
||||
arrayList.addAll(list);
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
((OAuthListener) it.next()).onAuthGotQrcode(str, bArr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.tencent.mm.opensdk.diffdev.OAuthListener
|
||||
public final void onQrcodeScanned() {
|
||||
Handler handler;
|
||||
Handler handler2;
|
||||
Log.d("MicroMsg.SDK.ListenerWrapper", "onQrcodeScanned");
|
||||
handler = this.ab.handler;
|
||||
if (handler != null) {
|
||||
handler2 = this.ab.handler;
|
||||
handler2.post(new c(this));
|
||||
}
|
||||
}
|
||||
}
|
27
sources/com/tencent/mm/opensdk/diffdev/a/c.java
Normal file
27
sources/com/tencent/mm/opensdk/diffdev/a/c.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class c implements Runnable {
|
||||
final /* synthetic */ b ac;
|
||||
|
||||
c(b bVar) {
|
||||
this.ac = bVar;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
List list;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
list = this.ac.ab.Y;
|
||||
arrayList.addAll(list);
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
((OAuthListener) it.next()).onQrcodeScanned();
|
||||
}
|
||||
}
|
||||
}
|
212
sources/com/tencent/mm/opensdk/diffdev/a/d.java
Normal file
212
sources/com/tencent/mm/opensdk/diffdev/a/d.java
Normal file
@@ -0,0 +1,212 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Base64;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthErrCode;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthListener;
|
||||
import com.tencent.mm.opensdk.utils.Log;
|
||||
import com.ubt.jimu.diy.view.fragment.BuildStepFragment;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class d extends AsyncTask<Void, Void, a> {
|
||||
private static final boolean ad;
|
||||
private static final String ae;
|
||||
private static String af;
|
||||
private String ag;
|
||||
private String ah;
|
||||
private OAuthListener ai;
|
||||
private f aj;
|
||||
private String appId;
|
||||
private String scope;
|
||||
private String signature;
|
||||
|
||||
static class a {
|
||||
public OAuthErrCode ak;
|
||||
public String al;
|
||||
public String am;
|
||||
public String an;
|
||||
public int ao;
|
||||
public String ap;
|
||||
public byte[] aq;
|
||||
|
||||
private a() {
|
||||
}
|
||||
|
||||
private static boolean a(String str, byte[] bArr) {
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
try {
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(str);
|
||||
try {
|
||||
fileOutputStream2.write(bArr);
|
||||
fileOutputStream2.flush();
|
||||
try {
|
||||
fileOutputStream2.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "fout.close() exception:" + e.getMessage());
|
||||
}
|
||||
Log.d("MicroMsg.SDK.GetQRCodeResult", "writeToFile ok!");
|
||||
return true;
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
Log.w("MicroMsg.SDK.GetQRCodeResult", "write to file error, exception:" + e.getMessage());
|
||||
if (fileOutputStream == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
return false;
|
||||
} catch (IOException e3) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "fout.close() exception:" + e3.getMessage());
|
||||
return false;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e4) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "fout.close() exception:" + e4.getMessage());
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
e = e5;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
|
||||
public static a c(byte[] bArr) {
|
||||
OAuthErrCode oAuthErrCode;
|
||||
String format;
|
||||
a aVar = new a();
|
||||
if (bArr == null || bArr.length == 0) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "parse fail, buf is null");
|
||||
oAuthErrCode = OAuthErrCode.WechatAuth_Err_NetworkErr;
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(new String(bArr, "utf-8"));
|
||||
int i = jSONObject.getInt("errcode");
|
||||
if (i != 0) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", String.format("resp errcode = %d", Integer.valueOf(i)));
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
aVar.ao = i;
|
||||
aVar.ap = jSONObject.optString("errmsg");
|
||||
return aVar;
|
||||
}
|
||||
String string = jSONObject.getJSONObject("qrcode").getString("qrcodebase64");
|
||||
if (string != null && string.length() != 0) {
|
||||
byte[] decode = Base64.decode(string, 0);
|
||||
if (decode != null && decode.length != 0) {
|
||||
if (!d.ad) {
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_OK;
|
||||
aVar.aq = decode;
|
||||
aVar.al = jSONObject.getString(BuildStepFragment.UUID);
|
||||
aVar.am = jSONObject.getString("appname");
|
||||
Log.d("MicroMsg.SDK.GetQRCodeResult", String.format("parse succ, save in memory, uuid = %s, appname = %s, imgBufLength = %d", aVar.al, aVar.am, Integer.valueOf(aVar.aq.length)));
|
||||
return aVar;
|
||||
}
|
||||
File file = new File(d.ae);
|
||||
file.mkdirs();
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
if (!a(d.ae, decode)) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", String.format("writeToFile fail, qrcodeBuf length = %d", Integer.valueOf(decode.length)));
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
return aVar;
|
||||
}
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_OK;
|
||||
aVar.an = d.ae;
|
||||
aVar.al = jSONObject.getString(BuildStepFragment.UUID);
|
||||
aVar.am = jSONObject.getString("appname");
|
||||
Log.d("MicroMsg.SDK.GetQRCodeResult", String.format("parse succ, save in external storage, uuid = %s, appname = %s, imgPath = %s", aVar.al, aVar.am, aVar.an));
|
||||
return aVar;
|
||||
}
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "parse fail, qrcodeBuf is null");
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_JsonDecodeErr;
|
||||
return aVar;
|
||||
}
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", "parse fail, qrcodeBase64 is null");
|
||||
aVar.ak = OAuthErrCode.WechatAuth_Err_JsonDecodeErr;
|
||||
return aVar;
|
||||
} catch (Exception e) {
|
||||
format = String.format("parse json fail, ex = %s", e.getMessage());
|
||||
Log.e("MicroMsg.SDK.GetQRCodeResult", format);
|
||||
oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
aVar.ak = oAuthErrCode;
|
||||
return aVar;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
format = String.format("parse fail, build String fail, ex = %s", e2.getMessage());
|
||||
}
|
||||
}
|
||||
aVar.ak = oAuthErrCode;
|
||||
return aVar;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ad = Environment.getExternalStorageState().equals("mounted") && new File(Environment.getExternalStorageDirectory().getAbsolutePath()).canWrite();
|
||||
ae = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tencent/MicroMsg/oauth_qrcode.png";
|
||||
af = null;
|
||||
af = "http://open.weixin.qq.com/connect/sdk/qrconnect?appid=%s&noncestr=%s×tamp=%s&scope=%s&signature=%s";
|
||||
}
|
||||
|
||||
public d(String str, String str2, String str3, String str4, String str5, OAuthListener oAuthListener) {
|
||||
this.appId = str;
|
||||
this.scope = str2;
|
||||
this.ag = str3;
|
||||
this.ah = str4;
|
||||
this.signature = str5;
|
||||
this.ai = oAuthListener;
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected final /* synthetic */ a doInBackground(Void[] voidArr) {
|
||||
Log.i("MicroMsg.SDK.GetQRCodeTask", "external storage available = " + ad);
|
||||
String format = String.format(af, this.appId, this.ag, this.ah, this.scope, this.signature);
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
byte[] b = e.b(format, -1);
|
||||
Log.d("MicroMsg.SDK.GetQRCodeTask", String.format("doInBackground, url = %s, time consumed = %d(ms)", format, Long.valueOf(System.currentTimeMillis() - currentTimeMillis)));
|
||||
return a.c(b);
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected final /* synthetic */ void onPostExecute(a aVar) {
|
||||
a aVar2 = aVar;
|
||||
OAuthErrCode oAuthErrCode = aVar2.ak;
|
||||
if (oAuthErrCode != OAuthErrCode.WechatAuth_Err_OK) {
|
||||
Log.e("MicroMsg.SDK.GetQRCodeTask", String.format("onPostExecute, get qrcode fail, OAuthErrCode = %s", oAuthErrCode));
|
||||
this.ai.onAuthFinish(aVar2.ak, null);
|
||||
return;
|
||||
}
|
||||
Log.d("MicroMsg.SDK.GetQRCodeTask", "onPostExecute, get qrcode success");
|
||||
this.ai.onAuthGotQrcode(aVar2.an, aVar2.aq);
|
||||
this.aj = new f(aVar2.al, this.ai);
|
||||
f fVar = this.aj;
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
fVar.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
|
||||
} else {
|
||||
fVar.execute(new Void[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean q() {
|
||||
Log.i("MicroMsg.SDK.GetQRCodeTask", "cancelTask");
|
||||
f fVar = this.aj;
|
||||
return fVar == null ? cancel(true) : fVar.cancel(true);
|
||||
}
|
||||
}
|
56
sources/com/tencent/mm/opensdk/diffdev/a/e.java
Normal file
56
sources/com/tencent/mm/opensdk/diffdev/a/e.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import com.tencent.mm.opensdk.utils.Log;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class e {
|
||||
public static byte[] b(String str, int i) {
|
||||
String str2;
|
||||
StringBuilder sb;
|
||||
String message;
|
||||
if (str != null && str.length() != 0) {
|
||||
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
|
||||
HttpGet httpGet = new HttpGet(str);
|
||||
if (i >= 0) {
|
||||
try {
|
||||
HttpConnectionParams.setSoTimeout(defaultHttpClient.getParams(), i);
|
||||
} catch (Exception e) {
|
||||
sb = new StringBuilder("httpGet, Exception ex = ");
|
||||
message = e.getMessage();
|
||||
sb.append(message);
|
||||
str2 = sb.toString();
|
||||
Log.e("MicroMsg.SDK.NetUtil", str2);
|
||||
return null;
|
||||
} catch (IncompatibleClassChangeError e2) {
|
||||
sb = new StringBuilder("httpGet, IncompatibleClassChangeError ex = ");
|
||||
message = e2.getMessage();
|
||||
sb.append(message);
|
||||
str2 = sb.toString();
|
||||
Log.e("MicroMsg.SDK.NetUtil", str2);
|
||||
return null;
|
||||
} catch (Throwable th) {
|
||||
sb = new StringBuilder("httpGet, Throwable ex = ");
|
||||
message = th.getMessage();
|
||||
sb.append(message);
|
||||
str2 = sb.toString();
|
||||
Log.e("MicroMsg.SDK.NetUtil", str2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
HttpResponse execute = defaultHttpClient.execute(httpGet);
|
||||
if (execute.getStatusLine().getStatusCode() == 200) {
|
||||
return EntityUtils.toByteArray(execute.getEntity());
|
||||
}
|
||||
Log.e("MicroMsg.SDK.NetUtil", "httpGet fail, status code = " + execute.getStatusLine().getStatusCode());
|
||||
return null;
|
||||
}
|
||||
str2 = "httpGet, url is null";
|
||||
Log.e("MicroMsg.SDK.NetUtil", str2);
|
||||
return null;
|
||||
}
|
||||
}
|
146
sources/com/tencent/mm/opensdk/diffdev/a/f.java
Normal file
146
sources/com/tencent/mm/opensdk/diffdev/a/f.java
Normal file
@@ -0,0 +1,146 @@
|
||||
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;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class f extends AsyncTask<Void, Void, a> {
|
||||
private OAuthListener ai;
|
||||
private String al;
|
||||
private int ar;
|
||||
private String url;
|
||||
|
||||
static class a {
|
||||
public OAuthErrCode ak;
|
||||
public String as;
|
||||
|
||||
/* renamed from: at, reason: collision with root package name */
|
||||
public int f2at;
|
||||
|
||||
a() {
|
||||
}
|
||||
|
||||
public static a d(byte[] bArr) {
|
||||
OAuthErrCode oAuthErrCode;
|
||||
String format;
|
||||
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.f2at = jSONObject.getInt("wx_errcode");
|
||||
Log.d("MicroMsg.SDK.NoopingResult", String.format("nooping uuidStatusCode = %d", Integer.valueOf(aVar.f2at)));
|
||||
int i = aVar.f2at;
|
||||
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.ak = OAuthErrCode.WechatAuth_Err_OK;
|
||||
aVar.as = jSONObject.getString("wx_code");
|
||||
return aVar;
|
||||
default:
|
||||
oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
oAuthErrCode2 = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
}
|
||||
aVar.ak = oAuthErrCode2;
|
||||
return aVar;
|
||||
} catch (Exception e) {
|
||||
format = String.format("parse json fail, ex = %s", e.getMessage());
|
||||
Log.e("MicroMsg.SDK.NoopingResult", format);
|
||||
oAuthErrCode = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
aVar.ak = oAuthErrCode;
|
||||
return aVar;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
format = String.format("parse fail, build String fail, ex = %s", e2.getMessage());
|
||||
}
|
||||
}
|
||||
aVar.ak = oAuthErrCode;
|
||||
return aVar;
|
||||
}
|
||||
}
|
||||
|
||||
public f(String str, OAuthListener oAuthListener) {
|
||||
this.al = str;
|
||||
this.ai = oAuthListener;
|
||||
this.url = String.format("https://long.open.weixin.qq.com/connect/l/qrconnect?f=json&uuid=%s", str);
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected final /* synthetic */ a doInBackground(Void[] voidArr) {
|
||||
a aVar;
|
||||
OAuthErrCode oAuthErrCode;
|
||||
String str;
|
||||
String str2 = this.al;
|
||||
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.ar == 0) {
|
||||
str = "";
|
||||
} else {
|
||||
str = "&last=" + this.ar;
|
||||
}
|
||||
sb.append(str);
|
||||
String sb2 = sb.toString();
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
byte[] b = e.b(sb2, 60000);
|
||||
long currentTimeMillis2 = System.currentTimeMillis();
|
||||
a d = a.d(b);
|
||||
Log.d("MicroMsg.SDK.NoopingTask", String.format("nooping, url = %s, errCode = %s, uuidStatusCode = %d, time consumed = %d(ms)", sb2, d.ak.toString(), Integer.valueOf(d.f2at), Long.valueOf(currentTimeMillis2 - currentTimeMillis)));
|
||||
OAuthErrCode oAuthErrCode2 = d.ak;
|
||||
if (oAuthErrCode2 != OAuthErrCode.WechatAuth_Err_OK) {
|
||||
Log.e("MicroMsg.SDK.NoopingTask", String.format("nooping fail, errCode = %s, uuidStatusCode = %d", oAuthErrCode2.toString(), Integer.valueOf(d.f2at)));
|
||||
return d;
|
||||
}
|
||||
int i = d.f2at;
|
||||
this.ar = i;
|
||||
if (i == g.UUID_SCANED.getCode()) {
|
||||
this.ai.onQrcodeScanned();
|
||||
} else if (d.f2at != g.UUID_KEEP_CONNECT.getCode() && d.f2at == g.UUID_CONFIRM.getCode()) {
|
||||
String str3 = d.as;
|
||||
if (str3 == null || str3.length() == 0) {
|
||||
Log.e("MicroMsg.SDK.NoopingTask", "nooping fail, confirm with an empty code!!!");
|
||||
d.ak = OAuthErrCode.WechatAuth_Err_NormalErr;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
}
|
||||
Log.i("MicroMsg.SDK.NoopingTask", "IDiffDevOAuth.stopAuth / detach invoked");
|
||||
aVar = new a();
|
||||
oAuthErrCode = OAuthErrCode.WechatAuth_Err_Auth_Stopped;
|
||||
}
|
||||
aVar.ak = oAuthErrCode;
|
||||
return aVar;
|
||||
}
|
||||
|
||||
@Override // android.os.AsyncTask
|
||||
protected final /* synthetic */ void onPostExecute(a aVar) {
|
||||
a aVar2 = aVar;
|
||||
this.ai.onAuthFinish(aVar2.ak, aVar2.as);
|
||||
}
|
||||
}
|
28
sources/com/tencent/mm/opensdk/diffdev/a/g.java
Normal file
28
sources/com/tencent/mm/opensdk/diffdev/a/g.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.tencent.mm.opensdk.diffdev.a;
|
||||
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum g {
|
||||
UUID_EXPIRED(402),
|
||||
UUID_CANCELED(403),
|
||||
UUID_SCANED(404),
|
||||
UUID_CONFIRM(405),
|
||||
UUID_KEEP_CONNECT(408),
|
||||
UUID_ERROR(SingleClickListener.FAST_CLICK_DELAY_TIME);
|
||||
|
||||
private int code;
|
||||
|
||||
g(int i) {
|
||||
this.code = i;
|
||||
}
|
||||
|
||||
public final int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override // java.lang.Enum
|
||||
public final String toString() {
|
||||
return "UUIDStatusCode:" + this.code;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user