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


package cs;

import android.content.Context;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.libs.widgetcollect.SlsAllow;
import com.shizhuang.duapp.libs.widgetcollect.sls.ClientConfiguration;
import com.shizhuang.duapp.libs.widgetcollect.sls.LogException;
import com.shizhuang.duapp.libs.widgetcollect.sls.core.callback.CompletedCallback;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.WeakHashMap;
import vr.f;

/* compiled from: DefaultLogClient */
public class d {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: a  reason: collision with root package name */
    public String f31234a;
    public String b;

    /* renamed from: c  reason: collision with root package name */
    public URI f31235c;
    public f d;
    public WeakHashMap<zr.b, CompletedCallback<zr.b, as.b>> e = new WeakHashMap<>();
    public CompletedCallback<zr.b, as.b> f;

    /* renamed from: g  reason: collision with root package name */
    public CompletedCallback<zr.a, as.a> f31236g;

    /* compiled from: DefaultLogClient */
    public class a implements CompletedCallback<zr.b, as.b> {
        public static ChangeQuickRedirect changeQuickRedirect;

        public a() {
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [vr.d, com.shizhuang.duapp.libs.widgetcollect.sls.LogException] */
        @Override // com.shizhuang.duapp.libs.widgetcollect.sls.core.callback.CompletedCallback
        public void onFailure(zr.b bVar, LogException logException) {
            CompletedCallback<zr.b, as.b> completedCallback;
            zr.b bVar2 = bVar;
            if (!PatchProxy.proxy(new Object[]{bVar2, logException}, this, changeQuickRedirect, false, 38013, new Class[]{zr.b.class, LogException.class}, Void.TYPE).isSupported && (completedCallback = d.this.e.get(bVar2)) != null) {
                try {
                    completedCallback.onFailure(bVar2, logException);
                } catch (Exception unused) {
                }
            }
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [vr.d, vr.i] */
        @Override // com.shizhuang.duapp.libs.widgetcollect.sls.core.callback.CompletedCallback
        public void onSuccess(zr.b bVar, as.b bVar2) {
            CompletedCallback<zr.b, as.b> completedCallback;
            zr.b bVar3 = bVar;
            as.b bVar4 = bVar2;
            if (!PatchProxy.proxy(new Object[]{bVar3, bVar4}, this, changeQuickRedirect, false, 38012, new Class[]{zr.b.class, as.b.class}, Void.TYPE).isSupported && (completedCallback = d.this.e.get(bVar3)) != null) {
                try {
                    completedCallback.onSuccess(bVar3, bVar4);
                } catch (Exception unused) {
                }
            }
        }
    }

    /* compiled from: DefaultLogClient */
    public class b implements CompletedCallback<zr.a, as.a> {
        public static ChangeQuickRedirect changeQuickRedirect;

        public b() {
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [vr.d, com.shizhuang.duapp.libs.widgetcollect.sls.LogException] */
        @Override // com.shizhuang.duapp.libs.widgetcollect.sls.core.callback.CompletedCallback
        public void onFailure(zr.a aVar, LogException logException) {
            boolean z = PatchProxy.proxy(new Object[]{aVar, logException}, this, changeQuickRedirect, false, 38015, new Class[]{zr.a.class, LogException.class}, Void.TYPE).isSupported;
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [vr.d, vr.i] */
        @Override // com.shizhuang.duapp.libs.widgetcollect.sls.core.callback.CompletedCallback
        public void onSuccess(zr.a aVar, as.a aVar2) {
            boolean z = PatchProxy.proxy(new Object[]{aVar, aVar2}, this, changeQuickRedirect, false, 38014, new Class[]{zr.a.class, as.a.class}, Void.TYPE).isSupported;
        }
    }

    public d(Context context, String str, wr.a aVar, ClientConfiguration clientConfiguration) {
        try {
            this.b = "http://";
            if (str.trim() != "") {
                this.f31234a = str;
                if (str.startsWith("http://")) {
                    this.f31234a = this.f31234a.substring(7);
                } else if (this.f31234a.startsWith("https://")) {
                    this.f31234a = this.f31234a.substring(8);
                    this.b = "https://";
                }
                while (this.f31234a.endsWith("/")) {
                    String str2 = this.f31234a;
                    this.f31234a = str2.substring(0, str2.length() - 1);
                }
                this.f31235c = new URI(this.b + this.f31234a);
                if (aVar == null) {
                    throw new IllegalArgumentException("CredentialProvider can't be null.");
                } else if (context != null) {
                    this.d = new f(this.f31235c, aVar, clientConfiguration == null ? ClientConfiguration.b() : clientConfiguration);
                    this.f = new a();
                    this.f31236g = new b();
                } else {
                    throw new IllegalArgumentException("context can't be null.");
                }
            } else {
                throw new NullPointerException("endpoint is null");
            }
        } catch (URISyntaxException unused) {
            throw new IllegalArgumentException("Endpoint must be a string like 'http://cn-****.log.aliyuncs.com',or your cname like 'http://image.cnamedomain.com'!");
        }
    }

    public boolean a(String str, String str2) {
        SlsAllow slsAllow;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2}, this, changeQuickRedirect, false, 38011, new Class[]{String.class, String.class}, Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], null, tr.b.changeQuickRedirect, true, 37719, new Class[0], SlsAllow.class);
        if (proxy2.isSupported) {
            slsAllow = (SlsAllow) proxy2.result;
        } else {
            slsAllow = tr.b.f;
        }
        if (slsAllow == null) {
            return true;
        }
        return slsAllow.allowPostLog(str, str2);
    }

    public vr.a<as.a> b(zr.a aVar) throws LogException {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{aVar}, this, changeQuickRedirect, false, 38008, new Class[]{zr.a.class}, vr.a.class);
        return proxy.isSupported ? (vr.a) proxy.result : this.d.f(aVar, this.f31236g);
    }

    public vr.a<as.a> c(zr.a aVar, CompletedCallback<zr.a, as.a> completedCallback) throws LogException {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{aVar, completedCallback}, this, changeQuickRedirect, false, 38007, new Class[]{zr.a.class, CompletedCallback.class}, vr.a.class);
        return proxy.isSupported ? (vr.a) proxy.result : this.d.f(aVar, completedCallback);
    }

    public vr.a<as.b> d(zr.b bVar, CompletedCallback<zr.b, as.b> completedCallback) throws LogException {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{bVar, completedCallback}, this, changeQuickRedirect, false, 38006, new Class[]{zr.b.class, CompletedCallback.class}, vr.a.class);
        if (proxy.isSupported) {
            return (vr.a) proxy.result;
        }
        this.e.put(bVar, completedCallback);
        return this.d.g(bVar, this.f);
    }

    public void finalize() throws Throwable {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 38010, new Class[0], Void.TYPE).isSupported) {
            super.finalize();
        }
    }
}