RbChat v4.56630229版本的 MD5 值为:d137f4b55d6b64b50641a810905f5957

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


package com.loc;

import android.content.Context;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.multipart.HttpPostBodyUtil;
import io.reactivex.annotations.SchedulerSupport;
import java.util.HashMap;
import java.util.Locale;
public final class db {
    private static db b;
    bj a;
    private Context c;
    private int d = dg.f;
    private boolean e = false;
    private int f = 0;

    private db(Context context) {
        this.a = null;
        this.c = null;
        try {
            r.a().a(context);
        } catch (Throwable unused) {
        }
        this.c = context;
        this.a = bj.a();
    }

    public static db a(Context context) {
        if (b == null) {
            b = new db(context);
        }
        return b;
    }

    public final int a() {
        return this.d;
    }

    public final bo a(dc dcVar) throws Throwable {
        return bj.a(dcVar, this.e || dn.k(this.c));
    }

    public final dc a(Context context, byte[] bArr, String str, boolean z) {
        String str2;
        try {
            HashMap hashMap = new HashMap(16);
            dc dcVar = new dc(context, dg.b());
            try {
                hashMap.put("Content-Type", HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE);
                hashMap.put("Accept-Encoding", "gzip");
                hashMap.put("gzipped", "1");
                hashMap.put("Connection", "Keep-Alive");
                hashMap.put("User-Agent", "AMAP_Location_SDK_Android 4.8.0");
                hashMap.put("KEY", l.f(context));
                hashMap.put("enginever", "5.1");
                String a = n.a();
                String a2 = n.a(context, a, "key=" + l.f(context));
                hashMap.put("ts", a);
                hashMap.put("scode", a2);
                hashMap.put("encr", "1");
                dcVar.f = hashMap;
                String str3 = z ? "loc" : "locf";
                dcVar.m = true;
                dcVar.k = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.8.0", str3, 3);
                dcVar.j = z;
                dcVar.g = str;
                dcVar.h = dn.a(bArr);
                dcVar.a(t.a(context));
                HashMap hashMap2 = new HashMap(16);
                hashMap2.put("output", "bin");
                hashMap2.put("policy", "3103");
                int i = this.f;
                if (i != 0) {
                    if (i != 1) {
                        str2 = i == 2 ? "language:en" : "language:cn";
                    }
                    hashMap2.put(SchedulerSupport.CUSTOM, str2);
                    dcVar.l = hashMap2;
                    dcVar.a(this.d);
                    dcVar.b(this.d);
                    if ((!this.e || dn.k(context)) && str.startsWith("http:")) {
                        dcVar.g = dcVar.c().replace("https:", "https:");
                        return dcVar;
                    }
                    return dcVar;
                }
                hashMap2.remove(SchedulerSupport.CUSTOM);
                dcVar.l = hashMap2;
                dcVar.a(this.d);
                dcVar.b(this.d);
                if (this.e) {
                }
                dcVar.g = dcVar.c().replace("https:", "https:");
                return dcVar;
            } catch (Throwable unused) {
                return dcVar;
            }
        } catch (Throwable unused2) {
            return null;
        }
    }

    public final String a(Context context, double d, double d2) {
        byte[] b2;
        String str;
        try {
            HashMap hashMap = new HashMap(16);
            dc dcVar = new dc(context, dg.b());
            hashMap.clear();
            hashMap.put("Content-Type", HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED);
            hashMap.put("Connection", "Keep-Alive");
            hashMap.put("User-Agent", "AMAP_Location_SDK_Android 4.8.0");
            HashMap hashMap2 = new HashMap(16);
            hashMap2.put(SchedulerSupport.CUSTOM, "26260A1F00020002");
            hashMap2.put("key", l.f(context));
            int i = this.f;
            if (i != 0) {
                if (i != 1) {
                    str = i == 2 ? "en" : "zh-CN";
                }
                hashMap2.put("language", str);
                String a = n.a();
                String a2 = n.a(context, a, w.b(hashMap2));
                hashMap2.put("ts", a);
                hashMap2.put("scode", a2);
                dcVar.b(("output=json&radius=1000&extensions=all&location=" + d2 + "," + d).getBytes("UTF-8"));
                dcVar.m = false;
                dcVar.j = true;
                dcVar.k = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.8.0", "loc", 3);
                dcVar.l = hashMap2;
                dcVar.f = hashMap;
                dcVar.a(t.a(context));
                dcVar.a(dg.f);
                dcVar.b(dg.f);
                if (dn.k(context)) {
                    dcVar.g = "http://restapi.amap.com/v3/geocode/regeo";
                    b2 = bj.b(dcVar);
                } else {
                    dcVar.g = "http://restapi.amap.com/v3/geocode/regeo".replace("http:", "https:");
                    b2 = bj.a(dcVar);
                }
                return new String(b2, "utf-8");
            }
            hashMap2.remove("language");
            String a3 = n.a();
            String a22 = n.a(context, a3, w.b(hashMap2));
            hashMap2.put("ts", a3);
            hashMap2.put("scode", a22);
            dcVar.b(("output=json&radius=1000&extensions=all&location=" + d2 + "," + d).getBytes("UTF-8"));
            dcVar.m = false;
            dcVar.j = true;
            dcVar.k = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.8.0", "loc", 3);
            dcVar.l = hashMap2;
            dcVar.f = hashMap;
            dcVar.a(t.a(context));
            dcVar.a(dg.f);
            dcVar.b(dg.f);
            if (dn.k(context)) {
            }
            return new String(b2, "utf-8");
        } catch (Throwable unused) {
            return null;
        }
    }

    public final void a(long j, boolean z, int i) {
        try {
            this.e = z;
            try {
                r.a().a(z);
            } catch (Throwable unused) {
            }
            this.d = Long.valueOf(j).intValue();
            this.f = i;
        } catch (Throwable th) {
            dg.a(th, "LocNetManager", "setOption");
        }
    }
}