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


package com.shizhuang.duapp.libs.configcenter;

import android.app.Application;
import android.text.TextUtils;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import o5.i;
import okhttp3.OkHttpClient;
import p4.c;
import vj.b;

/* compiled from: ConfigCenterConfig */
public class a {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: a  reason: collision with root package name */
    public Application f8676a;
    public long b;

    /* renamed from: c  reason: collision with root package name */
    public long f8677c;
    public String d;
    public String e;
    public String f;

    /* renamed from: g  reason: collision with root package name */
    public ConfigCache f8678g;

    /* renamed from: h  reason: collision with root package name */
    public ConcurrentHashMap<String, IConfigModule> f8679h = new ConcurrentHashMap<>();
    public ExecutorService i;
    public OkHttpClient j;

    /* renamed from: com.shizhuang.duapp.libs.configcenter.a$a  reason: collision with other inner class name */
    /* compiled from: ConfigCenterConfig */
    public class C0199a implements IConfigModule {
        public static ChangeQuickRedirect changeQuickRedirect;

        public C0199a() {
        }

        @Override // com.shizhuang.duapp.libs.configcenter.IConfigModule
        public String moduleName() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22358, new Class[0], String.class);
            return proxy.isSupported ? (String) proxy.result : "configCenterInterval";
        }

        @Override // com.shizhuang.duapp.libs.configcenter.IConfigModule
        public void onConfigChange(String str) {
            if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 22359, new Class[]{String.class}, Void.TYPE).isSupported) {
                try {
                    a.this.b = Long.valueOf(str).longValue();
                } catch (NumberFormatException unused) {
                    a.this.b = 120;
                }
            }
        }
    }

    public a() {
        h(new C0199a());
    }

    public Application a() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22333, new Class[0], Application.class);
        return proxy.isSupported ? (Application) proxy.result : this.f8676a;
    }

    public ConfigCache b() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22344, new Class[0], ConfigCache.class);
        return proxy.isSupported ? (ConfigCache) proxy.result : this.f8678g;
    }

    public IConfigModule c(String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 22346, new Class[]{String.class}, IConfigModule.class);
        return proxy.isSupported ? (IConfigModule) proxy.result : this.f8679h.get(str);
    }

    public ExecutorService d() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22336, new Class[0], ExecutorService.class);
        if (proxy.isSupported) {
            return (ExecutorService) proxy.result;
        }
        if (this.i == null) {
            this.i = c.g("​com.shizhuang.duapp.libs.configcenter.ConfigCenterConfig");
        }
        return this.i;
    }

    public String e() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22332, new Class[0], String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        if (TextUtils.isEmpty(this.d) && !TextUtils.isEmpty(this.e)) {
            this.d = String.format("https://client-log.poizon.com/wireless/config/%s.json", this.e);
        }
        return this.d;
    }

    public String f() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22335, new Class[0], String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        if (TextUtils.isEmpty(this.f)) {
            this.f = "duapp-config-android";
        }
        return this.f;
    }

    public float g() {
        float f12;
        Class cls = Float.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 22356, new Class[0], cls);
        if (proxy.isSupported) {
            return ((Float) proxy.result).floatValue();
        }
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{this, "random"}, null, b.changeQuickRedirect, true, 22362, new Class[]{a.class, String.class}, cls);
        if (proxy2.isSupported) {
            f12 = ((Float) proxy2.result).floatValue();
        } else if (b() != null) {
            f12 = b().getFloat("random", i.f36333a);
        } else {
            f12 = a().getSharedPreferences(f(), 0).getFloat("random", i.f36333a);
        }
        if (f12 == i.f36333a) {
            PatchProxyResult proxy3 = PatchProxy.proxy(new Object[]{new Float((float) i.f36333a), new Float(1.0f)}, null, changeQuickRedirect, true, 22357, new Class[]{cls, cls}, cls);
            if (proxy3.isSupported) {
                f12 = ((Float) proxy3.result).floatValue();
            } else {
                f12 = (new Random().nextFloat() * 1.0f) + i.f36333a;
            }
            if (!PatchProxy.proxy(new Object[]{this, "random", new Float(f12)}, null, b.changeQuickRedirect, true, 22363, new Class[]{a.class, String.class, cls}, Void.TYPE).isSupported) {
                if (b() != null) {
                    b().putFloat("random", f12);
                } else {
                    a().getSharedPreferences(f(), 0).edit().putFloat("random", f12).apply();
                }
            }
        }
        return f12;
    }

    public void h(IConfigModule iConfigModule) {
        if (!PatchProxy.proxy(new Object[]{iConfigModule}, this, changeQuickRedirect, false, 22347, new Class[]{IConfigModule.class}, Void.TYPE).isSupported) {
            this.f8679h.put(iConfigModule.moduleName(), iConfigModule);
        }
    }
}