ServerApi.java 源代码
package com.x8zs.model;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.anythink.core.api.ATAdConst;
import com.anythink.core.common.c.d;
import com.anythink.expressad.foundation.d.b;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.umeng.analytics.pro.ai;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import r.b;
import r.m;
public class ServerApi {
private Context f21586a;
private r.l f21587b = null;
public static class SearchKeywordItem {
public int appId;
public String appName;
public int hintType;
public String icon;
public int id;
public boolean isOnlyOne;
public String keyword;
public String remark;
public String url;
public SearchKeywordItem(JSONObject jSONObject) throws Exception {
for (Field field : getClass().getDeclaredFields()) {
if (field.getType() == String.class) {
field.set(this, jSONObject.getString(field.getName()));
} else if (field.getType() == Integer.TYPE) {
field.setInt(this, jSONObject.getInt(field.getName()));
} else if (field.getType() == Boolean.TYPE) {
field.setBoolean(this, jSONObject.getBoolean(field.getName()));
}
}
}
}
class a extends s.i {
private String D;
final h0 E;
final d0 F;
a(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, d0 d0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = d0Var;
this.D = null;
}
private String O() {
String str;
String str2 = this.D;
if (str2 != null) {
return str2;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
JSONObject q6 = ServerApi.q(this.E);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("packageName", this.F.f21612a);
if (TextUtils.isEmpty(this.F.f21614c)) {
str = "";
} else {
str = this.F.f21614c;
}
jSONObject2.put("applicationName", str);
jSONObject2.put("appName", this.F.f21613b);
jSONObject2.put("certMd5", this.F.f21615d);
jSONObject.put(TtmlNode.TAG_HEAD, q6);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
jSONObject.put("time", currentTimeMillis);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class a0 {
public int f21588a;
public String f21589b;
}
class b extends s.i {
private String D;
final h0 E;
final d0 F;
b(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, d0 d0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = d0Var;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
JSONObject q6 = ServerApi.q(this.E);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("packageName", this.F.f21612a);
jSONObject2.put("appName", this.F.f21613b);
jSONObject.put(TtmlNode.TAG_HEAD, q6);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
jSONObject.put("time", currentTimeMillis);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class b0 {
public int f21590a;
public int f21591b;
public String f21592c;
public String f21593d;
public String f21594e;
public String f21595f;
public String f21596g;
public String[] f21597h;
public int f21598i;
public String f21599j;
public String[] f21600k;
public a0[] f21601l;
public a0 f21602m;
public String[] f21603n;
public String f21604o;
public String f21605p;
public List<z> f21606q;
public int f21607r;
public float f21608s;
public List<u0> f21609t;
}
class c extends s.i {
private String D;
final h0 E;
final List F;
c(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, List list) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = list;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, ServerApi.q(this.E));
jSONObject.put("time", currentTimeMillis);
JSONArray jSONArray = new JSONArray();
for (int i6 = 0; i6 < this.F.size(); i6++) {
d0 d0Var = (d0) this.F.get(i6);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("packageName", d0Var.f21612a);
jSONObject2.put("appName", d0Var.f21613b);
jSONArray.put(i6, jSONObject2);
}
jSONObject.put(TtmlNode.TAG_BODY, new JSONObject().put("apps", jSONArray));
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public interface c0 {
void onAppDetail(int i6, b0 b0Var);
}
class d implements m.b<String> {
final l0 f21610q;
d(l0 l0Var) {
this.f21610q = l0Var;
}
@Override
public void b(String str) {
try {
l0 l0Var = this.f21610q;
if (l0Var != null) {
l0Var.a(0);
}
} catch (Throwable th) {
Log.d("ServerApi", "[feedback] error " + th.getMessage());
l0 l0Var2 = this.f21610q;
if (l0Var2 != null) {
l0Var2.a(3);
}
}
}
}
public static class d0 {
public String f21612a;
public String f21613b;
public String f21614c;
public String f21615d;
}
class e implements m.a {
final l0 f21616q;
e(l0 l0Var) {
this.f21616q = l0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[feedback] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
l0 l0Var = this.f21616q;
if (l0Var != null) {
l0Var.a(y6);
}
}
}
public static class e0 {
public int f21618a;
public String f21619b;
public String f21620c;
public String f21621d;
}
class f extends s.i {
private String D;
final h0 E;
final k0 F;
f(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, k0 k0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = k0Var;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, ServerApi.q(this.E));
jSONObject.put("time", currentTimeMillis);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("type", this.F.f21665a);
jSONObject2.put("contact", this.F.f21666b);
jSONObject2.put("appName", this.F.f21667c);
jSONObject2.put("packageName", this.F.f21668d);
jSONObject2.put("versionName", this.F.f21669e);
jSONObject2.put("desc", this.F.f21670f);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public interface f0 {
void onBanner(int i6, List<e0> list);
}
class g implements m.b<String> {
final t0 f21622q;
g(t0 t0Var) {
this.f21622q = t0Var;
}
@Override
public void b(String str) {
try {
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = new JSONArray(str);
for (int i6 = 0; i6 < jSONArray.length(); i6++) {
arrayList.add(new SearchKeywordItem(jSONArray.getJSONObject(i6)));
}
Log.d("ServerApi", "[getSearchKeywords] success " + str);
t0 t0Var = this.f21622q;
if (t0Var != null) {
t0Var.onSearchKeywords(0, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getSearchKeywords] error " + th.getMessage());
t0 t0Var2 = this.f21622q;
if (t0Var2 != null) {
t0Var2.onSearchKeywords(3, null);
}
}
}
}
class h implements m.a {
final t0 f21624q;
h(t0 t0Var) {
this.f21624q = t0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getSearchKeywords] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
t0 t0Var = this.f21624q;
if (t0Var != null) {
t0Var.onSearchKeywords(y6, null);
}
}
}
public static class h0 {
public String f21626a;
public String f21627b;
public String f21628c;
public String f21629d;
public String f21630e;
public String f21631f;
public String f21632g;
public String f21633h;
public String f21634i;
public String f21635j;
public String f21636k;
public String f21637l;
public String f21638m;
public String f21639n;
}
class i extends s.i {
private String D;
final h0 E;
final d0 F;
i(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, d0 d0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = d0Var;
this.D = null;
}
private String O() {
String str;
String str2 = this.D;
if (str2 != null) {
return str2;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
JSONObject q6 = ServerApi.q(this.E);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("packageName", this.F.f21612a);
if (TextUtils.isEmpty(this.F.f21614c)) {
str = "";
} else {
str = this.F.f21614c;
}
jSONObject2.put("applicationName", str);
jSONObject2.put("appName", this.F.f21613b);
jSONObject.put(TtmlNode.TAG_HEAD, q6);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
jSONObject.put("time", currentTimeMillis);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class i0 {
public int f21640a;
public String f21641b;
public String f21642c;
public String f21643d;
public String f21644e;
public int f21645f;
public String f21646g;
public String[] f21647h;
public String f21648i;
public String[] f21649j;
public String f21650k;
public String f21651l;
public String f21652m;
public int f21653n;
public String f21654o;
public String[] f21655p;
public long f21656q;
public String f21657r;
public int f21658s;
public boolean f21659t;
public float f21660u;
}
class j implements m.b<String> {
final f0 f21661q;
j(f0 f0Var) {
this.f21661q = f0Var;
}
@Override
public void b(String str) {
try {
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = new JSONArray(str);
for (int i6 = 0; i6 < jSONArray.length(); i6++) {
JSONObject jSONObject = jSONArray.getJSONObject(i6);
e0 e0Var = new e0();
e0Var.f21618a = jSONObject.getInt("id");
e0Var.f21619b = jSONObject.getString("url");
e0Var.f21620c = jSONObject.getString(b.c.f3477e);
e0Var.f21621d = jSONObject.getString("slogan");
arrayList.add(e0Var);
}
Log.d("ServerApi", "[getBanner] success " + str);
f0 f0Var = this.f21661q;
if (f0Var != null) {
f0Var.onBanner(0, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getBanner] error " + th.getMessage());
f0 f0Var2 = this.f21661q;
if (f0Var2 != null) {
f0Var2.onBanner(3, null);
}
}
}
}
public interface j0 {
void a(int i6, int i7, int i8, int i9, List<i0> list);
}
class k implements m.b<String> {
final o0 f21663q;
k(o0 o0Var) {
this.f21663q = o0Var;
}
@Override
public void b(String str) {
try {
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = new JSONArray(str);
for (int i6 = 0; i6 < jSONArray.length(); i6++) {
JSONObject jSONObject = jSONArray.getJSONObject(i6);
n0 n0Var = new n0();
n0Var.f21683a = jSONObject.getString("showTime");
n0Var.f21684b = jSONObject.getString("user");
n0Var.f21685c = jSONObject.getInt("id");
n0Var.f21686d = jSONObject.getString("appName");
n0Var.f21687e = jSONObject.getDouble(d.a.f1868d);
n0Var.f21688f = jSONObject.getBoolean("keywordExist");
arrayList.add(n0Var);
}
Log.d("ServerApi", "[getHotAcc] success " + str);
o0 o0Var = this.f21663q;
if (o0Var != null) {
o0Var.onHotAcc(0, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getHotAcc] error " + th.getMessage());
o0 o0Var2 = this.f21663q;
if (o0Var2 != null) {
o0Var2.onHotAcc(3, null);
}
}
}
}
public static class k0 {
public int f21665a;
public String f21666b;
public String f21667c;
public String f21668d;
public String f21669e;
public String f21670f;
}
class l implements m.a {
final o0 f21671q;
l(o0 o0Var) {
this.f21671q = o0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getHotAcc] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
o0 o0Var = this.f21671q;
if (o0Var != null) {
o0Var.onHotAcc(y6, null);
}
}
}
public interface l0 {
void a(int i6);
}
class m extends s.i {
private String D;
final h0 E;
final PackageInfo F;
m(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, PackageInfo packageInfo) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = packageInfo;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, ServerApi.q(this.E));
jSONObject.put("time", currentTimeMillis);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("targetPackageName", this.F.packageName);
jSONObject2.put("targetAppName", this.F.applicationInfo.loadLabel(ServerApi.this.f21586a.getPackageManager()));
jSONObject2.put("targetSize", ((((float) new File(this.F.applicationInfo.sourceDir).length()) * 1.0f) / 1024.0f) / 1024.0f);
jSONObject2.put("targetVersionCode", this.F.versionCode);
jSONObject2.put("targetVersionName", this.F.versionName);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class m0 {
public List<String> f21673a = new ArrayList();
public List<String> f21674b = new ArrayList();
public List<String> f21675c = new ArrayList();
public List<String> f21676d = new ArrayList();
public List<String> f21677e = new ArrayList();
public List<String> f21678f = new ArrayList();
public List<String> f21679g = new ArrayList();
public List<String> f21680h = new ArrayList();
}
class n implements m.b<String> {
final q0 f21681q;
n(q0 q0Var) {
this.f21681q = q0Var;
}
@Override
public void b(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = jSONObject.getJSONArray("details");
for (int i6 = 0; i6 < jSONArray.length(); i6++) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i6);
i0 i0Var = new i0();
i0Var.f21640a = jSONObject2.getInt("id");
i0Var.f21641b = jSONObject2.getString("packageName");
i0Var.f21642c = jSONObject2.getString("appName");
i0Var.f21643d = jSONObject2.getString("icon");
i0Var.f21644e = jSONObject2.getString("versionName");
i0Var.f21645f = jSONObject2.getInt(ATAdConst.NETWORK_REQUEST_PARAMS_KEY.BANNER_SIZE);
i0Var.f21646g = jSONObject2.getString("url");
i0Var.f21647h = jSONObject2.getString("categoryShort").split(",");
i0Var.f21648i = jSONObject2.getString("channelName");
String trim = jSONObject2.getString("tags").trim();
if (!TextUtils.isEmpty(trim) && trim.length() > 1) {
i0Var.f21649j = trim.split(",");
}
i0Var.f21651l = jSONObject2.getString("opDateSlogan");
i0Var.f21650k = jSONObject2.getString("slogan");
i0Var.f21653n = jSONObject2.getInt("x8");
JSONArray jSONArray2 = jSONObject2.getJSONArray("images");
i0Var.f21655p = new String[jSONArray2.length()];
for (int i7 = 0; i7 < jSONArray2.length(); i7++) {
i0Var.f21655p[i7] = jSONArray2.getString(i7);
}
i0Var.f21660u = (float) jSONObject2.getDouble("acc");
arrayList.add(i0Var);
}
ArrayList arrayList2 = new ArrayList();
JSONArray jSONArray3 = jSONObject.getJSONArray("keywords");
for (int i8 = 0; i8 < jSONArray3.length(); i8++) {
JSONObject jSONObject3 = jSONArray3.getJSONObject(i8);
p0 p0Var = new p0();
p0Var.f21691a = (float) jSONObject3.getDouble("avgAcc");
p0Var.f21692b = jSONObject3.getString("appName");
arrayList2.add(p0Var);
}
Log.d("ServerApi", "[getHotList] success " + str);
q0 q0Var = this.f21681q;
if (q0Var != null) {
q0Var.a(0, arrayList2, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getHotList] error " + th.getMessage());
q0 q0Var2 = this.f21681q;
if (q0Var2 != null) {
q0Var2.a(3, null, null);
}
}
}
}
public static class n0 {
public String f21683a;
public String f21684b;
public int f21685c;
public String f21686d;
public double f21687e;
public boolean f21688f;
}
class o implements m.a {
final q0 f21689q;
o(q0 q0Var) {
this.f21689q = q0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getHotList] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
q0 q0Var = this.f21689q;
if (q0Var != null) {
q0Var.a(y6, null, null);
}
}
}
public interface o0 {
void onHotAcc(int i6, List<n0> list);
}
class p extends s.i {
private String D;
final h0 E;
p(int i6, String str, m.b bVar, m.a aVar, h0 h0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, ServerApi.q(this.E));
jSONObject.put("time", currentTimeMillis);
jSONObject.put(TtmlNode.TAG_BODY, JsonUtils.EMPTY_JSON);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class p0 {
public float f21691a;
public String f21692b;
}
class q extends s.i {
private String D;
final h0 E;
q(int i6, String str, m.b bVar, m.a aVar, h0 h0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.D = null;
}
private String O() {
String str = this.D;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, ServerApi.q(this.E));
jSONObject.put("time", currentTimeMillis);
jSONObject.put(TtmlNode.TAG_BODY, JsonUtils.EMPTY_JSON);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public interface q0 {
void a(int i6, List<p0> list, List<i0> list2);
}
class r implements m.a {
final f0 f21693q;
r(f0 f0Var) {
this.f21693q = f0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getBanner] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
f0 f0Var = this.f21693q;
if (f0Var != null) {
f0Var.onBanner(y6, null);
}
}
}
public static class r0 {
public long f21695a;
public List<i0> f21696b;
}
class s implements m.b<String> {
final j0 f21697q;
final int f21698r;
final int f21699s;
s(j0 j0Var, int i6, int i7) {
this.f21697q = j0Var;
this.f21698r = i6;
this.f21699s = i7;
}
@Override
public void b(String str) {
try {
ArrayList arrayList = new ArrayList();
JSONObject jSONObject = new JSONObject(str);
int i6 = jSONObject.getInt("total");
JSONArray jSONArray = jSONObject.getJSONArray("apps");
for (int i7 = 0; i7 < jSONArray.length(); i7++) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i7);
i0 i0Var = new i0();
i0Var.f21640a = jSONObject2.getInt("id");
i0Var.f21641b = jSONObject2.getString("packageName");
i0Var.f21642c = jSONObject2.getString("appName");
i0Var.f21643d = jSONObject2.getString("icon");
i0Var.f21644e = jSONObject2.getString("versionName");
i0Var.f21645f = jSONObject2.getInt(ATAdConst.NETWORK_REQUEST_PARAMS_KEY.BANNER_SIZE);
i0Var.f21646g = jSONObject2.getString("url");
i0Var.f21647h = jSONObject2.getString("categoryShort").split(",");
i0Var.f21648i = jSONObject2.getString("channelName");
String trim = jSONObject2.getString("tags").trim();
if (!TextUtils.isEmpty(trim) && trim.length() > 1) {
i0Var.f21649j = trim.split(",");
}
i0Var.f21651l = jSONObject2.getString("opDateSlogan");
i0Var.f21650k = jSONObject2.getString("slogan");
i0Var.f21653n = jSONObject2.getInt("x8");
i0Var.f21660u = (float) jSONObject2.getDouble("acc");
arrayList.add(i0Var);
}
Log.d("ServerApi", "[getDiscovery] success " + str);
j0 j0Var = this.f21697q;
if (j0Var != null) {
j0Var.a(0, i6, this.f21698r, this.f21699s, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getDiscovery] error " + th.getMessage());
j0 j0Var2 = this.f21697q;
if (j0Var2 != null) {
j0Var2.a(3, -1, this.f21698r, this.f21699s, null);
}
}
}
}
public interface s0 {
void a(int i6, int i7, int i8, List<r0> list);
}
class t implements m.a {
final j0 f21701q;
final int f21702r;
final int f21703s;
t(j0 j0Var, int i6, int i7) {
this.f21701q = j0Var;
this.f21702r = i6;
this.f21703s = i7;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getDiscovery] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
j0 j0Var = this.f21701q;
if (j0Var != null) {
j0Var.a(y6, -1, this.f21702r, this.f21703s, null);
}
}
}
public interface t0 {
void onSearchKeywords(int i6, List<SearchKeywordItem> list);
}
class u implements m.b<String> {
final s0 f21705q;
u(s0 s0Var) {
this.f21705q = s0Var;
}
@Override
public void b(String str) {
JSONArray jSONArray;
boolean z6;
try {
ArrayList arrayList = new ArrayList();
JSONObject jSONObject = new JSONObject(str);
int i6 = jSONObject.getInt("nextPointer");
int i7 = jSONObject.getInt("new");
JSONArray jSONArray2 = jSONObject.getJSONArray("groups");
int i8 = 0;
while (i8 < jSONArray2.length()) {
JSONObject jSONObject2 = jSONArray2.getJSONObject(i8);
r0 r0Var = new r0();
r0Var.f21695a = jSONObject2.getLong("releaseDate");
r0Var.f21696b = new ArrayList();
JSONArray jSONArray3 = jSONObject2.getJSONArray("apps");
int i9 = 0;
while (i9 < jSONArray3.length()) {
JSONObject jSONObject3 = jSONArray3.getJSONObject(i9);
i0 i0Var = new i0();
i0Var.f21640a = jSONObject3.getInt("id");
i0Var.f21641b = jSONObject3.getString("packageName");
i0Var.f21642c = jSONObject3.getString("appName");
i0Var.f21643d = jSONObject3.getString("icon");
i0Var.f21644e = jSONObject3.getString("versionName");
i0Var.f21645f = jSONObject3.getInt(ATAdConst.NETWORK_REQUEST_PARAMS_KEY.BANNER_SIZE);
i0Var.f21646g = jSONObject3.getString("url");
i0Var.f21647h = jSONObject3.getString("categoryShort").split(",");
i0Var.f21648i = jSONObject3.getString("channelName");
String trim = jSONObject3.getString("tags").trim();
if (!TextUtils.isEmpty(trim)) {
jSONArray = jSONArray2;
if (trim.length() > 1) {
i0Var.f21649j = trim.split(",");
}
} else {
jSONArray = jSONArray2;
}
i0Var.f21651l = jSONObject3.getString("opDateSlogan");
i0Var.f21650k = jSONObject3.getString("slogan");
i0Var.f21652m = jSONObject3.getString("cpName");
i0Var.f21653n = jSONObject3.getInt("x8");
i0Var.f21654o = jSONObject3.getString("title");
JSONArray jSONArray4 = jSONObject3.getJSONArray("images");
i0Var.f21655p = new String[jSONArray4.length()];
for (int i10 = 0; i10 < jSONArray4.length(); i10++) {
i0Var.f21655p[i10] = jSONArray4.getString(i10);
}
int i11 = i6;
i0Var.f21656q = jSONObject3.getLong("releaseTime");
i0Var.f21657r = jSONObject3.getString("releaseType");
i0Var.f21658s = jSONObject3.getInt("hotRate");
if (!jSONObject3.getBoolean("isShowDownload")) {
z6 = true;
} else {
z6 = false;
}
i0Var.f21659t = z6;
i0Var.f21660u = (float) jSONObject3.getDouble("acc");
r0Var.f21696b.add(i0Var);
i9++;
i6 = i11;
jSONArray2 = jSONArray;
}
arrayList.add(r0Var);
i8++;
i6 = i6;
jSONArray2 = jSONArray2;
}
int i12 = i6;
Log.d("ServerApi", "[getOpenTest] success " + str);
s0 s0Var = this.f21705q;
if (s0Var != null) {
s0Var.a(0, i12, i7, arrayList);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getOpenTest] error " + th.getMessage());
s0 s0Var2 = this.f21705q;
if (s0Var2 != null) {
s0Var2.a(3, -1, 0, null);
}
}
}
}
public static class u0 {
public String f21707a;
public String f21708b;
}
class v implements m.a {
final s0 f21709q;
v(s0 s0Var) {
this.f21709q = s0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getOpenTest] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
s0 s0Var = this.f21709q;
if (s0Var != null) {
s0Var.a(y6, -1, 0, null);
}
}
}
class w implements m.b<String> {
final c0 f21711q;
w(c0 c0Var) {
this.f21711q = c0Var;
}
@Override
public void b(String str) {
try {
b0 b0Var = new b0();
JSONObject jSONObject = new JSONObject(str);
b0Var.f21605p = jSONObject.getString("opDateSlogan");
b0Var.f21604o = jSONObject.getString("slogan");
b0Var.f21600k = jSONObject.getString("categoryfull").split(",");
b0Var.f21593d = jSONObject.getString("appName");
b0Var.f21599j = jSONObject.getString("url");
b0Var.f21592c = jSONObject.getString("packageName");
String trim = jSONObject.getString("tags").trim();
if (!TextUtils.isEmpty(trim) && trim.length() > 1) {
b0Var.f21603n = trim.split(",");
}
a0 a0Var = new a0();
b0Var.f21602m = a0Var;
a0Var.f21589b = jSONObject.getString("channelName");
b0Var.f21602m.f21588a = jSONObject.getInt("id");
b0Var.f21607r = jSONObject.getInt("x8");
b0Var.f21591b = jSONObject.getInt("gid");
b0Var.f21595f = jSONObject.getString("versionName");
b0Var.f21597h = jSONObject.getString("images").split(",");
int i6 = 0;
while (true) {
String[] strArr = b0Var.f21597h;
if (i6 >= strArr.length) {
break;
}
strArr[i6] = strArr[i6].trim();
i6++;
}
b0Var.f21596g = jSONObject.getString("desc");
b0Var.f21594e = jSONObject.getString("icon");
b0Var.f21590a = jSONObject.getInt("id");
b0Var.f21598i = jSONObject.getInt(ATAdConst.NETWORK_REQUEST_PARAMS_KEY.BANNER_SIZE);
b0Var.f21606q = new ArrayList();
JSONArray jSONArray = jSONObject.getJSONArray("announcements");
for (int i7 = 0; i7 < jSONArray.length(); i7++) {
z zVar = new z();
zVar.f21715a = jSONArray.getJSONObject(i7).getInt("id");
zVar.f21716b = jSONArray.getJSONObject(i7).getString("url");
zVar.f21717c = jSONArray.getJSONObject(i7).getString("title");
b0Var.f21606q.add(zVar);
}
JSONArray jSONArray2 = jSONObject.getJSONArray("ops");
b0Var.f21601l = new a0[jSONArray2.length()];
for (int i8 = 0; i8 < jSONArray2.length(); i8++) {
b0Var.f21601l[i8] = new a0();
b0Var.f21601l[i8].f21589b = jSONArray2.getJSONObject(i8).getString("channelName");
b0Var.f21601l[i8].f21588a = jSONArray2.getJSONObject(i8).getInt(com.anythink.expressad.videocommon.e.b.f5542u);
}
JSONArray jSONArray3 = jSONObject.getJSONArray("videos");
if (jSONArray3 != null && jSONArray3.length() > 0) {
b0Var.f21609t = new ArrayList();
for (int i9 = 0; i9 < jSONArray3.length(); i9++) {
JSONObject jSONObject2 = jSONArray3.getJSONObject(i9);
String string = jSONObject2.getString("url");
if (!TextUtils.isEmpty(string)) {
u0 u0Var = new u0();
u0Var.f21707a = string;
u0Var.f21708b = jSONObject2.getString("pic");
b0Var.f21609t.add(u0Var);
}
}
}
b0Var.f21608s = (float) jSONObject.getDouble("acc");
Log.d("ServerApi", "[getAppDetail] success " + str);
c0 c0Var = this.f21711q;
if (c0Var != null) {
c0Var.onAppDetail(0, b0Var);
}
} catch (Throwable th) {
Log.d("ServerApi", "[getAppDetail] error " + th.getMessage());
c0 c0Var2 = this.f21711q;
if (c0Var2 != null) {
c0Var2.onAppDetail(3, null);
}
}
}
}
class x implements m.a {
final c0 f21713q;
x(c0 c0Var) {
this.f21713q = c0Var;
}
@Override
public void a(r.r rVar) {
Log.e("ServerApi", "[getAppDetail] error " + rVar.getMessage());
int y6 = ServerApi.y(rVar);
c0 c0Var = this.f21713q;
if (c0Var != null) {
c0Var.onAppDetail(y6, null);
}
}
}
class y extends s.i {
private String D;
final h0 E;
final d0 F;
y(int i6, String str, m.b bVar, m.a aVar, h0 h0Var, d0 d0Var) {
super(i6, str, bVar, aVar);
this.E = h0Var;
this.F = d0Var;
this.D = null;
}
private String O() {
String str;
String str2 = this.D;
if (str2 != null) {
return str2;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
JSONObject q6 = ServerApi.q(this.E);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("packageName", this.F.f21612a);
if (TextUtils.isEmpty(this.F.f21614c)) {
str = "";
} else {
str = this.F.f21614c;
}
jSONObject2.put("applicationName", str);
jSONObject2.put("appName", this.F.f21613b);
jSONObject.put(TtmlNode.TAG_HEAD, q6);
jSONObject.put(TtmlNode.TAG_BODY, jSONObject2);
jSONObject.put("time", currentTimeMillis);
this.D = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.D = "";
}
return this.D;
}
@Override
public byte[] l() throws r.a {
return O().getBytes();
}
@Override
public Map<String, String> p() throws r.a {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
}
public static class z {
public int f21715a;
public String f21716b;
public String f21717c;
}
public ServerApi(Context context) {
this.f21586a = context;
}
private static void c(String str, List<String> list) {
if (TextUtils.isEmpty(str)) {
return;
}
for (String str2 : str.split(",")) {
list.add(str2.trim());
}
}
public static JSONObject q(h0 h0Var) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("uuid", h0Var.f21626a);
jSONObject.put("systemVersion", h0Var.f21627b);
jSONObject.put("brand", h0Var.f21628c);
jSONObject.put("model", h0Var.f21629d);
jSONObject.put("romVersion", h0Var.f21630e);
jSONObject.put(ai.f20392w, h0Var.f21631f);
jSONObject.put("cpubit", h0Var.f21634i);
jSONObject.put("gpu", "");
jSONObject.put("mac", h0Var.f21637l);
jSONObject.put("imsi", h0Var.f21636k);
jSONObject.put("imei", h0Var.f21635j);
jSONObject.put("channel", h0Var.f21639n);
jSONObject.put("versionName", h0Var.f21633h);
jSONObject.put("versionCode", h0Var.f21632g);
jSONObject.put("deviceId", h0Var.f21638m);
jSONObject.put("hostPackageName", "com.x8zs.ds2");
return jSONObject;
} catch (JSONException e6) {
e6.printStackTrace();
return null;
}
}
public static m0 t(String str) throws JSONException {
m0 m0Var = new m0();
JSONObject jSONObject = new JSONObject(str);
c(jSONObject.getString("appNameAble"), m0Var.f21673a);
c(jSONObject.getString("appNameWhite"), m0Var.f21677e);
c(jSONObject.getString("packageNameWhite"), m0Var.f21678f);
c(jSONObject.getString("packageNameUnable"), m0Var.f21676d);
c(jSONObject.getString("appNameUnable"), m0Var.f21674b);
c(jSONObject.getString("packageNameAble"), m0Var.f21675c);
c(jSONObject.getString("appNameBlack"), m0Var.f21679g);
c(jSONObject.getString("packageNameBlack"), m0Var.f21680h);
return m0Var;
}
public static String w(String str) {
return o2.f.D(str + "you are thief!").toLowerCase();
}
public static int y(r.r rVar) {
if (rVar == null) {
return 0;
}
if (rVar instanceof r.a) {
return 1;
}
if (rVar instanceof r.j) {
return 2;
}
if (rVar instanceof r.h) {
return 6;
}
if (rVar instanceof r.p) {
return 4;
}
if (rVar instanceof r.q) {
return 5;
}
return 255;
}
public void d(h0 h0Var, k0 k0Var, l0 l0Var) {
s().a(new f(1, "https://api.x8zs.com/api/feedback/", new d(l0Var), new e(l0Var), h0Var, k0Var));
}
public String e(h0 h0Var) {
s.h d6 = s.h.d();
try {
s().a(new p(1, "https://api.x8zs.com/api/viewsconfig/", d6, d6, h0Var));
return (String) d6.get(5L, TimeUnit.SECONDS);
} catch (Throwable unused) {
return "";
}
}
public void f(h0 h0Var, int i6, c0 c0Var) {
s().a(new g0(h0Var, 1, "https://api.x8zs.com/api/appdetail/?aid=" + i6, new w(c0Var), new x(c0Var)));
}
public void g(h0 h0Var, f0 f0Var) {
s().a(new g0(h0Var, 1, "https://api.x8zs.com/api/carousel/", new j(f0Var), new r(f0Var)));
}
public String h(h0 h0Var, PackageInfo packageInfo) {
s.h d6 = s.h.d();
try {
s().a(new m(1, "https://api.x8zs.com/api/getlatestappinfo/", d6, d6, h0Var, packageInfo));
return new JSONObject((String) d6.get(5L, TimeUnit.SECONDS)).getString("url");
} catch (Throwable unused) {
return "";
}
}
public String i(h0 h0Var) {
s.h d6 = s.h.d();
q qVar = new q(1, "https://api.x8zs.com/api/comconf/", d6, d6, h0Var);
qVar.L(false);
try {
s().a(qVar);
return (String) d6.get(5L, TimeUnit.SECONDS);
} catch (Throwable unused) {
return "";
}
}
public void j(h0 h0Var, int i6, int i7, String str, j0 j0Var) {
String str2;
if (TextUtils.isEmpty(str)) {
str2 = "https://api.x8zs.com/api/abnormal/?page=" + i6 + "&size=" + i7;
} else {
try {
str2 = "https://api.x8zs.com/api/search/?q=" + URLEncoder.encode(str, com.anythink.expressad.foundation.f.a.F) + "&page=" + i6 + "&size=" + i7;
} catch (UnsupportedEncodingException unused) {
str2 = "https://api.x8zs.com/api/search/?q=" + str + "&page=" + i6 + "&size=" + i7;
}
}
g0 g0Var = new g0(h0Var, 1, str2, new s(j0Var, i6, i7), new t(j0Var, i6, i7));
g0Var.L(true);
s().a(g0Var);
}
public m0 k() {
s.h d6 = s.h.d();
try {
s().a(new g0("https://api.x8zs.com/api/gamesfilter/", d6, d6));
return t((String) d6.get(5L, TimeUnit.SECONDS));
} catch (Throwable unused) {
return null;
}
}
public void l(o0 o0Var) {
g0 g0Var = new g0("https://api.x8zs.com/api/hotacc/", new k(o0Var), new l(o0Var));
g0Var.L(true);
s().a(g0Var);
}
public void m(h0 h0Var, String str, q0 q0Var) {
g0 g0Var = new g0(h0Var, 1, "https://api.x8zs.com/api/ranklist/?t=" + str, new n(q0Var), new o(q0Var));
g0Var.L(true);
s().a(g0Var);
}
public String n(h0 h0Var, d0 d0Var) {
s.h d6 = s.h.d();
try {
s().a(new y(1, "https://api.x8zs.com/api/runrule/", d6, d6, h0Var, d0Var));
return (String) d6.get(5L, TimeUnit.SECONDS);
} catch (Throwable unused) {
return "";
}
}
public void o(h0 h0Var, int i6, s0 s0Var) {
g0 g0Var = new g0(h0Var, 1, "https://api.x8zs.com/api/latestrelease/?p=" + i6, new u(s0Var), new v(s0Var));
g0Var.L(true);
s().a(g0Var);
}
public String p(h0 h0Var, d0 d0Var) {
s.h d6 = s.h.d();
try {
s().a(new i(1, "https://api.x8zs.com/api/shellrulev2/", d6, d6, h0Var, d0Var));
return (String) d6.get(5L, TimeUnit.SECONDS);
} catch (Throwable unused) {
return "";
}
}
public void r(h0 h0Var, t0 t0Var) {
s().a(new g0(h0Var, 1, "https://api.x8zs.com/api/keywords/", new g(t0Var), new h(t0Var)));
}
public r.l s() {
if (this.f21587b == null) {
r.l a7 = s.j.a(this.f21586a);
this.f21587b = a7;
a7.d();
}
return this.f21587b;
}
public int u(h0 h0Var, d0 d0Var) {
s.h d6 = s.h.d();
try {
s().a(new a(1, "https://api.x8zs.com/api/patchlog/", d6, d6, h0Var, d0Var));
d6.get(5L, TimeUnit.SECONDS);
return 0;
} catch (TimeoutException unused) {
return 5;
} catch (Throwable unused2) {
return 255;
}
}
public int v(h0 h0Var, d0 d0Var) {
s.h d6 = s.h.d();
try {
s().a(new b(1, "https://api.x8zs.com/api/notgame/", d6, d6, h0Var, d0Var));
d6.get(5L, TimeUnit.SECONDS);
return 0;
} catch (TimeoutException unused) {
return 5;
} catch (Throwable unused2) {
return 255;
}
}
public int x(h0 h0Var, List<d0> list) {
s.h d6 = s.h.d();
try {
s().a(new c(1, "https://api.x8zs.com/api/apps/", d6, d6, h0Var, list));
d6.get(5L, TimeUnit.SECONDS);
return 0;
} catch (TimeoutException unused) {
return 5;
} catch (Throwable unused2) {
return 255;
}
}
private static class g0 extends s.i {
private h0 D;
private String E;
public g0(String str, m.b<String> bVar, m.a aVar) {
super(str, bVar, aVar);
this.D = null;
this.E = null;
}
private String O() {
String str = this.E;
if (str != null) {
return str;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
try {
JSONObject jSONObject = new JSONObject();
JSONObject q6 = ServerApi.q(this.D);
new JSONObject();
jSONObject.put(TtmlNode.TAG_HEAD, q6);
jSONObject.put("time", currentTimeMillis);
this.E = new String(Base64.encode(jSONObject.toString().getBytes(), 0));
} catch (JSONException unused) {
this.E = "";
}
return this.E;
}
@Override
public void f(r.r rVar) {
b.a n6;
if ((rVar instanceof r.j) && (n6 = n()) != null) {
g(G(new r.i(n6.f25810a, n6.f25816g)).f25875a);
} else {
super.f(rVar);
}
}
@Override
public byte[] l() throws r.a {
if (this.D != null) {
return O().getBytes();
}
return super.l();
}
@Override
public Map<String, String> p() throws r.a {
if (this.D != null) {
HashMap hashMap = new HashMap();
hashMap.put("X8-Signature", ServerApi.w(O()));
hashMap.put("X8-API", "2");
return hashMap;
}
return super.p();
}
public g0(h0 h0Var, int i6, String str, m.b<String> bVar, m.a aVar) {
super(i6, str, bVar, aVar);
this.E = null;
this.D = h0Var;
}
}
}