导航菜单

页面标题

页面副标题

Mint v5.7.3 - b.java 源代码

正在查看: Mint v5.7.3 应用的 b.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package ve;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.taboola.android.global_components.gueh.TBLGlobalUncaughtExceptionHandler;
import com.taboola.android.global_components.network.TBLNetworkManager;
import com.taboola.android.utils.TBLSdkDetailsHelper;
import com.taboola.android.utils.g;
import com.taboola.android.utils.m;
import com.taboola.lightnetwork.protocols.http.HttpError;
import com.taboola.lightnetwork.protocols.http.HttpManager;
import com.taboola.lightnetwork.protocols.http.HttpResponse;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.UUID;
import org.json.JSONException;
import org.json.JSONObject;

public class b {
    private TBLNetworkManager a;
    private Context b = re.c.b().a();
    private JSONObject c;
    private boolean d;

    class a implements c {
        final TBLGlobalUncaughtExceptionHandler a;
        final we.b b;

        a(TBLGlobalUncaughtExceptionHandler tBLGlobalUncaughtExceptionHandler, we.b bVar) {
            this.a = tBLGlobalUncaughtExceptionHandler;
            this.b = bVar;
        }

        @Override
        public void a(HttpResponse httpResponse) {
            b.this.l();
            b.this.k(this.a, this.b);
        }

        @Override
        public void b(ve.a aVar) {
            g.b("ConfigManager", "TaboolaImpl | internalGlobalInit | TaboolaConfigResponse error: " + aVar);
        }
    }

    class C0218b implements HttpManager.NetworkResponse {
        final c a;

        C0218b(c cVar) {
            this.a = cVar;
        }

        @Override
        public void onError(HttpError httpError) {
            c cVar = this.a;
            if (cVar != null) {
                cVar.b(new ve.a(httpError.mMessage));
            }
        }

        @Override
        public void onResponse(HttpResponse httpResponse) {
            try {
                new JSONObject(httpResponse.mMessage);
                b.this.p(httpResponse.mMessage);
                c cVar = this.a;
                if (cVar != null) {
                    cVar.a(httpResponse);
                }
            } catch (JSONException e) {
                b.this.p(BuildConfig.FLAVOR);
                c cVar2 = this.a;
                if (cVar2 != null) {
                    cVar2.b(new ve.a(e.getMessage()));
                }
            }
        }
    }

    public b(TBLNetworkManager tBLNetworkManager, TBLGlobalUncaughtExceptionHandler tBLGlobalUncaughtExceptionHandler, we.b bVar) {
        this.a = tBLNetworkManager;
        c(new a(tBLGlobalUncaughtExceptionHandler, bVar));
    }

    private String a(String str, String str2) throws Exception {
        try {
            if (TextUtils.isEmpty(str)) {
                throw new Exception("Unable to create configuration URL");
            }
            return String.format("https://cdn.taboola.com/mobile-config/%s/confV1_0/taboolaConfig.json?ui=%s&appv=%s&sdkv=%s&osv=%s", str, n(str2), Uri.encode(TBLSdkDetailsHelper.getAppVersion(this.b)), Uri.encode("3.6.3"), Uri.encode(Build.VERSION.RELEASE));
        } catch (Exception unused) {
            throw new Exception("Unable to create configuration URL");
        }
    }

    private void b() {
        c(null);
    }

    private void c(c cVar) {
        String j = m.j(this.b);
        if (TextUtils.isEmpty(j)) {
            g.a("ConfigManager", "getConfigFromRemote | publisher is N/A. Will not fetch configuration.");
            return;
        }
        g.a("ConfigManager", "getConfigFromRemote | publisher = " + j);
        HttpManager httpManager = this.a.getHttpManager();
        String k = m.k(this.b);
        if (TextUtils.isEmpty(k)) {
            k = UUID.randomUUID().toString();
            m.S(this.b, k);
        }
        try {
            String a2 = a(j, k);
            g.a("ConfigManager", "getConfigFromRemote: " + a2);
            httpManager.get(a2, new C0218b(cVar));
        } catch (Exception e) {
            if (cVar != null) {
                cVar.b(new ve.a(e.getMessage()));
            }
        }
    }

    private boolean m(boolean z) {
        if (this.d) {
            g.a("ConfigManager", "Someone already used a value from ConfigManager, not loading new configuration.");
            return false;
        }
        if (z || this.c == null) {
            String i = m.i(this.b);
            if (TextUtils.isEmpty(i)) {
                g.b("ConfigManager", "Cached configuration is empty");
                return false;
            }
            this.c = o(i);
        }
        return this.c != null;
    }

    private String n(String str) {
        if (TextUtils.isEmpty(str)) {
            return BuildConfig.FLAVOR;
        }
        if (str.length() < 3) {
            return str;
        }
        return "tci" + str.substring(3);
    }

    @Nullable
    private JSONObject o(String str) {
        try {
            return new JSONObject(str).optJSONObject("taboolaConfig");
        } catch (NullPointerException e) {
            Log.e("ConfigManager", "parseJson | NullPointerException: " + e.getMessage());
            return null;
        } catch (JSONException e2) {
            Log.e("ConfigManager", "parseJson | JSONException: " + e2.getMessage());
            return null;
        } catch (Exception e3) {
            Log.e("ConfigManager", "parseJson | error: " + e3.getMessage());
            return null;
        }
    }

    public int d(String str, int i) {
        return Integer.valueOf(g(null, str, String.valueOf(i))).intValue();
    }

    public long e(String str, long j) {
        return Long.parseLong(g(null, str, String.valueOf(j)));
    }

    public String f(String str, String str2) {
        return g(null, str, str2);
    }

    public String g(String str, String str2, String str3) {
        this.d = true;
        try {
            JSONObject jSONObject = this.c;
            if (jSONObject != null) {
                JSONObject optJSONObject = str != null ? jSONObject.optJSONObject(str) : null;
                if (optJSONObject != null) {
                    String optString = optJSONObject.optString(str2, null);
                    if (!TextUtils.isEmpty(optString)) {
                        return optString;
                    }
                }
                JSONObject optJSONObject2 = this.c.optJSONObject("placementDefault");
                if (optJSONObject2 != null) {
                    return optJSONObject2.optString(str2, str3);
                }
            }
            return str3;
        } catch (Exception e) {
            Log.e("ConfigManager", "getConfigValue | error: " + e.getMessage());
            return str3;
        }
    }

    public boolean h(String str, String str2, boolean z) {
        return Boolean.parseBoolean(g(str, str2, String.valueOf(z)));
    }

    public boolean i(String str, boolean z) {
        return h(null, str, z);
    }

    @Nullable
    public String j() {
        JSONObject jSONObject = this.c;
        if (jSONObject == null) {
            return null;
        }
        try {
            return jSONObject.toString();
        } catch (Exception e) {
            g.b("ConfigManager", "getConfigurationAsJsonString | " + e.getMessage());
            return BuildConfig.FLAVOR;
        }
    }

    public void k(TBLGlobalUncaughtExceptionHandler tBLGlobalUncaughtExceptionHandler, we.b bVar) {
        if (tBLGlobalUncaughtExceptionHandler != null) {
            tBLGlobalUncaughtExceptionHandler.g(i("setGUEH", true));
        } else {
            g.b("ConfigManager", "Trying to setup GUEH but it's null.");
        }
        if (bVar == null) {
            g.b("ConfigManager", "Trying to setup EventsManager, but it's null.");
        } else {
            bVar.h(i("eventsManagerEnable", true));
            bVar.g(d("eventsManagerMaxQueue", bVar.c()));
        }
    }

    public boolean l() {
        return m(false);
    }

    void p(String str) {
        g.a("ConfigManager", str);
        m.L(this.b, str);
    }

    public void q(String str, String str2) {
        r(null, str, str2);
    }

    public void r(String str, String str2, String str3) {
        try {
            if (this.c == null) {
                this.c = new JSONObject();
            }
            if (TextUtils.isEmpty(str)) {
                JSONObject optJSONObject = this.c.optJSONObject("placementUnknown");
                if (optJSONObject == null) {
                    optJSONObject = new JSONObject();
                }
                optJSONObject.put(str2, str3);
                this.c.put("placementUnknown", optJSONObject);
                return;
            }
            JSONObject optJSONObject2 = this.c.optJSONObject(str);
            if (optJSONObject2 == null) {
                optJSONObject2 = new JSONObject();
            }
            optJSONObject2.put(str2, str3);
            this.c.put(str, optJSONObject2);
        } catch (Exception e) {
            Log.e("ConfigManager", "set | Error: " + e.getMessage());
        }
    }

    public void s(String str, String str2, boolean z) {
        r(str, str2, String.valueOf(z));
    }

    public void t(String str, boolean z) {
        q(str, String.valueOf(z));
    }

    public void u(String str) {
        String j = m.j(this.b);
        if (TextUtils.isEmpty(j)) {
            j = BuildConfig.FLAVOR;
        }
        if (TextUtils.isEmpty(str) || str.equals(j)) {
            return;
        }
        m.R(this.b, str);
        b();
    }
}