多宝语音 v1.5.0版本的 MD5 值为:dcfcdc4e4f0a662eb0256f88e60f66b1

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


package d2;

import android.content.Context;
import android.os.Handler;
import c20.l;
import com.google.gson.k;
import com.google.gson.n;
import com.google.gson.p;
import h10.q;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.HashMap;
import t10.m;
import x20.e;
import x20.e0;
import x20.f;
import x20.f0;

public final class c {

    public static f2.a f32724a;

    public static d2.b f32725b;

    public static int f32727d;

    public static final c f32728e = new c();

    public static final Handler f32726c = new Handler();

    public static final class a implements f {

        public final d2.b f32729a;

        public final String f32730b;

        public static final class RunnableC0346a implements Runnable {

            public final f2.a f32731b;

            public final IOException f32732c;

            public RunnableC0346a(f2.a aVar, IOException iOException) {
                this.f32731b = aVar;
                this.f32732c = iOException;
            }

            @Override
            public final void run() {
                this.f32731b.a(this.f32732c.getMessage());
            }
        }

        public a(d2.b bVar, String str) {
            this.f32729a = bVar;
            this.f32730b = str;
        }

        @Override
        public void a(e eVar, IOException iOException) {
            m.g(eVar, "call");
            m.g(iOException, "e");
            g2.a.d("CLIENT_CONFIG", "check " + this.f32730b + " remote client config failed!! " + iOException.getMessage());
            c cVar = c.f32728e;
            f2.a c11 = c.c(cVar);
            if (c11 != null) {
                c.e(cVar).post(new RunnableC0346a(c11, iOException));
            }
            if (c.f(cVar) < this.f32729a.f()) {
                cVar.o(this.f32730b);
            }
        }

        @Override
        public void b(e eVar, e0 e0Var) {
            m.g(eVar, "call");
            m.g(e0Var, "response");
            int m11 = e0Var.m();
            if (m11 == 200) {
                try {
                    f0 a11 = e0Var.a();
                    if (a11 != null) {
                        k a12 = new p().a(a11.string());
                        m.b(a12, "JsonParser().parse(body.string())");
                        n c11 = a12.c();
                        k l11 = c11.l(com.alipay.sdk.m.l.c.f10133a);
                        m.b(l11, "obj.get(\"status\")");
                        int a13 = l11.a();
                        n m12 = c11.m("data");
                        if (a13 == 1000 && m12 != null) {
                            c cVar = c.f32728e;
                            String str = this.f32730b;
                            String kVar = m12.toString();
                            m.b(kVar, "data.toString()");
                            cVar.k(str, kVar);
                            return;
                        }
                        return;
                    }
                    return;
                } catch (Exception e11) {
                    e11.printStackTrace();
                    return;
                }
            }
            c cVar2 = c.f32728e;
            if (c.f(cVar2) < this.f32729a.f()) {
                cVar2.o(this.f32730b);
            }
            g2.a.d("CLIENT_CONFIG", "check " + this.f32730b + " remote client config error code is : " + m11);
        }
    }

    public static final class b implements Runnable {

        public final f2.a f32733b;

        public b(f2.a aVar) {
            this.f32733b = aVar;
        }

        @Override
        public final void run() {
            this.f32733b.a("you must init ClientConfig first!!");
        }
    }

    public static final class RunnableC0347c implements Runnable {

        public final String f32734b;

        public final String f32735c;

        public RunnableC0347c(String str, String str2) {
            this.f32734b = str;
            this.f32735c = str2;
        }

        @Override
        public final void run() {
            c.f32728e.j(this.f32734b, this.f32735c);
        }
    }

    public static final class d implements f {

        public final String f32736a;

        public static final class a implements Runnable {

            public final f2.a f32737b;

            public final IOException f32738c;

            public a(f2.a aVar, IOException iOException) {
                this.f32737b = aVar;
                this.f32738c = iOException;
            }

            @Override
            public final void run() {
                this.f32737b.a(this.f32738c.getMessage());
            }
        }

        public static final class b implements Runnable {

            public final f2.a f32739b;

            public final e0 f32740c;

            public b(f2.a aVar, e0 e0Var) {
                this.f32739b = aVar;
                this.f32740c = e0Var;
            }

            @Override
            public final void run() {
                this.f32739b.a("backup host json response code is " + this.f32740c.m());
            }
        }

        public d(String str) {
            this.f32736a = str;
        }

        @Override
        public void a(e eVar, IOException iOException) {
            m.g(eVar, "call");
            m.g(iOException, "e");
            c cVar = c.f32728e;
            f2.a c11 = c.c(cVar);
            if (c11 != null) {
                c.e(cVar).post(new a(c11, iOException));
            }
            c.f32727d = c.f(cVar) + 1;
        }

        @Override
        public void b(e eVar, e0 e0Var) {
            m.g(eVar, "call");
            m.g(e0Var, "response");
            f0 a11 = e0Var.a();
            if (e0Var.m() == 200 && a11 != null) {
                c cVar = c.f32728e;
                d2.b d11 = c.d(cVar);
                if (d11 != null) {
                    String string = a11.string();
                    m.b(string, "body.string()");
                    d11.i(string);
                }
                cVar.i(this.f32736a);
            } else {
                c cVar2 = c.f32728e;
                f2.a c11 = c.c(cVar2);
                if (c11 != null) {
                    c.e(cVar2).post(new b(c11, e0Var));
                }
            }
            c.f32727d = c.f(c.f32728e) + 1;
        }
    }

    public static final f2.a c(c cVar) {
        return f32724a;
    }

    public static final d2.b d(c cVar) {
        return f32725b;
    }

    public static final Handler e(c cVar) {
        return f32726c;
    }

    public static final int f(c cVar) {
        return f32727d;
    }

    public final void i(String str) {
        boolean z11;
        m.g(str, "configType");
        if (!g2.e.f35011a.a(d2.a.f32706b.a())) {
            return;
        }
        d2.b bVar = f32725b;
        if (bVar != null) {
            HashMap hashMap = new HashMap();
            hashMap.put("sign", f32728e.l(bVar.a(), bVar.g()));
            if (bVar.h() > 0) {
                hashMap.put("version_code", String.valueOf(bVar.h()));
            }
            if (bVar.b().length() > 0) {
                z11 = true;
            } else {
                z11 = false;
            }
            if (z11) {
                hashMap.put("channel", bVar.b());
            }
            String str2 = "http://" + bVar.e() + "/tinker/api/app/config/v2";
            g2.c cVar = g2.c.f35007c;
            g2.c.b(cVar, cVar.c(str2, bVar.a(), str, bVar.d()), hashMap, null, new a(bVar, str), 4, null);
            return;
        }
        f2.a aVar = f32724a;
        if (aVar != null) {
            f32726c.post(new b(aVar));
        }
    }

    public final void j(String str, String str2) {
        g2.a.b("CLIENT_CONFIG", l.f("config data is" + str2));
        f2.a aVar = f32724a;
        if (aVar != null) {
            int hashCode = str.hashCode();
            if (hashCode != -1423878093) {
                if (hashCode == 3016401 && str.equals("base")) {
                    aVar.c(str2);
                    return;
                }
                return;
            }
            if (str.equals("abtest")) {
                aVar.b(str2);
            }
        }
    }

    public final void k(String str, String str2) {
        String b11;
        try {
            if (m.a(str, "abtest")) {
                b11 = e2.a.f33408a.a();
            } else {
                b11 = e2.a.f33408a.b();
            }
            g2.a.b("CLIENT_CONFIG", str + " update current local config!");
            g2.d.f35008a.a(b11, str2);
            f32726c.post(new RunnableC0347c(str, str2));
        } catch (Exception e11) {
            g2.a.d("CLIENT_CONFIG", e11.getMessage());
        }
    }

    public final String l(String str, String str2) {
        String str3 = str + str2;
        Charset charset = c20.c.f6251b;
        if (str3 != null) {
            byte[] bytes = str3.getBytes(charset);
            m.b(bytes, "(this as java.lang.String).getBytes(charset)");
            String c11 = g2.b.c(bytes);
            m.b(c11, "MD5Util.getMD5(sb.toByteArray())");
            return c11;
        }
        throw new q("null cannot be cast to non-null type java.lang.String");
    }

    public final void m(Context context, d2.b bVar, f2.a aVar) {
        boolean z11;
        m.g(context, com.umeng.analytics.pro.d.X);
        m.g(bVar, "clientConfig");
        m.g(aVar, "checkClientListener");
        if (f32725b == null) {
            f32725b = bVar;
        } else {
            g2.a.d("CLIENT_CONFIG", "Try to initialize ClientConfig which had already been initialized before");
        }
        n(context);
        f32724a = aVar;
        d2.b bVar2 = f32725b;
        if (bVar2 != null) {
            boolean z12 = true;
            if (bVar2.a().length() == 0) {
                z11 = true;
            } else {
                z11 = false;
            }
            if (!z11) {
                if (bVar2.g().length() != 0) {
                    z12 = false;
                }
                if (z12) {
                    throw new IllegalStateException("secretKey can not be null!");
                }
            } else {
                throw new IllegalStateException("appKey can not be null!");
            }
        }
        g2.a.b("CLIENT_CONFIG", "init client config, " + bVar.a() + ' ' + bVar.g());
    }

    public final void n(Context context) {
        boolean z11;
        d2.a.f32706b.b(context);
        d2.b bVar = f32725b;
        if (bVar != null) {
            z11 = bVar.c();
        } else {
            z11 = false;
        }
        g2.a.c(z11);
    }

    public final void o(String str) {
        g2.c.b(g2.c.f35007c, "https://tinker-file.0bbm.cn/tinkerhost.json", new HashMap(), null, new d(str), 4, null);
    }
}