导航菜单

页面标题

页面副标题

Mint v5.7.3 - TBLNativeUnitInternal.java 源代码

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

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


package com.taboola.android.tblnative;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Messenger;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Keep;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import com.taboola.android.TBLPublisherInfo;
import com.taboola.android.Taboola;
import com.taboola.android.global_components.advertisingid.TBLAdvertisingIdInfo;
import com.taboola.android.global_components.eventsmanager.TBLEventType;
import com.taboola.android.global_components.eventsmanager.TBLSessionInfo;
import com.taboola.android.global_components.eventsmanager.events.TBLMobileEvent;
import com.taboola.android.global_components.monitor.TBLUrlParamsChange;
import com.taboola.android.global_components.network.TBLNetworkManager;
import com.taboola.android.global_components.network.handlers.TBLRecommendationsHandler;
import com.taboola.android.h;
import com.taboola.android.listeners.TBLNativeListener;
import com.taboola.android.utils.TBLOnClickHelper;
import com.taboola.android.utils.TBLSdkDetailsHelper;
import com.taboola.android.utils.g;
import com.taboola.android.utils.i;
import com.taboola.android.utils.l;
import com.taboola.lightnetwork.protocols.http.HttpError;
import com.taboola.lightnetwork.protocols.http.HttpResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.TimeZone;
import java.util.UUID;
import org.json.JSONObject;

@Keep
public class TBLNativeUnitInternal {
    private static final String ADDITIONAL_DATA = "additional_data";
    private static final String API_KEY = "apiKey";
    private static final String API_PARAMS = "mApiParams";
    private static final String BASE_URL = "://api.taboola.com/1.2/json/";
    private static final String DEVICE = "device";
    private static final String EVENT = "event";
    private static final String EVENT_DATA = "event.data";
    private static final String HTTPS_PREFIX = "https";
    private static final String HTTP_PREFIX = "http";
    private static final String IS_ENABLED_FULL_RAW_DATA_RESPONSE = "mIsEnabledFullRawDataResponse";
    private static final String IS_ENABLED_RAW_DATA_RESPONSE = "mIsEnabledRawDataResponse";
    private static final String MOBILE = "mobile";
    private static final String MOBILE_INIT = "mobileInit";
    private static final String PUBLISHER_NAME = "PublisherId";
    private static final String REQUEST_ID_KEY = "req_id";
    private static final String SHOULD_ALLOW_NON_ORGANIC_CLICK_OVERRIDE = "mShouldAllowNonOrganicClickOverride";
    private static final String TAG = "TBPublisherApi";
    private static final String TIMESTAMP = "timestamp";
    private static final String USE_HTTP = "mUseHttp";
    private String apiKey;
    private Context mApplicationContext;
    private SimpleDateFormat mDefaultSdf;
    private int mOnClickIgnoreTimeMs;
    private String mPublisherName;
    private SimpleDateFormat mReportEventDateFormat;
    private Map<String, TBLRecommendationsRequest> mRequestMap;
    private TBLAdvertisingIdInfo mTBLAdvertisingIdInfo;
    private ve.b mTBLConfigManager;
    private com.taboola.android.global_components.monitor.a mTBLMonitorHelper;
    private com.taboola.android.tblnative.b mTBLNativeGlobalEPs;
    private TBLNativeListener mTBLNativeListener;
    private TBLNetworkManager mTBLNetworkManager;
    private TBLPublisherInfo mTBLPublisherInfo;
    private TBLRecommendationsHandler mTBLRecommendationsHandler;
    private Handler mUiHandler;
    private HashMap<String, String> mUnrecognizedExtraProperties;
    private Handler mVisibilityMonitoringHandler;

    class a implements Runnable {
        a() {
        }

        @Override
        public void run() {
            TBLNativeUnitInternal.this.sendBridgeToKibana();
        }
    }

    class b implements TBLAdvertisingIdInfo.AdvertisingIdCallback {
        final TBLRecommendationsRequest a;
        final TBLRecommendationRequestCallback b;

        b(TBLRecommendationsRequest tBLRecommendationsRequest, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
            this.a = tBLRecommendationsRequest;
            this.b = tBLRecommendationRequestCallback;
        }

        @Override
        public void onIdRetrieved(String str) {
            this.a.setDeviceId(str);
            TBLNativeUnitInternal.this.actuallyFetchRecommendations(this.a, this.b);
        }

        @Override
        public void onIdUnavailable() {
            TBLNativeUnitInternal.this.actuallyFetchRecommendations(this.a, this.b);
        }
    }

    class c implements TBLRecommendationsHandler.c {
        final String a;
        final TBLRecommendationRequestCallback b;

        c(String str, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
            this.a = str;
            this.b = tBLRecommendationRequestCallback;
        }

        @Override
        public void a(HttpError httpError, String str) {
            TBLNativeUnitInternal.this.mTBLMonitorHelper.m(TBLNativeUnitInternal.this.mUiHandler, str);
            TBLNativeUnitInternal.this.notifyRecommendationFailed(this.b, new Throwable(httpError.toString()));
        }

        @Override
        public void b(HttpResponse httpResponse, String str) {
            g.a(TBLNativeUnitInternal.TAG, "request url : " + str);
            TBLNativeUnitInternal.this.mTBLMonitorHelper.m(TBLNativeUnitInternal.this.mUiHandler, str);
            try {
                TBLNativeUnitInternal.this.onSuccessfulResponse(httpResponse.mMessage, this.a, this.b);
            } catch (Exception e) {
                TBLNativeUnitInternal.this.notifyRecommendationFailed(this.b, new Throwable(e.getMessage()));
            }
        }
    }

    class d implements Runnable {
        final TBLPlacement a;
        final TBLRecommendationsRequest b;

        d(TBLPlacement tBLPlacement, TBLRecommendationsRequest tBLRecommendationsRequest) {
            this.a = tBLPlacement;
            this.b = tBLRecommendationsRequest;
        }

        @Override
        public void run() {
            Messenger messenger = new Messenger(this.a.getApiMonitorHandler());
            h d = TBLNativeUnitInternal.this.mTBLMonitorHelper.d();
            d.j(this.a.getId(), this.a.getName(), messenger);
            d.i(this.a.getId(), TBLNativeUnitInternal.this.generateMonitorDebugParams(this.b));
        }
    }

    static class e {
        static final int[] a;

        static {
            int[] iArr = new int[com.taboola.android.utils.c.values().length];
            a = iArr;
            try {
                iArr[com.taboola.android.utils.c.UNRECOGNIZABLE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
        }
    }

    TBLNativeUnitInternal(TBLNetworkManager tBLNetworkManager, ve.b bVar, com.taboola.android.global_components.monitor.a aVar, TBLAdvertisingIdInfo tBLAdvertisingIdInfo) {
        this.mOnClickIgnoreTimeMs = 300;
        this.mVisibilityMonitoringHandler = new Handler(Looper.getMainLooper());
        this.mRequestMap = new HashMap();
        this.mTBLNativeGlobalEPs = Taboola.getTaboolaImpl().getNativeGlobalEPs();
        this.mTBLNetworkManager = tBLNetworkManager;
        this.mTBLConfigManager = bVar;
        this.mTBLAdvertisingIdInfo = tBLAdvertisingIdInfo;
        this.mApplicationContext = re.c.b().a();
        this.mTBLRecommendationsHandler = tBLNetworkManager.getRecommendationsHandler();
        this.mTBLMonitorHelper = aVar;
        this.mUnrecognizedExtraProperties = new HashMap<>();
        createDataFormat();
    }

    TBLNativeUnitInternal(TBLNetworkManager tBLNetworkManager, ve.b bVar, com.taboola.android.global_components.monitor.a aVar, String str, TBLAdvertisingIdInfo tBLAdvertisingIdInfo) {
        this(tBLNetworkManager, bVar, aVar, tBLAdvertisingIdInfo);
        this.mPublisherName = str;
    }

    public void actuallyFetchRecommendations(TBLRecommendationsRequest tBLRecommendationsRequest, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
        if (Taboola.getTaboolaImpl().isKillSwitchEnabled(null)) {
            notifyRecommendationFailed(tBLRecommendationRequestCallback, new Throwable("INTERNAL_1"));
            g.b(TAG, "fetchContent | INTERNAL_1");
            return;
        }
        Map<String, String> b2 = this.mTBLNativeGlobalEPs.b();
        if (b2 == null) {
            b2 = new HashMap<>();
        }
        b2.put("user.opt_out", this.mTBLAdvertisingIdInfo.i() ? "true" : "false");
        this.mTBLNativeGlobalEPs.m(b2);
        for (String str : b2.keySet()) {
            tBLRecommendationsRequest.putApiParam(str, b2.get(str));
        }
        String uuid = UUID.randomUUID().toString();
        this.mTBLRecommendationsHandler.performRequest(this.mTBLNativeGlobalEPs.g(), this.mPublisherName, getFetchRecommendationsParams(tBLRecommendationsRequest, uuid), TBLRecommendationsHandler.RECOMMENDATIONS_NOTIFY_MULTIPLE_GET, new c(uuid, tBLRecommendationRequestCallback));
    }

    private void addCcpaInfo(@NonNull TBLRecommendationsRequest tBLRecommendationsRequest) {
        String a2 = com.taboola.android.utils.b.a(this.mApplicationContext);
        if (TextUtils.isEmpty(a2)) {
            return;
        }
        tBLRecommendationsRequest.setCcpaPrivacyString(a2);
    }

    private void addGdprInfo(TBLRecommendationsRequest tBLRecommendationsRequest) {
        String str;
        String str2;
        String str3;
        if (com.taboola.android.utils.d.b(this.mApplicationContext)) {
            str = com.taboola.android.utils.d.h(this.mApplicationContext) ? "true" : "false";
            str2 = com.taboola.android.utils.d.d(this.mApplicationContext);
            str3 = "consent.tcstring";
        } else if (com.taboola.android.utils.d.a(this.mApplicationContext)) {
            str = com.taboola.android.utils.d.g(this.mApplicationContext) ? "true" : "false";
            str2 = com.taboola.android.utils.d.c(this.mApplicationContext);
            str3 = "consent.daisybit";
        } else {
            str = null;
            str2 = null;
            str3 = null;
        }
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return;
        }
        tBLRecommendationsRequest.setIABSubjectToGdpr(str);
        tBLRecommendationsRequest.setIABDaisyBit(str3, str2);
        g.a(TAG, String.format("GDPRInfo | gdpr.applies=%s, %s=%s", str, str3, str2));
    }

    private void checkIsInitialize() {
        if (this.mApplicationContext == null || TextUtils.isEmpty(this.mPublisherName)) {
            Log.e(TAG, "TBLNative is not properly initialized, did you forget to call init() ?", new Exception());
        }
    }

    private void createDataFormat() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
        this.mDefaultSdf = simpleDateFormat;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault());
        this.mReportEventDateFormat = simpleDateFormat2;
        simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC"));
    }

    public HashMap<String, String> generateMonitorDebugParams(TBLRecommendationsRequest tBLRecommendationsRequest) {
        HashMap<String, String> generateQueryParameters = tBLRecommendationsRequest.generateQueryParameters();
        generateQueryParameters.put("publisher", this.mPublisherName);
        return generateQueryParameters;
    }

    private String getBaseUrl(String str) {
        StringBuilder sb2;
        String g = this.mTBLNativeGlobalEPs.g();
        if (TextUtils.isEmpty(g)) {
            sb2 = new StringBuilder(getUrlProtocol());
            sb2.append(BASE_URL);
        } else {
            sb2 = new StringBuilder(g);
        }
        sb2.append(str);
        sb2.append("/");
        return sb2.toString();
    }

    @NonNull
    private Map<String, String> getFetchRecommendationsParams(TBLRecommendationsRequest tBLRecommendationsRequest, String str) {
        TBLUrlParamsChange tBLUrlParamsChange;
        this.mRequestMap.put(str, tBLRecommendationsRequest);
        HashMap<String, String> generateQueryParameters = tBLRecommendationsRequest.generateQueryParameters();
        if (this.mTBLMonitorHelper.g().booleanValue() && this.mTBLMonitorHelper.i() && (tBLUrlParamsChange = (TBLUrlParamsChange) this.mTBLMonitorHelper.c(3)) != null && !TextUtils.isEmpty(tBLUrlParamsChange.getParams())) {
            for (String str2 : tBLUrlParamsChange.getParams().split("&")) {
                String[] split = str2.split("=");
                generateQueryParameters.put(split[0], split[1]);
            }
        }
        generateQueryParameters.put(REQUEST_ID_KEY, str);
        return generateQueryParameters;
    }

    private String getUrlProtocol() {
        return this.mTBLNativeGlobalEPs.j() ? HTTP_PREFIX : HTTPS_PREFIX;
    }

    private void initializeFeatures() {
        com.taboola.android.tblnative.b bVar = this.mTBLNativeGlobalEPs;
        bVar.s(this.mTBLConfigManager.i("allowNonOrganicClickOverride", bVar.i()));
        com.taboola.android.tblnative.b bVar2 = this.mTBLNativeGlobalEPs;
        bVar2.q(this.mTBLConfigManager.i("enabledRawDataResponse", bVar2.f()));
        com.taboola.android.tblnative.b bVar3 = this.mTBLNativeGlobalEPs;
        bVar3.p(this.mTBLConfigManager.i("enableFullRawDataResponse", bVar3.e()));
        com.taboola.android.tblnative.b bVar4 = this.mTBLNativeGlobalEPs;
        bVar4.t(this.mTBLConfigManager.i("useHttp", bVar4.j()));
        this.mTBLNativeGlobalEPs.o(this.mTBLConfigManager.f(ve.d.a(com.taboola.android.utils.c.FEATURE_FORCE_CLICK_ON_APP), this.mTBLNativeGlobalEPs.d()));
        this.mTBLNativeGlobalEPs.r(this.mTBLConfigManager.i(ve.d.a(com.taboola.android.utils.c.OVERRIDE_IMAGE_LOAD), this.mTBLNativeGlobalEPs.h()));
        this.mTBLNativeGlobalEPs.l(this.mTBLConfigManager.f(ve.d.a(com.taboola.android.utils.c.HOST_NAME), this.mTBLNativeGlobalEPs.g()));
        String f = this.mTBLConfigManager.f("apiParams", null);
        if (!TextUtils.isEmpty(f)) {
            Map<String, String> a2 = this.mTBLNativeGlobalEPs.a(f);
            HashMap hashMap = new HashMap();
            hashMap.putAll(a2);
            this.mTBLNativeGlobalEPs.m(hashMap);
        }
        this.mTBLNativeGlobalEPs.n(this.mTBLConfigManager.i(ve.d.a(com.taboola.android.utils.c.DISABLE_LOCATION_COLLECTION), this.mTBLNativeGlobalEPs.c()));
    }

    public void notifyRecommendationFailed(TBLRecommendationRequestCallback tBLRecommendationRequestCallback, @NonNull Throwable th) {
        if (tBLRecommendationRequestCallback != null) {
            tBLRecommendationRequestCallback.onRecommendationsFailed(th);
        }
    }

    public void onSuccessfulResponse(String str, String str2, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
        TBLRecommendationsRequest tBLRecommendationsRequest = this.mRequestMap.get(str2);
        if (tBLRecommendationsRequest == null) {
            g.b(TAG, "TBRecommendationsRequest - requestId was not found");
            notifyRecommendationFailed(tBLRecommendationRequestCallback, new Throwable("TBRecommendationsRequest - requestId was not found"));
            return;
        }
        this.mRequestMap.remove(str2);
        TBLRecommendationsResponse b2 = new com.taboola.android.tblnative.d().b(this.mPublisherName, this.apiKey, this.mTBLNativeGlobalEPs.g(), this.mOnClickIgnoreTimeMs, this.mTBLNativeGlobalEPs.h(), this.mTBLNativeListener, str);
        if (b2 == null) {
            g.b(TAG, "Unable to deserialize TBRecommendationResponse");
            notifyRecommendationFailed(tBLRecommendationRequestCallback, new Throwable("Unable to deserialize TBRecommendationResponse"));
            return;
        }
        for (Map.Entry<String, TBLPlacement> entry : b2.getPlacementsMap().entrySet()) {
            TBLPlacement value = entry.getValue();
            TBLPlacementRequest tBLPlacementRequest = tBLRecommendationsRequest.getPlacementRequests().get(entry.getKey());
            if (tBLPlacementRequest == null) {
                tBLPlacementRequest = tBLRecommendationsRequest.getPlacementRequests().values().iterator().next();
            }
            boolean available = tBLPlacementRequest.getAvailable();
            value.setHasReportedAvailability(available);
            if (available) {
                Iterator<TBLRecommendationItem> it = value.getItems().iterator();
                while (it.hasNext()) {
                    Map<String, List<String>> trackingPixelMap = it.next().getTrackingPixelMap();
                    if (trackingPixelMap != null && !trackingPixelMap.isEmpty()) {
                        this.mTBLNetworkManager.getPixelHandler().b(this.mUiHandler, this.mTBLMonitorHelper, trackingPixelMap.get("i"), "i");
                    }
                }
            }
            value.setNextBatchRequest(tBLRecommendationsRequest.createNextBatchRequest(entry.getKey(), tBLRecommendationRequestCallback));
            value.setName(entry.getKey());
            if (this.mTBLMonitorHelper.g().booleanValue()) {
                this.mUiHandler.post(new d(value, tBLRecommendationsRequest));
            }
        }
        com.taboola.android.tblnative.a.b(b2.getSession(), this.mPublisherName);
        tBLRecommendationRequestCallback.onRecommendationsFetched(b2);
    }

    public void sendBridgeToKibana() {
        try {
            JSONObject jSONObject = new JSONObject();
            if (this.mDefaultSdf == null) {
                createDataFormat();
            }
            String format = this.mDefaultSdf.format(new Date());
            String e2 = this.mTBLAdvertisingIdInfo.e();
            jSONObject.put(ADDITIONAL_DATA, TBLSdkDetailsHelper.createSdkDetailsJSON(this.mApplicationContext, null, TBLSdkDetailsHelper.SDK_TYPE_API, this.mTBLNativeGlobalEPs.c(), null));
            if (TextUtils.isEmpty(e2)) {
                e2 = TBLSdkDetailsHelper.UNDEFINED;
            }
            jSONObject.put("device", e2);
            jSONObject.put(PUBLISHER_NAME, this.mPublisherName);
            jSONObject.put(API_KEY, this.apiKey);
            jSONObject.put("timestamp", format);
            jSONObject.put(EVENT, MOBILE_INIT);
            jSONObject.put(SHOULD_ALLOW_NON_ORGANIC_CLICK_OVERRIDE, this.mTBLNativeGlobalEPs.i());
            jSONObject.put(IS_ENABLED_RAW_DATA_RESPONSE, this.mTBLNativeGlobalEPs.f());
            jSONObject.put(IS_ENABLED_FULL_RAW_DATA_RESPONSE, this.mTBLNativeGlobalEPs.e());
            jSONObject.put(USE_HTTP, this.mTBLNativeGlobalEPs.j());
            Map<String, String> b2 = this.mTBLNativeGlobalEPs.b();
            if (b2 != null) {
                jSONObject.put(API_PARAMS, new JSONObject(b2));
            }
            jSONObject.put("taboolaConfig", this.mTBLConfigManager.j());
            this.mTBLNetworkManager.getKibanaHandler().sendEvent(jSONObject);
        } catch (Exception e3) {
            g.b(TAG, "sendEventToKibana " + e3.getMessage());
        }
    }

    private void waitForAdvertisingIdAndFetchRecommendations(TBLRecommendationsRequest tBLRecommendationsRequest, TBLRecommendationRequestCallback tBLRecommendationRequestCallback, Context context) {
        this.mTBLAdvertisingIdInfo.k(context, new b(tBLRecommendationsRequest, tBLRecommendationRequestCallback));
    }

    public void clear() {
        g.a(TAG, this.mPublisherName + ", clear() called ");
        this.mTBLNativeListener = null;
        this.mTBLNativeGlobalEPs.r(false);
        this.mTBLNativeGlobalEPs.k();
        Handler handler = this.mUiHandler;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            this.mUiHandler = null;
        }
        this.mTBLMonitorHelper.r(this.mApplicationContext);
    }

    public void fetchRecommendations(TBLRecommendationsRequest tBLRecommendationsRequest, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
        if (new Random().nextInt(100) <= 5) {
            new Thread(new a()).start();
        }
        checkIsInitialize();
        if (this.mApplicationContext == null) {
            return;
        }
        tBLRecommendationsRequest.setUserSession(com.taboola.android.tblnative.a.a(this.mPublisherName));
        tBLRecommendationsRequest.setAppType("mobile");
        tBLRecommendationsRequest.setApiKey(this.apiKey);
        addGdprInfo(tBLRecommendationsRequest);
        addCcpaInfo(tBLRecommendationsRequest);
        tBLRecommendationsRequest.setAppName(TBLSdkDetailsHelper.getApplicationName(this.mApplicationContext));
        if (TextUtils.isEmpty(tBLRecommendationsRequest.getViewId())) {
            tBLRecommendationsRequest.setViewId(String.valueOf(System.currentTimeMillis()));
        }
        tBLRecommendationsRequest.setAdditionalData(TBLSdkDetailsHelper.createSdkJsonString(this.mApplicationContext, null, TBLSdkDetailsHelper.SDK_TYPE_API, this.mTBLNativeGlobalEPs.c()));
        waitForAdvertisingIdAndFetchRecommendations(tBLRecommendationsRequest, tBLRecommendationRequestCallback, this.mApplicationContext);
    }

    TBLAdvertisingIdInfo getAdvertisingIdInfo() {
        return this.mTBLAdvertisingIdInfo;
    }

    public String getApiKey() {
        return this.apiKey;
    }

    ve.b getConfigManager() {
        return this.mTBLConfigManager;
    }

    void getFirstBatchForRequest(TBLRecommendationsRequest tBLRecommendationsRequest, TBLPlacementRequest tBLPlacementRequest, TBLRequestData tBLRequestData, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
        tBLPlacementRequest.setRequestData(tBLRequestData);
        tBLRecommendationsRequest.setRequestData(tBLRequestData);
        tBLRecommendationsRequest.addPlacementRequest(tBLPlacementRequest, tBLRecommendationRequestCallback);
        fetchRecommendations(tBLRecommendationsRequest, tBLRecommendationRequestCallback);
    }

    com.taboola.android.global_components.monitor.a getMonitorHelper() {
        return this.mTBLMonitorHelper;
    }

    TBLNetworkManager getNetworkManager() {
        return this.mTBLNetworkManager;
    }

    void getNextBatchForRequest(TBLRecommendationsRequest tBLRecommendationsRequest, int i, TBLRecommendationRequestCallback tBLRecommendationRequestCallback) {
        tBLRecommendationsRequest.setUserSession(com.taboola.android.tblnative.a.a(this.mPublisherName));
        if (i > 0) {
            tBLRecommendationsRequest.getPlacementRequests().values().iterator().next().setRecCount(i);
        }
        Context context = this.mApplicationContext;
        if (context == null) {
            return;
        }
        waitForAdvertisingIdAndFetchRecommendations(tBLRecommendationsRequest, tBLRecommendationRequestCallback, context);
    }

    int getOnClickIgnoreTimeMs() {
        return this.mOnClickIgnoreTimeMs;
    }

    String getOverrideBaseUrl() {
        return this.mTBLNativeGlobalEPs.g();
    }

    TBLPublisherInfo getPublisherInfo() {
        return this.mTBLPublisherInfo;
    }

    public String getPublisherName() {
        return this.mPublisherName;
    }

    public TBLNativeListener getTBLNativeListener() {
        return this.mTBLNativeListener;
    }

    public HashMap<String, String> getUnrecognizedExtraProperties() {
        return this.mUnrecognizedExtraProperties;
    }

    Handler getVisibilityMonitoringHandler() {
        return this.mVisibilityMonitoringHandler;
    }

    public void handleAttributionClick(@NonNull Context context) {
        if (context == null) {
            g.b(TAG, "Attribution dialog can't be showed, Context is missing");
            return;
        }
        String str = "https://popup.taboola.com/" + context.getResources().getConfiguration().locale.getCountry();
        g.a(TAG, "Open in browser");
        if (TextUtils.isEmpty(str)) {
            g.a(TAG, "Failed to open in tabs or browser, url is empty or null");
        } else {
            TBLOnClickHelper.openUrlInTabsOrBrowser(context, str);
        }
    }

    @MainThread
    public TBLNativeUnitInternal init(String str) {
        return init(this.mPublisherName, str, null);
    }

    @MainThread
    TBLNativeUnitInternal init(String str, String str2, Map<String, String> map) {
        initializeFeatures();
        setUnitExtraProperties(map);
        this.mPublisherName = str;
        this.apiKey = str2;
        this.mTBLPublisherInfo = new TBLPublisherInfo(str).setApiKey(str2);
        if (i.a(this.mApplicationContext)) {
            if (this.mUiHandler == null) {
                this.mUiHandler = new Handler(Looper.getMainLooper());
            }
            this.mTBLMonitorHelper.q(this.mApplicationContext, TBLSdkDetailsHelper.createSdkJsonString(this.mApplicationContext, null, TBLSdkDetailsHelper.SDK_TYPE_API, false));
        }
        return this;
    }

    @MainThread
    public TBLNativeUnitInternal init(String str, Map<String, String> map) {
        return init(this.mPublisherName, str, map);
    }

    public boolean isInitialized() {
        return (TextUtils.isEmpty(this.mPublisherName) || this.mApplicationContext == null) ? false : true;
    }

    void reportClientEvent(String str, Map<String, String> map, String str2, String str3) {
        if (!l.a(str2).toLowerCase().equalsIgnoreCase("ecbab80833a2f822e1262ced36ca7e7d84e033586d75f5e2f8091f2e8dc81a75")) {
            g.a(TAG, "reportEvent wrong password");
            return;
        }
        if (TextUtils.isEmpty(str)) {
            g.b(TAG, "reportEvent missing type param");
            return;
        }
        map.put("extraParam", str);
        TBLMobileEvent tBLMobileEvent = new TBLMobileEvent(TBLEventType.GENERIC, map);
        Taboola.getTaboolaImpl().reportTaboolaEvent(this.mTBLPublisherInfo, new TBLSessionInfo(com.taboola.android.tblnative.a.a(this.mPublisherName), str3), tBLMobileEvent);
    }

    public TBLNativeUnitInternal setLogLevel(int i) {
        checkIsInitialize();
        if (this.mTBLMonitorHelper.g().booleanValue()) {
            i = 3;
        }
        g.g(i);
        return this;
    }

    public TBLNativeUnitInternal setOnClickIgnoreTimeMs(int i) {
        checkIsInitialize();
        this.mOnClickIgnoreTimeMs = i;
        return this;
    }

    public void setTBLNativeListener(TBLNativeListener tBLNativeListener) {
        this.mTBLNativeListener = tBLNativeListener;
    }

    public TBLNativeUnitInternal setUnitExtraProperties(Map<String, String> map) {
        if (map != null && !map.isEmpty()) {
            checkIsInitialize();
            for (String str : map.keySet()) {
                String str2 = map.get(str);
                int i = e.a[com.taboola.android.utils.c.a(str).ordinal()];
                g.b(TAG, "setExtraProperties got unrecognized property. key = " + str);
                this.mUnrecognizedExtraProperties.put(str, str2);
            }
        }
        return this;
    }

    void updateCurrentPublisher(Map<String, String> map) {
        setUnitExtraProperties(map);
    }
}