最右.apk(点击下载) / APIEngine.java


package cn.xiaochuankeji.interaction.sdk.api;

import androidx.exifinterface.media.ExifInterface;
import cn.xiaochuankeji.hermes.core.provider.DeviceInfoProvider;
import cn.xiaochuankeji.interaction.sdk.InteractionSdk;
import cn.xiaochuankeji.interaction.sdk.api.converter.InteractionGsonConverterFactory;
import com.google.gson.Gson;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import defpackage.dy5;
import java.security.SecureRandom;
import java.util.HashMap;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.OkHttpClient;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0000\u0018\u0000 )2\u00020\u0001:\u0001)B\u001f\u0012\u0006\u0010#\u001a\u00020!\u0012\u0006\u0010&\u001a\u00020$\u0012\u0006\u0010 \u001a\u00020\u001d¢\u0006\u0004\b'\u0010(J+\u0010\u0007\u001a\u00028\u0000\"\u0004\b\u0000\u0010\u00022\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u00032\b\b\u0002\u0010\u0006\u001a\u00020\u0005¢\u0006\u0004\b\u0007\u0010\bJ\u000f\u0010\n\u001a\u00020\tH\u0002¢\u0006\u0004\b\n\u0010\u000bJ\u0017\u0010\u000e\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\tH\u0002¢\u0006\u0004\b\u000e\u0010\u000fJ\u0017\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0006\u001a\u00020\u0005H\u0002¢\u0006\u0004\b\u0011\u0010\u0012R2\u0010\u0016\u001a\u001e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00100\u0013j\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u0010`\u00148\u0002@\u0002X‚\u0004¢\u0006\u0006\n\u0004\b\u000e\u0010\u0015R%\u0010\u001c\u001a\n \u0018*\u0004\u0018\u00010\u00170\u00178B@\u0002X‚„\u0002¢\u0006\f\n\u0004\b\u0011\u0010\u0019\u001a\u0004\b\u001a\u0010\u001bR\u0016\u0010 \u001a\u00020\u001d8\u0002@\u0002X‚\u0004¢\u0006\u0006\n\u0004\b\u001e\u0010\u001fR\u0016\u0010#\u001a\u00020!8\u0002@\u0002X‚\u0004¢\u0006\u0006\n\u0004\b\n\u0010\"R\u0016\u0010&\u001a\u00020$8\u0002@\u0002X‚\u0004¢\u0006\u0006\n\u0004\b\u001a\u0010%¨\u0006*"}, d2 = {"Lcn/xiaochuankeji/interaction/sdk/api/APIEngine;", "", ExifInterface.GPS_DIRECTION_TRUE, "Ljava/lang/Class;", "serviceClass", "", "baseUrl", "createService", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;", "Ljavax/net/ssl/X509TrustManager;", "c", "()Ljavax/net/ssl/X509TrustManager;", "trustManager", "Ljavax/net/ssl/SSLSocketFactory;", "b", "(Ljavax/net/ssl/X509TrustManager;)Ljavax/net/ssl/SSLSocketFactory;", "Ldy5;", "a", "(Ljava/lang/String;)Ldy5;", "Ljava/util/HashMap;", "Lkotlin/collections/HashMap;", "Ljava/util/HashMap;", "retrofitMap", "Lokhttp3/OkHttpClient;", "kotlin.jvm.PlatformType", "Lkotlin/Lazy;", "d", "()Lokhttp3/OkHttpClient;", "httpClient", "Lcn/xiaochuankeji/hermes/core/provider/DeviceInfoProvider;", "e", "Lcn/xiaochuankeji/hermes/core/provider/DeviceInfoProvider;", "deviceInfoProvider", "Lcom/google/gson/Gson;", "Lcom/google/gson/Gson;", "gson", "Lcn/xiaochuankeji/interaction/sdk/InteractionSdk;", "Lcn/xiaochuankeji/interaction/sdk/InteractionSdk;", "sdk", "<init>", "(Lcom/google/gson/Gson;Lcn/xiaochuankeji/interaction/sdk/InteractionSdk;Lcn/xiaochuankeji/hermes/core/provider/DeviceInfoProvider;)V", "Companion", "sdk_release"}, k = 1, mv = {1, 4, 1})
public final class APIEngine {
    public static final Companion Companion = new Companion(null);
    public static final String STAT_HOST = "https://adstat.izuiyou.com";
    public static ChangeQuickRedirect changeQuickRedirect;
    public static final String f = (InteractionSdk.INSTANCE.isDebugServer$sdk_release() ? "https://test.izuiyou.com" : "https://adapi.izuiyou.com");

    /* renamed from: a  reason: collision with root package name */
    public final Lazy f3447a = LazyKt__LazyJVMKt.lazy(new APIEngine$httpClient$2(this));

    /* renamed from: b  reason: collision with root package name */
    public final HashMap<String, dy5> f3448b;
    public final Gson c;
    public final InteractionSdk d;
    public final DeviceInfoProvider e;

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\b\b€\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\b\u0010\tR\u0019\u0010\u0003\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006R\u0016\u0010\u0007\u001a\u00020\u00028\u0006@\u0006X†T¢\u0006\u0006\n\u0004\b\u0007\u0010\u0004¨\u0006\n"}, d2 = {"Lcn/xiaochuankeji/interaction/sdk/api/APIEngine$Companion;", "", "", "HOST", "Ljava/lang/String;", "getHOST", "()Ljava/lang/String;", "STAT_HOST", "<init>", "()V", "sdk_release"}, k = 1, mv = {1, 4, 1})
    public static final class Companion {
        public static ChangeQuickRedirect changeQuickRedirect;

        public Companion() {
        }

        public final String getHOST() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 8241, new Class[0], String.class);
            return proxy.isSupported ? (String) proxy.result : APIEngine.f;
        }

        public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public APIEngine(Gson gson, InteractionSdk interactionSdk, DeviceInfoProvider deviceInfoProvider) {
        Intrinsics.checkNotNullParameter(gson, "gson");
        Intrinsics.checkNotNullParameter(interactionSdk, "sdk");
        Intrinsics.checkNotNullParameter(deviceInfoProvider, "deviceInfoProvider");
        this.c = gson;
        this.d = interactionSdk;
        this.e = deviceInfoProvider;
        String str = f;
        this.f3448b = MapsKt__MapsKt.hashMapOf(TuplesKt.to(str, a(str)));
    }

    public static final /* synthetic */ SSLSocketFactory access$createSSLSocketFactory(APIEngine aPIEngine, X509TrustManager x509TrustManager) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{aPIEngine, x509TrustManager}, null, changeQuickRedirect, true, 8240, new Class[]{APIEngine.class, X509TrustManager.class}, SSLSocketFactory.class);
        return proxy.isSupported ? (SSLSocketFactory) proxy.result : aPIEngine.b(x509TrustManager);
    }

    public static final /* synthetic */ X509TrustManager access$createTrustManager(APIEngine aPIEngine) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{aPIEngine}, null, changeQuickRedirect, true, 8239, new Class[]{APIEngine.class}, X509TrustManager.class);
        return proxy.isSupported ? (X509TrustManager) proxy.result : aPIEngine.c();
    }

    public static final /* synthetic */ InteractionSdk access$getSdk$p(APIEngine aPIEngine) {
        return aPIEngine.d;
    }

    public static /* synthetic */ Object createService$default(APIEngine aPIEngine, Class cls, String str, int i, Object obj) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{aPIEngine, cls, str, new Integer(i), obj}, null, changeQuickRedirect, true, 8238, new Class[]{APIEngine.class, Class.class, String.class, Integer.TYPE, Object.class}, Object.class);
        if (proxy.isSupported) {
            return proxy.result;
        }
        if ((i & 2) != 0) {
            str = f;
        }
        return aPIEngine.createService(cls, str);
    }

    public final dy5 a(String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 8236, new Class[]{String.class}, dy5.class);
        if (proxy.isSupported) {
            return (dy5) proxy.result;
        }
        dy5.b bVar = new dy5.b();
        bVar.c(str);
        bVar.g(d());
        bVar.b(InteractionGsonConverterFactory.Companion.create(this.c, this.d, this.e));
        bVar.a(vy5.d());
        dy5 e2 = bVar.e();
        Intrinsics.checkNotNullExpressionValue(e2, "Retrofit.Builder()\n     …e())\n            .build()");
        return e2;
    }

    public final SSLSocketFactory b(X509TrustManager x509TrustManager) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{x509TrustManager}, this, changeQuickRedirect, false, 8235, new Class[]{X509TrustManager.class}, SSLSocketFactory.class);
        if (proxy.isSupported) {
            return (SSLSocketFactory) proxy.result;
        }
        SSLContext instance = SSLContext.getInstance("TLS");
        instance.init(null, new X509TrustManager[]{x509TrustManager}, new SecureRandom());
        Intrinsics.checkNotNullExpressionValue(instance, "sc");
        SSLSocketFactory socketFactory = instance.getSocketFactory();
        Intrinsics.checkNotNullExpressionValue(socketFactory, "sc.socketFactory");
        return socketFactory;
    }

    public final X509TrustManager c() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 8234, new Class[0], X509TrustManager.class);
        return proxy.isSupported ? (X509TrustManager) proxy.result : new APIEngine$createTrustManager$1();
    }

    public final <T> T createService(Class<T> cls, String str) {
        T t;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{cls, str}, this, changeQuickRedirect, false, 8237, new Class[]{Class.class, String.class}, Object.class);
        if (proxy.isSupported) {
            return (T) proxy.result;
        }
        Intrinsics.checkNotNullParameter(cls, "serviceClass");
        Intrinsics.checkNotNullParameter(str, "baseUrl");
        dy5 dy5 = this.f3448b.get(str);
        if (dy5 != null && (t = (T) dy5.c(cls)) != null) {
            return t;
        }
        dy5 a2 = a(str);
        this.f3448b.put(str, a2);
        return (T) a2.c(cls);
    }

    public final OkHttpClient d() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 8233, new Class[0], OkHttpClient.class);
        return (OkHttpClient) (proxy.isSupported ? proxy.result : this.f3447a.getValue());
    }
}