Idle Egg Factory v2.1.5版本的 MD5 值为:7d2ba6677008ca521af0101bb927d72a

以下内容为反编译后的 TJPlacement.java 源代码,内容仅作参考


package com.tapjoy;

import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.text.TextUtils;
import com.facebook.appevents.integrity.IntegrityManager;
import com.google.android.gms.drive.DriveFile;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.safedk.android.analytics.brandsafety.BrandSafetyUtils;
import com.safedk.android.utils.Logger;
import com.safedk.android.utils.f;
import com.tapjoy.TJAdUnitConstants;
import com.tapjoy.TapjoyErrorMessage;
import com.tapjoy.internal.fp;
import com.tapjoy.internal.fs;
import com.tapjoy.internal.fy;
import com.tapjoy.internal.gd;
import com.tapjoy.internal.gi;
import com.tapjoy.internal.gj;
import com.tapjoy.internal.hd;
import com.tapjoy.internal.hg;
import com.tapjoy.internal.hk;
import com.tapjoy.internal.hp;
import java.util.HashMap;
import java.util.UUID;

public class TJPlacement {

    TJPlacementListener f6957a;
    private TJCorePlacement b;
    private TJPlacementListener c;
    private TJPlacementVideoListener d;
    private String e;
    public String pushId;

    public static void safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(Context p0, Intent p1) {
        Logger.d("SafeDK-Special|SafeDK: Call> Landroid/content/Context;->startActivity(Landroid/content/Intent;)V");
        if (p1 == null) {
            return;
        }
        BrandSafetyUtils.detectAdClick(p1, f.j);
        p0.startActivity(p1);
    }

    @Deprecated
    public TJPlacement(Context context, String str, TJPlacementListener tJPlacementListener) {
        TJCorePlacement a2 = TJPlacementManager.a(str);
        a2 = a2 == null ? TJPlacementManager.a(str, "", "", false, false) : a2;
        a2.setContext(context);
        a(a2, tJPlacementListener);
    }

    public TJPlacement(TJCorePlacement tJCorePlacement, TJPlacementListener tJPlacementListener) {
        a(tJCorePlacement, tJPlacementListener);
    }

    private void a(TJCorePlacement tJCorePlacement, TJPlacementListener tJPlacementListener) {
        this.b = tJCorePlacement;
        this.e = UUID.randomUUID().toString();
        this.c = tJPlacementListener;
        this.f6957a = tJPlacementListener != null ? (TJPlacementListener) fp.a(tJPlacementListener, TJPlacementListener.class) : null;
        FiveRocksIntegration.addPlacementCallback(getName(), this);
    }

    public TJPlacementListener getListener() {
        return this.c;
    }

    public void setVideoListener(TJPlacementVideoListener tJPlacementVideoListener) {
        this.d = tJPlacementVideoListener;
    }

    public TJPlacementVideoListener getVideoListener() {
        return this.d;
    }

    public String getName() {
        return this.b.getPlacementData() != null ? this.b.getPlacementData().getPlacementName() : "";
    }

    public boolean isLimited() {
        return this.b.isLimited();
    }

    public boolean isContentReady() {
        boolean isContentReady = this.b.isContentReady();
        fy fyVar = this.b.f;
        if (isContentReady) {
            fyVar.a(4);
        } else {
            fyVar.a(2);
        }
        return isContentReady;
    }

    public boolean isContentAvailable() {
        this.b.f.a(1);
        return this.b.isContentAvailable();
    }

    public void setMediationId(String str) {
        this.b.q = str;
    }

    public void requestContent() {
        boolean isLimitedConnected;
        String name = getName();
        TapjoyLog.i("TJPlacement", "requestContent() called for placement ".concat(String.valueOf(name)));
        gj.a("TJPlacement.requestContent").a("placement", name).a("placement_type", this.b.c.getPlacementType());
        if (gi.a() != null && TextUtils.isEmpty(gi.a().f7138a)) {
            TapjoyLog.w("TJPlacement", "[INFO] Your application calls requestContent without having previously called setUserConsent. You can review Tapjoy supported consent API here - https://dev.tapjoy.com/sdk-integration/#sdk11122_gdpr_release.");
        }
        if (!isLimited()) {
            isLimitedConnected = TapjoyConnectCore.isConnected();
        } else {
            isLimitedConnected = TapjoyConnectCore.isLimitedConnected();
        }
        boolean z = false;
        if (!isLimitedConnected) {
            gj.b("TJPlacement.requestContent").b("not connected").c();
            a(new TJError(0, "SDK not connected -- connect must be called first with a successful callback"));
            return;
        }
        if (this.b.getContext() == null) {
            gj.b("TJPlacement.requestContent").b("no context").c();
            a(new TJError(0, "Context is null -- TJPlacement requires a valid Context."));
            return;
        }
        if (TextUtils.isEmpty(name)) {
            gj.b("TJPlacement.requestContent").b("invalid name").c();
            a(new TJError(0, "Invalid placement name -- TJPlacement requires a valid placement name."));
            return;
        }
        try {
            this.b.g.setSdkBeacon();
            TJCorePlacement tJCorePlacement = this.b;
            tJCorePlacement.a("REQUEST", this);
            if (tJCorePlacement.e - SystemClock.elapsedRealtime() > 0) {
                TapjoyLog.d(TJCorePlacement.f6936a, "Content has not expired yet for " + tJCorePlacement.c.getPlacementName());
                if (tJCorePlacement.l) {
                    gj.b("TJPlacement.requestContent").a(FirebaseAnalytics.Param.CONTENT_TYPE, tJCorePlacement.b()).a("from", "cache").c();
                    tJCorePlacement.k = false;
                    tJCorePlacement.a(this);
                    tJCorePlacement.c();
                } else {
                    gj.b("TJPlacement.requestContent").a(FirebaseAnalytics.Param.CONTENT_TYPE, IntegrityManager.INTEGRITY_TYPE_NONE).a("from", "cache").c();
                    tJCorePlacement.a(this);
                }
            } else {
                if (tJCorePlacement.l) {
                    gj.c("TJPlacement.requestContent").a("was_available", Boolean.TRUE);
                }
                if (tJCorePlacement.m) {
                    gj.c("TJPlacement.requestContent").a("was_ready", Boolean.TRUE);
                }
                if (!TextUtils.isEmpty(tJCorePlacement.p)) {
                    HashMap hashMap = new HashMap();
                    hashMap.put(TJAdUnitConstants.PARAM_PLACEMENT_MEDIATION_AGENT, tJCorePlacement.p);
                    hashMap.put(TJAdUnitConstants.PARAM_PLACEMENT_MEDIATION_ID, tJCorePlacement.q);
                    if (tJCorePlacement.r != null && !tJCorePlacement.r.isEmpty()) {
                        z = true;
                    }
                    if (z) {
                        for (String str : tJCorePlacement.r.keySet()) {
                            hashMap.put(TJAdUnitConstants.AUCTION_PARAM_PREFIX.concat(String.valueOf(str)), tJCorePlacement.r.get(str));
                        }
                        tJCorePlacement.a(tJCorePlacement.c.getAuctionMediationURL(), hashMap);
                    } else {
                        tJCorePlacement.a(tJCorePlacement.c.getMediationURL(), hashMap);
                    }
                } else {
                    tJCorePlacement.a();
                }
            }
        } finally {
            gj.d("TJPlacement.requestContent");
        }
    }

    public void showContent() {
        int i;
        TapjoyLog.i("TJPlacement", "showContent() called for placement ".concat(String.valueOf(getName())));
        if (gd.c) {
            HashMap hashMap = new HashMap();
            hashMap.put("contentReady", String.valueOf(isContentReady()));
            this.b.getAdUnit().getTjBeacon().a(TJAdUnitConstants.String.BEACON_SHOW_PATH, hashMap);
        }
        TJCorePlacement tJCorePlacement = this.b;
        gj.a("TJPlacement.showContent").a("placement", tJCorePlacement.c.getPlacementName()).a("placement_type", tJCorePlacement.c.getPlacementType()).a(FirebaseAnalytics.Param.CONTENT_TYPE, tJCorePlacement.b());
        fy fyVar = tJCorePlacement.f;
        fyVar.a(8);
        fs fsVar = fyVar.f7117a;
        if (fsVar != null) {
            fsVar.a();
        }
        if (!this.b.isContentAvailable()) {
            TapjoyLog.e("TJPlacement", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "No placement content available. Can not show content for non-200 placement."));
            gj.b("TJPlacement.showContent").b("no content").c();
            return;
        }
        try {
            final TJCorePlacement tJCorePlacement2 = this.b;
            if (TapjoyConnectCore.isFullScreenViewOpen()) {
                TapjoyLog.w(TJCorePlacement.f6936a, "Only one view can be presented at a time.");
                gj.b("TJPlacement.showContent").b("another content showing").c();
            } else {
                if (TapjoyConnectCore.isViewOpen()) {
                    TapjoyLog.w(TJCorePlacement.f6936a, "Will close N2E content.");
                    TJPlacementManager.dismissContentShowing(false);
                }
                tJCorePlacement2.a("SHOW", this);
                gj.a d = gj.d("TJPlacement.showContent");
                if (tJCorePlacement2.g.isPrerendered()) {
                    d.a("prerendered", Boolean.TRUE);
                }
                if (tJCorePlacement2.isContentReady()) {
                    d.a("content_ready", Boolean.TRUE);
                }
                tJCorePlacement2.f.d = d;
                final String uuid = UUID.randomUUID().toString();
                if (tJCorePlacement2.i == null) {
                    tJCorePlacement2.c.setContentViewId(uuid);
                    Intent intent = new Intent(tJCorePlacement2.b, (Class<?>) TJAdUnitActivity.class);
                    intent.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, tJCorePlacement2.c);
                    intent.setFlags(DriveFile.MODE_READ_ONLY);
                    safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(tJCorePlacement2.b, intent);
                } else {
                    tJCorePlacement2.i.f = uuid;
                    if (tJCorePlacement2.i == null) {
                        i = 1;
                    } else if (tJCorePlacement2.i instanceof hg) {
                        i = 3;
                    } else {
                        i = tJCorePlacement2.i instanceof hp ? 2 : 0;
                    }
                    TapjoyConnectCore.viewWillOpen(uuid, i);
                    tJCorePlacement2.i.e = new hd() {
                        public static void safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(Context p0, Intent p1) {
                            Logger.d("SafeDK-Special|SafeDK: Call> Landroid/content/Context;->startActivity(Landroid/content/Intent;)V");
                            if (p1 == null) {
                                return;
                            }
                            BrandSafetyUtils.detectAdClick(p1, f.j);
                            p0.startActivity(p1);
                        }

                        @Override
                        public final void a(Context context, String str, String str2) {
                            if (str2 == null) {
                                TJCorePlacement.this.c.setRedirectURL(str);
                            } else {
                                TJCorePlacement.this.c.setBaseURL(str);
                                TJCorePlacement.this.c.setHttpResponse(str2);
                            }
                            TJCorePlacement.this.c.setHasProgressSpinner(true);
                            TJCorePlacement.this.c.setContentViewId(uuid);
                            Intent intent2 = new Intent(TJCorePlacement.this.b, (Class<?>) TJAdUnitActivity.class);
                            intent2.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, TJCorePlacement.this.c);
                            intent2.setFlags(DriveFile.MODE_READ_ONLY);
                            safedk_Context_startActivity_97cb3195734cf5c9cc3418feeafa6dd6(context, intent2);
                        }
                    };
                    hk.a(new Runnable() {
                        @Override
                        public final void run() {
                            TJCorePlacement.this.i.a(hk.a().o, TJCorePlacement.this.f);
                        }
                    });
                }
                tJCorePlacement2.e = 0L;
                tJCorePlacement2.l = false;
                tJCorePlacement2.m = false;
            }
        } finally {
            gj.d("TJPlacement.showContent");
        }
    }

    public void setAuctionData(HashMap<String, String> hashMap) {
        if (hashMap == null || hashMap.isEmpty()) {
            TapjoyLog.d("TJPlacement", "auctionData can not be null or empty");
            return;
        }
        TJCorePlacement tJCorePlacement = this.b;
        tJCorePlacement.r = hashMap;
        String e = tJCorePlacement.e();
        if (!TextUtils.isEmpty(e)) {
            tJCorePlacement.c.setAuctionMediationURL(TapjoyConnectCore.getPlacementURL() + "v1/apps/" + e + "/bid_content?");
            return;
        }
        TapjoyLog.i(TJCorePlacement.f6936a, "Placement auction data can not be set for a null app ID");
    }

    public void setMediationName(String str) {
        TapjoyLog.d("TJPlacement", "setMediationName=".concat(String.valueOf(str)));
        if (TextUtils.isEmpty(str)) {
            return;
        }
        TJCorePlacement tJCorePlacement = this.b;
        Context context = tJCorePlacement != null ? tJCorePlacement.getContext() : null;
        TJCorePlacement a2 = TJPlacementManager.a(getName(), str, "", false, isLimited());
        this.b = a2;
        a2.p = str;
        a2.n = str;
        a2.c.setPlacementType(str);
        String e = a2.e();
        if (!TextUtils.isEmpty(e)) {
            a2.c.setMediationURL(TapjoyConnectCore.getPlacementURL() + "v1/apps/" + e + "/mediation_content?");
        } else {
            TapjoyLog.i(TJCorePlacement.f6936a, "Placement mediation name can not be set for a null app ID");
        }
        if (context != null) {
            this.b.setContext(context);
        }
    }

    public void setAdapterVersion(String str) {
        this.b.o = str;
    }

    public static void dismissContent() {
        TJPlacementManager.dismissContentShowing("true".equals(TapjoyConnectCore.getConnectFlagValue("TJC_OPTION_DISMISS_CONTENT_ALL")));
    }

    public String getGUID() {
        return this.e;
    }

    private void a(TJError tJError) {
        this.b.a(this, TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, tJError);
    }
}