Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35

以下内容为反编译后的 t0.java 源代码,内容仅作参考


package k.u.c.d.g.d;

import android.text.TextUtils;
import android.util.LongSparseArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lumiunited.aqara.device.devicepage.gateway.acpartner.bean.ACRemoteItem;
import com.lumiunited.aqara.device.devicepage.gateway.acpartner.match.bean.ACBrandsWrapEntity;
import com.lumiunited.aqara.login.bean.UserInfo;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
public class t0 {
    public static final String a = "app/v1.0/lumi/dev/ircode/learn/start";
    public static final String b = "app/v1.0/lumi/dev/ircode/learn/cancel";
    public static final String c = "app/v1.0/lumi/dev/ircode/query/list";
    public static final String d = "app/v1.0/lumi/dev/ircode/set/delete";
    public static final String f22093e = "app/v1.0/lumi/irdevice/remote/functions";
    public static String f22094f = "app/v1.0/lumi/irdevice/key/add";
    public static String f22095g = "app/v1.0/lumi/irdevice/key/del";
    public static String f22096h = "app/v1.0/lumi/irdevice/controller/info";
    public static String f22097i = "app/v1.0/lumi/irdevice/controller/key/click";
    public static String f22098j = "app/v1.0/lumi/irdevice/key/update";
    public static final String f22099k = "https://app-api.aqara.cn/api/v1/ir/aclist/5";
    public static final String f22100l = "https://app-api.aqara.cn/api/v1/ir/aclist/12";
    public static final String f22101m = "https://app-api.aqara.cn/api/v1/ir/brandici/";
    public static final String f22102n = "/5/1";
    public static final String f22103o = "app/v1.0/lumi/app/additional/file/upload";
    public static final String f22104p = "app/v1.0/lumi/user/feedback/submit";
    public static ACBrandsWrapEntity f22105q;
    public static ACBrandsWrapEntity f22106r;
    public static LongSparseArray<List<ACRemoteItem>> f22107s = new LongSparseArray<>();

    public static class a implements k.u.c.d.j.n<String> {
        public final k.u.c.d.j.n a;

        public a(k.u.c.d.j.n nVar) {
            this.a = nVar;
        }

        @Override
        public void onSuccess(String str) {
            try {
                ACBrandsWrapEntity aCBrandsWrapEntity = (ACBrandsWrapEntity) JSON.parseObject(k.u.c.g0.e.b.a(k.u.c.g0.e.b.b((String) JSON.parseObject(str).get("result"))), ACBrandsWrapEntity.class);
                t0.f22105q = aCBrandsWrapEntity;
                this.a.onSuccess(aCBrandsWrapEntity);
            } catch (IOException e2) {
                e2.printStackTrace();
                this.a.onFailed(-1, "IOException");
            }
        }

        @Override
        public void onFailed(int i2, String str) {
            if (i2 == 200) {
                onSuccess("{\"result\": \"" + str + "\"}");
                return;
            }
            this.a.onFailed(i2, str);
        }
    }

    public static class b implements k.u.c.d.j.n<String> {
        public final k.u.c.d.j.n a;

        public b(k.u.c.d.j.n nVar) {
            this.a = nVar;
        }

        @Override
        public void onSuccess(String str) {
            try {
                ACBrandsWrapEntity aCBrandsWrapEntity = (ACBrandsWrapEntity) JSON.parseObject(k.u.c.g0.e.b.a(k.u.c.g0.e.b.b((String) JSON.parseObject(str).get("result"))), ACBrandsWrapEntity.class);
                t0.f22106r = aCBrandsWrapEntity;
                this.a.onSuccess(aCBrandsWrapEntity);
            } catch (IOException e2) {
                e2.printStackTrace();
                this.a.onFailed(-1, "IOException");
            }
        }

        @Override
        public void onFailed(int i2, String str) {
            if (i2 == 200) {
                onSuccess("{\"result\": \"" + str + "\"}");
                return;
            }
            this.a.onFailed(i2, str);
        }
    }

    public static class c implements k.u.c.d.j.n<String> {
        public final k.u.c.d.j.n a;
        public final long b;

        public c(k.u.c.d.j.n nVar, long j2) {
            this.a = nVar;
            this.b = j2;
        }

        @Override
        public void onSuccess(String str) {
            try {
                List<ACRemoteItem> parseArray = JSON.parseArray(k.u.c.g0.e.b.a(k.u.c.g0.e.b.b((String) JSON.parseObject(str).get("result"))), ACRemoteItem.class);
                t0.b(parseArray, this.b);
                if (t0.f22107s == null) {
                    t0.f22107s = new LongSparseArray<>();
                }
                t0.f22107s.put(this.b, parseArray);
                this.a.onSuccess(parseArray);
            } catch (IOException e2) {
                e2.printStackTrace();
                this.a.onFailed(-1, "IOException");
            }
        }

        @Override
        public void onFailed(int i2, String str) {
            if (i2 == 200) {
                onSuccess("{\"result\": \"" + str + "\"}");
                return;
            }
            this.a.onFailed(i2, str);
        }
    }

    public static void b(String str, k.u.c.d.j.n<String> nVar) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("did", (Object) str);
        k.u.c.d.d.l0.i().a(c, jSONObject, nVar);
    }

    public static void c(String str, k.u.c.d.j.n<String> nVar) {
        HashMap hashMap = new HashMap();
        hashMap.put("remoteId", str);
        k.u.c.d.d.l0.i().a(f22093e, hashMap, nVar);
    }

    public static void d(String str, k.u.c.d.j.n<String> nVar) {
        String facebookId;
        JSONObject jSONObject = new JSONObject();
        UserInfo a2 = k.u.c.d.d.q0.b().a();
        jSONObject.put("type", (Object) 3);
        jSONObject.put("title", (Object) "ac_matching");
        jSONObject.put("content", (Object) str);
        if (!TextUtils.isEmpty(a2.getPhoneNum())) {
            facebookId = a2.getPhoneNum();
        } else if (!TextUtils.isEmpty(a2.getWechatId())) {
            facebookId = a2.getWechatId();
        } else if (TextUtils.isEmpty(a2.getEmail())) {
            facebookId = !TextUtils.isEmpty(a2.getFacebookId()) ? a2.getFacebookId() : "";
        } else {
            facebookId = a2.getEmail();
        }
        jSONObject.put("contactInfo", (Object) facebookId);
        k.u.c.d.d.l0.f21935h = true;
        k.u.c.d.d.l0.i().a(f22104p, jSONObject, nVar);
    }

    public static void e(String str, k.u.c.d.j.n<String> nVar) {
        File file = new File(str);
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("userId", k.u.c.d.d.q0.b().a().getUserId());
        hashMap.put("file", file);
        try {
            k.u.c.d.d.l0.i().a("app/v1.0/lumi/app/additional/file/upload", hashMap, k.u.c.d.d.l0.f(), nVar);
        } catch (IOException e2) {
            e2.printStackTrace();
            nVar.onFailed(-1, "file not found");
        }
    }

    public static void a(String str, boolean z2, k.u.c.d.j.n<String> nVar) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("deviceId", (Object) str);
        jSONObject.put("timeLength", (Object) 30);
        jSONObject.put("type", (Object) Integer.valueOf(!z2 ? 1 : 0));
        k.u.c.d.d.l0.i().a(a, jSONObject, nVar);
    }

    public static void b(k.u.c.d.j.n<ACBrandsWrapEntity> nVar) {
        ACBrandsWrapEntity aCBrandsWrapEntity = f22106r;
        if (aCBrandsWrapEntity != null) {
            aCBrandsWrapEntity.setAll(aCBrandsWrapEntity.getAll());
            nVar.onSuccess(f22106r);
            return;
        }
        k.u.c.d.d.l0.i().a(f22100l, "GET", (String) null, k.u.c.d.d.l0.f(), new b(nVar));
    }

    public static void a(String str, String str2, k.u.c.d.j.n<String> nVar) {
        String str3 = f22097i;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("did", (Object) str);
        jSONObject.put("keyId", (Object) str2);
        k.u.c.d.d.l0.i().a(str3, jSONObject, nVar);
    }

    public static void b(List<ACRemoteItem> list, long j2) {
        char c2;
        String str = j2 + "";
        switch (str.hashCode()) {
            case 1636:
                if (str.equals("37")) {
                    c2 = 2;
                    break;
                }
                c2 = 65535;
                break;
            case 1822:
                if (str.equals("97")) {
                    c2 = 1;
                    break;
                }
                c2 = 65535;
                break;
            case 48875:
                if (str.equals("182")) {
                    c2 = 0;
                    break;
                }
                c2 = 65535;
                break;
            case 48906:
                if (str.equals("192")) {
                    c2 = 6;
                    break;
                }
                c2 = 65535;
                break;
            case 48911:
                if (str.equals("197")) {
                    c2 = 5;
                    break;
                }
                c2 = 65535;
                break;
            case 49588:
                if (str.equals("202")) {
                    c2 = 3;
                    break;
                }
                c2 = 65535;
                break;
            case 1544191:
                if (str.equals("2782")) {
                    c2 = 4;
                    break;
                }
                c2 = 65535;
                break;
            default:
                c2 = 65535;
                break;
        }
        switch (c2) {
            case 0:
                ACRemoteItem aCRemoteItem = new ACRemoteItem();
                aCRemoteItem.setId(80111111L);
                aCRemoteItem.setType(2);
                ACRemoteItem aCRemoteItem2 = new ACRemoteItem();
                aCRemoteItem2.setId(80111112L);
                aCRemoteItem2.setType(2);
                list.add(0, aCRemoteItem2);
                list.add(0, aCRemoteItem);
                return;
            case 1:
                ACRemoteItem aCRemoteItem3 = new ACRemoteItem();
                aCRemoteItem3.setId(80222221L);
                aCRemoteItem3.setType(2);
                list.add(0, aCRemoteItem3);
                return;
            case 2:
                ACRemoteItem aCRemoteItem4 = new ACRemoteItem();
                aCRemoteItem4.setId(80333331L);
                aCRemoteItem4.setType(2);
                list.add(0, aCRemoteItem4);
                return;
            case 3:
                ACRemoteItem aCRemoteItem5 = new ACRemoteItem();
                aCRemoteItem5.setId(80444441L);
                aCRemoteItem5.setType(2);
                list.add(0, aCRemoteItem5);
                return;
            case 4:
                ACRemoteItem aCRemoteItem6 = new ACRemoteItem();
                aCRemoteItem6.setId(80555551L);
                aCRemoteItem6.setType(2);
                list.add(0, aCRemoteItem6);
                return;
            case 5:
                ACRemoteItem aCRemoteItem7 = new ACRemoteItem();
                aCRemoteItem7.setId(80777771L);
                aCRemoteItem7.setType(2);
                list.add(0, aCRemoteItem7);
                return;
            case 6:
                ACRemoteItem aCRemoteItem8 = new ACRemoteItem();
                aCRemoteItem8.setId(80666661L);
                aCRemoteItem8.setType(2);
                list.add(0, aCRemoteItem8);
                return;
            default:
                return;
        }
    }

    public static void a(String str, String str2, String str3, k.u.c.d.j.n<String> nVar) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("did", (Object) str);
        jSONObject.put("irid", (Object) str2);
        jSONObject.put("name", (Object) str3);
        k.u.c.d.d.l0.i().a("app/v1.0/lumi/dev/ircode/set/update", jSONObject, nVar);
    }

    public static void a(k.u.c.d.j.n<ACBrandsWrapEntity> nVar) {
        ACBrandsWrapEntity aCBrandsWrapEntity = f22105q;
        if (aCBrandsWrapEntity != null) {
            aCBrandsWrapEntity.setAll(aCBrandsWrapEntity.getAll());
            nVar.onSuccess(f22105q);
            return;
        }
        k.u.c.d.d.l0.i().a(f22099k, "GET", (String) null, k.u.c.d.d.l0.f(), new a(nVar));
    }

    public static void a(long j2, k.u.c.d.j.n<List<ACRemoteItem>> nVar) {
        List<ACRemoteItem> list;
        LongSparseArray<List<ACRemoteItem>> longSparseArray = f22107s;
        if (longSparseArray != null && (list = longSparseArray.get(j2)) != null && list.size() > 0) {
            nVar.onSuccess(list);
        }
        k.u.c.d.d.l0 i2 = k.u.c.d.d.l0.i();
        i2.a(f22101m + j2 + f22102n, "GET", (String) null, k.u.c.d.d.l0.f(), new c(nVar, j2));
    }

    public static void a(InputStream inputStream, k.u.c.d.j.n<String> nVar) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("userId", k.u.c.d.d.q0.b().a().getUserId());
        hashMap.put("file", inputStream);
        try {
            k.u.c.d.d.l0.i().a("app/v1.0/lumi/app/additional/file/upload", hashMap, k.u.c.d.d.l0.f(), nVar);
        } catch (IOException e2) {
            e2.printStackTrace();
            nVar.onFailed(-1, "file not found");
        }
    }

    public static void a(String str, List<String> list, k.u.c.d.j.n<String> nVar) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("did", (Object) str);
        jSONObject.put("irids", (Object) list);
        k.u.c.d.d.l0.i().a(d, jSONObject, nVar);
    }

    public static void a(String str, k.u.c.d.j.n<String> nVar) {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("did", (Object) str);
        k.u.c.d.d.l0.i().a(b, jSONObject, nVar);
    }

    public static void b(String str, List<String> list, k.u.c.d.j.n<String> nVar) {
        String facebookId;
        JSONObject jSONObject = new JSONObject();
        UserInfo a2 = k.u.c.d.d.q0.b().a();
        jSONObject.put("type", (Object) 0);
        jSONObject.put("title", (Object) str);
        jSONObject.put("content", (Object) str);
        jSONObject.put("attachFileUrls", (Object) JSON.toJSONString(list));
        if (!TextUtils.isEmpty(a2.getPhoneNum())) {
            facebookId = a2.getPhoneNum();
        } else if (!TextUtils.isEmpty(a2.getWechatId())) {
            facebookId = a2.getWechatId();
        } else if (TextUtils.isEmpty(a2.getEmail())) {
            facebookId = !TextUtils.isEmpty(a2.getFacebookId()) ? a2.getFacebookId() : "";
        } else {
            facebookId = a2.getEmail();
        }
        jSONObject.put("contactInfo", (Object) facebookId);
        k.u.c.d.d.l0.f21935h = true;
        k.u.c.d.d.l0.i().a(f22104p, jSONObject, nVar);
    }
}