汇多多.apk(点击下载) / fe.java


package com.loc;

import android.content.Context;
import com.amap.api.maps.AMap;
import com.loc.bl;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.util.net.NetWork;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/* compiled from: LocNetManager */
public final class fe {
    private static fe b;
    bg a = null;
    private Context c = null;
    private int d = fj.i;
    private boolean e = false;
    private int f = 0;

    private fe(Context context) {
        try {
            q.a().a(context);
        } catch (Throwable unused) {
        }
        this.c = context;
        this.a = bg.a();
    }

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

    public final bm a(ff ffVar) throws Throwable {
        if (this.e) {
            ffVar.a(bl.c.HTTPS);
        }
        return bg.a(ffVar);
    }

    /* JADX WARNING: Removed duplicated region for block: B:22:0x0101  */
    /* JADX WARNING: Removed duplicated region for block: B:27:? A[RETURN, SYNTHETIC] */
    public final ff a(Context context, byte[] bArr, String str, String str2, boolean z) {
        String str3;
        try {
            HashMap hashMap = new HashMap(16);
            ff ffVar = new ff(context, fj.c());
            try {
                hashMap.put(NetWork.CONTENT_TYPE, "application/octet-stream");
                hashMap.put("Accept-Encoding", "gzip");
                hashMap.put("gzipped", "1");
                hashMap.put("Connection", "Keep-Alive");
                hashMap.put(IWebview.USER_AGENT, "AMAP_Location_SDK_Android 6.0.1");
                hashMap.put("KEY", l.f(context));
                hashMap.put("enginever", fj.a);
                String a2 = n.a();
                String a3 = n.a(context, a2, "key=" + l.f(context));
                hashMap.put("ts", a2);
                hashMap.put("scode", a3);
                if (Double.valueOf(fj.a).doubleValue() >= 5.3d) {
                    hashMap.put("aps_s_src", "openapi");
                }
                hashMap.put("encr", "1");
                ffVar.b(hashMap);
                String str4 = "loc";
                if (!z) {
                    str4 = "locf";
                }
                ffVar.c(true);
                ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", str4, 3));
                ffVar.b(z);
                ffVar.c(str);
                ffVar.d(str2);
                ffVar.c(fq.a(bArr));
                ffVar.a(v.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) {
                        str3 = "language:cn";
                    } else if (i == 2) {
                        str3 = "language:en";
                    }
                    hashMap2.put(AMap.CUSTOM, str3);
                    ffVar.a((Map<String, String>) hashMap2);
                    ffVar.a(this.d);
                    ffVar.b(this.d);
                    if (this.e) {
                        return ffVar;
                    }
                    ffVar.a(bl.c.HTTPS);
                    return ffVar;
                }
                hashMap2.remove(AMap.CUSTOM);
                ffVar.a((Map<String, String>) hashMap2);
                ffVar.a(this.d);
                ffVar.b(this.d);
                if (this.e) {
                }
            } catch (Throwable unused) {
                return ffVar;
            }
        } catch (Throwable unused2) {
            return null;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x0060  */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x0063  */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x00e5 A[Catch:{ all -> 0x00f8 }] */
    public final String a(Context context, double d2, double d3) {
        String str;
        try {
            HashMap hashMap = new HashMap(16);
            ff ffVar = new ff(context, fj.c());
            hashMap.clear();
            hashMap.put(NetWork.CONTENT_TYPE, "application/x-www-form-urlencoded");
            hashMap.put("Connection", "Keep-Alive");
            hashMap.put(IWebview.USER_AGENT, "AMAP_Location_SDK_Android 6.0.1");
            HashMap hashMap2 = new HashMap(16);
            hashMap2.put(AMap.CUSTOM, "26260A1F00020002");
            hashMap2.put(IApp.ConfigProperty.CONFIG_KEY, l.f(context));
            int i = this.f;
            if (i != 0) {
                if (i == 1) {
                    str = "zh-CN";
                } else if (i == 2) {
                    str = "en";
                }
                hashMap2.put("language", str);
                hashMap2.put("curLocationType", !fq.m(this.c) ? "coarseLoc" : "fineLoc");
                String a2 = n.a();
                String a3 = n.a(context, a2, x.b(hashMap2));
                hashMap2.put("ts", a2);
                hashMap2.put("scode", a3);
                ffVar.b(("output=json&radius=1000&extensions=all&location=" + d3 + "," + d2).getBytes("UTF-8"));
                ffVar.c(false);
                ffVar.b(true);
                ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", "loc", 3));
                ffVar.a((Map<String, String>) hashMap2);
                ffVar.b(hashMap);
                ffVar.a(v.a(context));
                ffVar.a(fj.i);
                ffVar.b(fj.i);
                ffVar.d("http://dualstack-arestapi.amap.com/v3/geocode/regeo");
                ffVar.c("http://restsdk.amap.com/v3/geocode/regeo");
                if (this.e) {
                    ffVar.a(bl.c.HTTPS);
                }
                return new String(bg.a(ffVar).a, "utf-8");
            }
            hashMap2.remove("language");
            hashMap2.put("curLocationType", !fq.m(this.c) ? "coarseLoc" : "fineLoc");
            String a22 = n.a();
            String a32 = n.a(context, a22, x.b(hashMap2));
            hashMap2.put("ts", a22);
            hashMap2.put("scode", a32);
            ffVar.b(("output=json&radius=1000&extensions=all&location=" + d3 + "," + d2).getBytes("UTF-8"));
            ffVar.c(false);
            ffVar.b(true);
            ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", "loc", 3));
            ffVar.a((Map<String, String>) hashMap2);
            ffVar.b(hashMap);
            ffVar.a(v.a(context));
            ffVar.a(fj.i);
            ffVar.b(fj.i);
            try {
                ffVar.d("http://dualstack-arestapi.amap.com/v3/geocode/regeo");
                ffVar.c("http://restsdk.amap.com/v3/geocode/regeo");
                if (this.e) {
                }
                return new String(bg.a(ffVar).a, "utf-8");
            } catch (Throwable th) {
                fj.a(th, "LocNetManager", "post");
                return null;
            }
        } catch (Throwable unused) {
            return null;
        }
    }

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