搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e
以下内容为反编译后的 dj0.java 源代码,内容仅作参考
package com.lygame.aaa;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.flyersoft.baseapplication.http.base.MustParam;
import com.lygame.aaa.gi0;
import com.tencent.cos.common.COSHttpResponseKey;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class dj0 {
public static volatile dj0 a;
public String b = "ApkUpdateModule";
public gi0 c = new gi0();
public WeakReference<Activity> d;
public class a implements Runnable {
public a() {
}
@Override
public void run() {
try {
dj0.this.c();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class b implements gi0.d {
public b() {
}
@Override
public void onResponse(yi0 yi0Var) {
if (yi0Var == null || !yi0Var.a) {
aj0.f(dj0.this.b, "APK更新接口返回失败");
return;
}
try {
aj0.c("REQ:" + yi0Var.a().toString());
JSONObject jSONObject = yi0Var.a().getJSONObject("data").getJSONObject("sdk_updates");
d b = dj0.this.b(jSONObject);
if (b == null || TextUtils.isEmpty(b.b())) {
return;
}
aj0.b("APK有更新:" + jSONObject.toString());
dj0.this.e(b);
} catch (JSONException unused) {
}
}
}
public class c implements Runnable {
public final d a;
public c(d dVar) {
this.a = dVar;
}
@Override
public void run() {
try {
new ak0((Activity) dj0.this.d.get(), this.a).b();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static class d {
public String a;
public List<String> b;
public String c;
public d(String str, List<String> list, String str2) {
this.a = str;
this.b = list;
this.c = str2;
}
public String a() {
return this.a;
}
public String b() {
return this.c;
}
public List<String> c() {
return this.b;
}
}
public d b(JSONObject jSONObject) {
ArrayList arrayList;
if (jSONObject == null) {
return null;
}
String optString = jSONObject.optString("app_version");
int optInt = jSONObject.optInt("app_level", -1);
String optString2 = jSONObject.optString("pkg_name");
String optString3 = jSONObject.optString(COSHttpResponseKey.DOWNLOAD_URL);
JSONObject optJSONObject = jSONObject.optJSONObject("update_desc");
if (optJSONObject != null) {
Iterator<String> keys = optJSONObject.keys();
try {
ArrayList<Integer> arrayList2 = new ArrayList();
while (keys.hasNext()) {
arrayList2.add(Integer.valueOf(Integer.parseInt(keys.next())));
}
Collections.sort(arrayList2);
arrayList = null;
for (Integer num : arrayList2) {
try {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(optJSONObject.optString(num.toString()));
} catch (Exception e) {
e = e;
e.printStackTrace();
if (TextUtils.isEmpty(optString)) {
}
aj0.c("APK参数部分或全部为空,不更新");
return null;
}
}
} catch (Exception e2) {
e = e2;
arrayList = null;
}
} else {
arrayList = null;
}
if (TextUtils.isEmpty(optString) && !TextUtils.isEmpty(optString2) && optInt != -1 && !TextUtils.isEmpty(optString3)) {
Activity activity = this.d.get();
if (activity == null) {
aj0.c("Activity已经释放");
return null;
}
String packageName = activity.getPackageName();
String e3 = fl0.e(activity);
if (optInt == fl0.d(activity) && optString.equals(e3) && optString2.equals(packageName)) {
return null;
}
return new d(optString, arrayList, optString3);
}
aj0.c("APK参数部分或全部为空,不更新");
return null;
}
public void c() {
ki0 ki0Var = ki0.getInstance();
JSONObject jSONObject = new JSONObject();
try {
JSONArray jSONArray = new JSONArray();
jSONArray.put(3);
jSONObject.put("buss_id", jSONArray);
jSONObject.put(z0.n, ki0Var.m().b());
jSONObject.put(MustParam.APP_NAME, ki0Var.a().e());
jSONObject.put("user", ki0Var.p().d());
jSONObject.put("check", ki0Var.j().a());
} catch (Exception e) {
e.printStackTrace();
}
aj0.c("REQ:" + jSONObject.toString());
this.c.j("http://47.105.86.145/sw/search", jSONObject.toString().getBytes(), null, new b());
}
private void d(Activity activity) {
this.d = new WeakReference<>(activity);
new Thread(new a()).start();
}
public void e(d dVar) {
new Handler(Looper.getMainLooper()).post(new c(dVar));
}
public static void i(Activity activity) {
if (a == null) {
synchronized (dj0.class) {
if (a == null) {
a = new dj0();
}
}
}
try {
a.d(activity);
} catch (Exception unused) {
}
}
}