Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35
以下内容为反编译后的 c.java 源代码,内容仅作参考
package k.u.c.d.g;
import android.content.Context;
import android.text.TextUtils;
import com.alibaba.fastjson.JSONObject;
import com.lumi.external.utils.log.Logs;
import com.umeng.analytics.AnalyticsConfig;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import k.t.b.f.e.h;
import k.u.c.d.d.l0;
import k.u.c.d.d.q0;
import k.u.c.d.j.n;
import k.u.c.d.j.o0;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import p.a.k0;
import p.a.m0;
public class c {
public static final String a = "app/v1.0/lumi";
public static final String b = "H5";
public static final String c = "H5_V2";
public static final String d = "https://aiot-rpc.aqara.cn/";
public static final String f21965e = "https://aiot-rpc-ap.aqara.com/";
public static final String f21966f = "https://aiot-rpc-eu.aqara.com/";
public static final String f21967g = "https://aiot-rpc-usa.aqara.com/";
public static final String f21968h = "https://aiot-rpc-tc.aqara.cn/";
public static volatile String f21969i = null;
public static String f21970j = "";
public static String f21971k = "";
public static final String f21972l = "app/v1.0/lumi/app/lock/res/history/query";
public static final String f21973m = "app/v1.0/lumi/res/history/delete";
public static final String f21974n = "app/v1.0/lumi/app/additional/config/set";
public static final String f21975o = "app/v1.0/lumi/app/additional/config/get";
public static final String f21976p = "aqara-APP";
public static final String f21977q = "app/v1.0/lumi/app/group/history/delete";
public static CountDownLatch f21978r = new CountDownLatch(1);
public static class a implements n<String> {
public final m0 a;
public a(m0 m0Var) {
this.a = m0Var;
}
@Override
public void onSuccess(String str) {
this.a.onSuccess(str);
}
@Override
public void onFailed(int i2, String str) {
this.a.onError(new Throwable(str));
}
}
public static String a() {
try {
f21978r.await();
} catch (InterruptedException e2) {
e2.printStackTrace();
}
return f21969i;
}
public static String b() {
if (TextUtils.isEmpty(f21970j)) {
Logs.d("use default h5 url https://cdn.aqara.com/cdn/app/mainland/h5/index.html#");
f21970j = "https://cdn.aqara.com/cdn/app/mainland/h5/index.html#";
}
return f21970j;
}
public static String c() {
if (TextUtils.isEmpty(f21971k)) {
Logs.d("use default h5 url v2 https://app-h5-test.aqara.cn/index.html#");
f21971k = "https://app-h5-test.aqara.cn/index.html#";
}
return f21971k;
}
public static void d() {
String b2 = k.u.c.r.l.c.k().b();
if (b2 != null) {
c(b2);
} else {
c(k.u.c.r.l.c.k().d());
}
}
public static void e(String str) {
f21971k = str;
}
public static void f(String str) {
if (TextUtils.isEmpty(str)) {
Logs.e("env is null");
return;
}
Logs.d("switch h5 base url env " + str);
char c2 = 65535;
int hashCode = str.hashCode();
if (hashCode != 2571410) {
if (hashCode == 1302824298 && str.equals("CN_PREISSUE")) {
c2 = 0;
}
} else if (str.equals("TEST")) {
c2 = 1;
}
if (c2 != 0 && c2 != 1) {
if ("https://cdn.aqara.com/cdn/app/mainland/h5/index.html#".equals(f21970j)) {
Logs.d("same h5 url " + f21970j);
return;
}
a(h.a(), "https://cdn.aqara.com/cdn/app/mainland/h5/index.html#");
b(h.a(), k.u.c.a.f21799r);
f21970j = "https://cdn.aqara.com/cdn/app/mainland/h5/index.html#";
f21971k = k.u.c.a.f21799r;
} else if (k.u.c.a.f21804w.equals(f21970j)) {
Logs.d("same h5 url " + f21970j);
} else {
a(h.a(), k.u.c.a.f21804w);
b(h.a(), "https://app-h5-test.aqara.cn/index.html#");
f21970j = k.u.c.a.f21804w;
f21971k = "https://app-h5-test.aqara.cn/index.html#";
}
}
public static String a(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
try {
Matcher matcher = Pattern.compile("^((http://)|(https://))?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(/)").matcher(str);
return matcher.find() ? matcher.group() : str;
} catch (Exception e2) {
e2.printStackTrace();
return str;
}
}
public static void b(Context context, String str) {
o0.b(context, c, str, c);
}
public static void c(String str) {
f21969i = a(str);
RetrofitUrlManager.getInstance().setGlobalDomain(f21969i);
f21978r.countDown();
}
public static void d(String str) {
f21970j = str;
}
public static String b(Context context) {
return (String) o0.a(context, c, "", c);
}
public static k0<String> b(String str) {
return k0.a((p.a.o0) new p.a.o0() {
@Override
public final void subscribe(m0 m0Var) {
new JSONObject().put("key", (Object) "argus_log");
}
});
}
public static void a(String str, HashMap<String, String> hashMap, n<String> nVar) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("userId", (Object) q0.b().a().getUserId());
for (Map.Entry<String, String> entry : hashMap.entrySet()) {
jSONObject.put(entry.getKey(), (Object) entry.getValue());
}
l0.i().b(str, jSONObject.toString(), l0.f(), nVar);
}
public static void a(Context context, String str) {
o0.b(context, b, str, b);
}
public static String a(Context context) {
return (String) o0.a(context, b, "", b);
}
public static void a(String str, long j2, long j3, List<String> list, int i2, int i3, int i4, n<String> nVar) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("subjectId", (Object) str);
jSONObject.put(AnalyticsConfig.RTD_START_TIME, (Object) Long.valueOf(j2));
jSONObject.put("endTime", (Object) Long.valueOf(j3));
jSONObject.put("attrs", (Object) list);
if (i2 >= 0) {
jSONObject.put("startIndex", (Object) Integer.valueOf(i2));
}
if (i4 > 0) {
jSONObject.put("size", (Object) Integer.valueOf(i4));
}
l0.i().b(f21972l, jSONObject.toString(), nVar);
}
public static k0<String> a(String str, String str2) {
final JSONObject jSONObject = new JSONObject();
jSONObject.put("key", (Object) str);
jSONObject.put("value", (Object) str2);
jSONObject.put("type", (Object) "aqara-APP");
return k0.a(new p.a.o0() {
@Override
public final void subscribe(m0 m0Var) {
c.a(JSONObject.this, m0Var);
}
});
}
public static void a(JSONObject jSONObject, m0 m0Var) throws Exception {
l0 i2 = l0.i();
i2.b(a() + "app/v1.0/lumi/app/additional/config/set", jSONObject.toString(), l0.f(), (n<String>) new a(m0Var));
}
}