得物.apk(点击下载) / NetHelper.java


package com.shizhuang.duapp.modules.rn.net;

import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.text.StringsKt__StringsJVMKt;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import retrofit2.Converter;
import retrofit2.Retrofit;

/* compiled from: NetHelper.kt */
public final class NetHelper {

    /* renamed from: a  reason: collision with root package name */
    public static final NetHelper f24769a = new NetHelper();
    public static ChangeQuickRedirect changeQuickRedirect;
    @NotNull
    private static final Lazy imagePipelineConfig$delegate = LazyKt__LazyJVMKt.lazy(NetHelper$imagePipelineConfig$2.INSTANCE);
    @NotNull
    private static final Lazy okHttpClient$delegate = LazyKt__LazyJVMKt.lazy(NetHelper$okHttpClient$2.INSTANCE);
    @NotNull
    private static final Lazy requestService$delegate = LazyKt__LazyJVMKt.lazy(NetHelper$requestService$2.INSTANCE);
    private static final Lazy retrofit$delegate = LazyKt__LazyJVMKt.lazy(NetHelper$retrofit$2.INSTANCE);

    /* compiled from: NetHelper.kt */
    public static final class a extends ProxySelector {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final ProxySelector f24770a = ProxySelector.getDefault();

        public void connectFailed(@Nullable URI uri, @Nullable SocketAddress socketAddress, @Nullable IOException iOException) {
            if (!PatchProxy.proxy(new Object[]{uri, socketAddress, iOException}, this, changeQuickRedirect, false, 312669, new Class[]{URI.class, SocketAddress.class, IOException.class}, Void.TYPE).isSupported) {
                this.f24770a.connectFailed(uri, socketAddress, iOException);
            }
        }

        @Override // java.net.ProxySelector
        @NotNull
        public List<Proxy> select(@Nullable URI uri) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{uri}, this, changeQuickRedirect, false, 312668, new Class[]{URI.class}, List.class);
            if (proxy.isSupported) {
                return (List) proxy.result;
            }
            String valueOf = String.valueOf(uri);
            if (!StringsKt__StringsJVMKt.startsWith$default(valueOf, "https://apk.poizon.com", false, 2, null) && !StringsKt__StringsJVMKt.startsWith$default(valueOf, "https://oversea-apk.poizon.com", false, 2, null)) {
                return this.f24770a.select(uri);
            }
            z0.a.c("not proxy ", valueOf, "NoOSSProxySelector");
            return Collections.singletonList(Proxy.NO_PROXY);
        }
    }

    /* compiled from: NetHelper.kt */
    public static final class b implements ParameterizedType {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final Type b;

        /* renamed from: c  reason: collision with root package name */
        public final Type[] f24771c;

        public b(@NotNull Type type, @NotNull Type[] typeArr) {
            this.b = type;
            this.f24771c = typeArr;
        }

        @NotNull
        public Type[] getActualTypeArguments() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312670, new Class[0], Type[].class);
            return proxy.isSupported ? (Type[]) proxy.result : this.f24771c;
        }

        @Nullable
        public Type getOwnerType() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312672, new Class[0], Type.class);
            if (proxy.isSupported) {
                return (Type) proxy.result;
            }
            return null;
        }

        @NotNull
        public Type getRawType() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312671, new Class[0], Type.class);
            return proxy.isSupported ? (Type) proxy.result : this.b;
        }
    }

    /* compiled from: NetHelper.kt */
    public static final class c extends Converter.Factory {

        /* renamed from: a  reason: collision with root package name */
        public static final a f24772a = new a(null);
        public static ChangeQuickRedirect changeQuickRedirect;

        /* compiled from: NetHelper.kt */
        public static final class a {
            public static ChangeQuickRedirect changeQuickRedirect;

            public a(DefaultConstructorMarker defaultConstructorMarker) {
            }
        }

        /* compiled from: NetHelper.kt */
        public final class b implements Converter<ResponseBody, String> {
            public static ChangeQuickRedirect changeQuickRedirect;

            /* JADX WARN: Incorrect args count in method signature: ()V */
            public b(c cVar) {
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // retrofit2.Converter
            public String convert(ResponseBody responseBody) {
                ResponseBody responseBody2 = responseBody;
                PatchProxyResult proxy = PatchProxy.proxy(new Object[]{responseBody2}, this, changeQuickRedirect, false, 312675, new Class[]{ResponseBody.class}, String.class);
                if (proxy.isSupported) {
                    return (String) proxy.result;
                }
                return responseBody2.string();
            }
        }

        @Override // retrofit2.Converter.Factory
        @Nullable
        public Converter<ResponseBody, ?> responseBodyConverter(@Nullable Type type, @Nullable Annotation[] annotationArr, @Nullable Retrofit retrofit) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{type, annotationArr, retrofit}, this, changeQuickRedirect, false, 312673, new Class[]{Type.class, Annotation[].class, Retrofit.class}, Converter.class);
            if (proxy.isSupported) {
                return (Converter) proxy.result;
            }
            if (type == String.class) {
                return new b(this);
            }
            return null;
        }
    }

    @Nullable
    public final <T> T a(@NotNull String str, @NotNull Type type) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, type}, this, changeQuickRedirect, false, 312665, new Class[]{String.class, Type.class}, Object.class);
        if (proxy.isSupported) {
            return (T) proxy.result;
        }
        Converter<ResponseBody, T> responseBodyConverter = e().responseBodyConverter(type, new Annotation[0]);
        if (responseBodyConverter != null) {
            return responseBodyConverter.convert(ResponseBody.create((MediaType) null, str));
        }
        return null;
    }

    @NotNull
    public final ImagePipelineConfig b() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312662, new Class[0], ImagePipelineConfig.class);
        return (ImagePipelineConfig) (proxy.isSupported ? proxy.result : imagePipelineConfig$delegate.getValue());
    }

    @NotNull
    public final OkHttpClient c() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312661, new Class[0], OkHttpClient.class);
        return (OkHttpClient) (proxy.isSupported ? proxy.result : okHttpClient$delegate.getValue());
    }

    @NotNull
    public final MiniRequestService d() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312664, new Class[0], MiniRequestService.class);
        return (MiniRequestService) (proxy.isSupported ? proxy.result : requestService$delegate.getValue());
    }

    public final Retrofit e() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 312663, new Class[0], Retrofit.class);
        return (Retrofit) (proxy.isSupported ? proxy.result : retrofit$delegate.getValue());
    }

    @NotNull
    public final Type f(@NotNull Type type, @NotNull Type... typeArr) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{type, typeArr}, this, changeQuickRedirect, false, 312666, new Class[]{Type.class, Type[].class}, Type.class);
        return proxy.isSupported ? (Type) proxy.result : new b(type, typeArr);
    }
}