京东到家.apk(点击下载) / h.java


package com.zx.a.I8b7;

import android.text.TextUtils;
import android.util.Base64;
import com.zx.a.I8b7.m1;
import com.zx.a.I8b7.w0;
import com.zx.module.annotation.Java2C;
import java.nio.charset.StandardCharsets;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import org.json.JSONArray;
import org.json.JSONObject;

public class h extends e {
    @Java2C.Method2C
    private static native String b() throws Exception;

    public static void c() throws Exception {
        w0.a aVar = new w0.a();
        z.a(aVar, e.a());
        w0.a a = aVar.a("https://zxid-m.mobileservice.cn/sdk/config/init");
        a.b = "POST";
        a.d = y0.a(m0.b("application/json; charset=utf-8"), b());
        a.e = "request config api";
        o1 o1Var = z.a;
        w0 w0Var = new w0(aVar);
        o1Var.getClass();
        z0 a2 = new s0(o1Var, w0Var).a();
        if (a2.b == 200) {
            JSONObject jSONObject = new JSONObject(j.a(Base64.decode(new JSONObject(a2.e.c()).getString("data"), 2), e.a, "UDID_ENC_AUTHTAG"));
            String string = jSONObject.getString("configVersion");
            m1 m1Var = m1.a.a;
            m1Var.a.getClass();
            if (!TextUtils.equals(string, j2.l)) {
                j2.l = string;
                m1Var.a.a(4, string, false);
            }
            JSONObject jSONObject2 = jSONObject.getJSONObject("fieldConfig");
            p2 p2Var = m1Var.a;
            String jSONObject3 = jSONObject2.toString();
            p2Var.getClass();
            if (!TextUtils.equals(jSONObject3, j2.u)) {
                j2.u = jSONObject3;
                m1Var.a.a(11, jSONObject3, true);
            }
            JSONObject jSONObject4 = jSONObject.getJSONObject("reportConfig");
            p2 p2Var2 = m1Var.a;
            String jSONObject5 = jSONObject4.toString();
            p2Var2.getClass();
            if (!TextUtils.equals(jSONObject5, j2.v)) {
                j2.v = jSONObject5;
                m1Var.a.a(12, jSONObject5, true);
            }
            JSONObject jSONObject6 = jSONObject.getJSONObject("cryptoConfig");
            p2 p2Var3 = m1Var.a;
            String jSONObject7 = jSONObject6.toString();
            p2Var3.getClass();
            if (!TextUtils.equals(jSONObject7, j2.w)) {
                j2.w = jSONObject7;
                m1Var.a.a(15, jSONObject7, true);
            }
            JSONObject optJSONObject = jSONObject.optJSONObject("appConfig");
            if (optJSONObject != null) {
                r1.a("处理 appConfig ");
                try {
                    JSONArray jSONArray = optJSONObject.getJSONArray("list");
                    if (jSONArray == null || jSONArray.length() <= 0) {
                        r1.b("appConfig list is empty");
                    } else {
                        int length = jSONArray.length();
                        int i = optJSONObject.getInt("type");
                        if (i == 1) {
                            for (int i2 = 0; i2 < length; i2++) {
                                jSONArray.put(i2, j.a(Base64.decode(jSONArray.getString(i2), 2), e.a, "UDID_ENC_AUTHTAG"));
                            }
                        } else if (i == 3) {
                            SecretKey a3 = j.a(e.b, j2.a(j2.h));
                            for (int i3 = 0; i3 < length; i3++) {
                                jSONArray.put(i3, new String(j.a("AES/CBC/PKCS7Padding", a3, new IvParameterSpec("UDID_ENC_AUTHTAG".getBytes(StandardCharsets.UTF_8)), Base64.decode(jSONArray.getString(i3), 2)), StandardCharsets.UTF_8));
                            }
                        }
                        m1 m1Var2 = m1.a.a;
                        p2 p2Var4 = m1Var2.a;
                        String jSONObject8 = optJSONObject.toString();
                        p2Var4.getClass();
                        if (!TextUtils.equals(jSONObject8, j2.x)) {
                            j2.x = jSONObject8;
                            m1Var2.a.a(21, jSONObject8, true);
                        }
                    }
                } catch (Exception e) {
                    r1.a(e);
                }
            }
            JSONObject optJSONObject2 = jSONObject.optJSONObject("commonConfig");
            if (optJSONObject2 != null) {
                m1 m1Var3 = m1.a.a;
                p2 p2Var5 = m1Var3.a;
                String jSONObject9 = optJSONObject2.toString();
                p2Var5.getClass();
                if (!TextUtils.equals(jSONObject9, j2.y)) {
                    j2.y = jSONObject9;
                    m1Var3.a.a(22, jSONObject9, true);
                }
            }
            JSONObject optJSONObject3 = jSONObject.optJSONObject("invokeConfig");
            if (optJSONObject3 != null) {
                m1 m1Var4 = m1.a.a;
                p2 p2Var6 = m1Var4.a;
                String jSONObject10 = optJSONObject3.toString();
                synchronized (p2Var6) {
                    if (!TextUtils.equals(jSONObject10, j2.z)) {
                        j2.z = jSONObject10;
                        j2.c();
                        m1Var4.a.a(19, j2.z, true);
                    }
                }
            }
            if (!j2.m) {
                m1 m1Var5 = m1.a.a;
                m1Var5.a.getClass();
                if (true != j2.m) {
                    j2.m = true;
                    p2 p2Var7 = m1Var5.a;
                    p2Var7.a(6, j2.m + "", false);
                    return;
                }
                return;
            }
            return;
        }
        String a4 = a2.a("Udid-Error-Code");
        String a5 = a2.a("Udid-Error-Message");
        throw new RuntimeException("response errCode: " + a4 + ", errMsg: " + a5);
    }
}