Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

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


package com.tapjoy;

import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.text.TextUtils;
import androidx.constraintlayout.core.motion.utils.TypedValues;
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 com.tapjoy.internal.hr;
import java.util.HashMap;
import java.util.UUID;

public class TJPlacement {

    TJPlacementListener f55732a;

    private TJCorePlacement f55733b;

    private TJPlacementListener f55734c;

    private TJPlacementVideoListener f55735d;

    private String f55736e;
    public String pushId;

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

    private void a(TJCorePlacement tJCorePlacement, TJPlacementListener tJPlacementListener) {
        this.f55733b = tJCorePlacement;
        this.f55736e = UUID.randomUUID().toString();
        this.f55734c = tJPlacementListener;
        this.f55732a = tJPlacementListener != null ? (TJPlacementListener) fp.a(tJPlacementListener, TJPlacementListener.class) : null;
        FiveRocksIntegration.addPlacementCallback(getName(), this);
    }

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

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

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

    public String getName() {
        if (this.f55733b.getPlacementData() != null) {
            return this.f55733b.getPlacementData().getPlacementName();
        }
        return "";
    }

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

    public boolean isContentAvailable() {
        this.f55733b.f55668f.a(1);
        return this.f55733b.isContentAvailable();
    }

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

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

    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.f55733b.f55665c.getPlacementType());
        if (gi.a() != null && TextUtils.isEmpty(gi.a().f56647a)) {
            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 z11 = 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.f55733b.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.f55733b.f55669g.setSdkBeacon();
            TJCorePlacement tJCorePlacement = this.f55733b;
            tJCorePlacement.a("REQUEST", this);
            if (tJCorePlacement.f55667e - SystemClock.elapsedRealtime() > 0) {
                TapjoyLog.d(TJCorePlacement.f55663a, "Content has not expired yet for " + tJCorePlacement.f55665c.getPlacementName());
                if (tJCorePlacement.f55674l) {
                    gj.b("TJPlacement.requestContent").a("content_type", tJCorePlacement.b()).a(TypedValues.TransitionType.S_FROM, "cache").c();
                    tJCorePlacement.f55673k = false;
                    tJCorePlacement.a(this);
                    tJCorePlacement.c();
                } else {
                    gj.b("TJPlacement.requestContent").a("content_type", "none").a(TypedValues.TransitionType.S_FROM, "cache").c();
                    tJCorePlacement.a(this);
                }
            } else {
                if (tJCorePlacement.f55674l) {
                    gj.c("TJPlacement.requestContent").a("was_available", Boolean.TRUE);
                }
                if (tJCorePlacement.f55675m) {
                    gj.c("TJPlacement.requestContent").a("was_ready", Boolean.TRUE);
                }
                if (!TextUtils.isEmpty(tJCorePlacement.f55678p)) {
                    HashMap hashMap = new HashMap();
                    hashMap.put(TJAdUnitConstants.PARAM_PLACEMENT_MEDIATION_AGENT, tJCorePlacement.f55678p);
                    hashMap.put(TJAdUnitConstants.PARAM_PLACEMENT_MEDIATION_ID, tJCorePlacement.f55679q);
                    HashMap<String, String> hashMap2 = tJCorePlacement.f55680r;
                    if (hashMap2 != null && !hashMap2.isEmpty()) {
                        z11 = true;
                    }
                    if (z11) {
                        for (String str : tJCorePlacement.f55680r.keySet()) {
                            hashMap.put(TJAdUnitConstants.AUCTION_PARAM_PREFIX.concat(String.valueOf(str)), tJCorePlacement.f55680r.get(str));
                        }
                        tJCorePlacement.a(tJCorePlacement.f55665c.getAuctionMediationURL(), hashMap);
                    } else {
                        tJCorePlacement.a(tJCorePlacement.f55665c.getMediationURL(), hashMap);
                    }
                } else {
                    tJCorePlacement.a();
                }
            }
        } finally {
            gj.d("TJPlacement.requestContent");
        }
    }

    public void setAdapterVersion(String str) {
        this.f55733b.f55677o = str;
    }

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

    public void setMediationId(String str) {
        this.f55733b.f55679q = str;
    }

    public void setMediationName(String str) {
        Context context;
        TapjoyLog.d("TJPlacement", "setMediationName=".concat(String.valueOf(str)));
        if (!TextUtils.isEmpty(str)) {
            TJCorePlacement tJCorePlacement = this.f55733b;
            if (tJCorePlacement != null) {
                context = tJCorePlacement.getContext();
            } else {
                context = null;
            }
            TJCorePlacement a11 = TJPlacementManager.a(getName(), str, "", false, isLimited());
            this.f55733b = a11;
            a11.f55678p = str;
            a11.f55676n = str;
            a11.f55665c.setPlacementType(str);
            String e11 = a11.e();
            if (!TextUtils.isEmpty(e11)) {
                a11.f55665c.setMediationURL(TapjoyConnectCore.getPlacementURL() + "v1/apps/" + e11 + "/mediation_content?");
            } else {
                TapjoyLog.i(TJCorePlacement.f55663a, "Placement mediation name can not be set for a null app ID");
            }
            if (context != null) {
                this.f55733b.setContext(context);
            }
        }
    }

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

    public void showContent() {
        int i11;
        TapjoyLog.i("TJPlacement", "showContent() called for placement ".concat(String.valueOf(getName())));
        if (gd.f56602c) {
            HashMap hashMap = new HashMap();
            hashMap.put("contentReady", String.valueOf(isContentReady()));
            this.f55733b.getAdUnit().getTjBeacon().a(TJAdUnitConstants.String.BEACON_SHOW_PATH, hashMap);
        }
        TJCorePlacement tJCorePlacement = this.f55733b;
        gj.a("TJPlacement.showContent").a("placement", tJCorePlacement.f55665c.getPlacementName()).a("placement_type", tJCorePlacement.f55665c.getPlacementType()).a("content_type", tJCorePlacement.b());
        fy fyVar = tJCorePlacement.f55668f;
        fyVar.a(8);
        fs fsVar = fyVar.f56570a;
        if (fsVar != null) {
            fsVar.a();
        }
        if (!this.f55733b.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.f55733b;
            if (TapjoyConnectCore.isFullScreenViewOpen()) {
                TapjoyLog.w(TJCorePlacement.f55663a, "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.f55663a, "Will close N2E content.");
                    TJPlacementManager.dismissContentShowing(false);
                }
                tJCorePlacement2.a("SHOW", this);
                gj.a d11 = gj.d("TJPlacement.showContent");
                if (tJCorePlacement2.f55669g.isPrerendered()) {
                    d11.a("prerendered", Boolean.TRUE);
                }
                if (tJCorePlacement2.isContentReady()) {
                    d11.a("content_ready", Boolean.TRUE);
                }
                tJCorePlacement2.f55668f.f56573d = d11;
                final String uuid = UUID.randomUUID().toString();
                hr hrVar = tJCorePlacement2.f55671i;
                if (hrVar != null) {
                    hrVar.f56801f = uuid;
                    if (hrVar == null) {
                        i11 = 1;
                    } else if (hrVar instanceof hg) {
                        i11 = 3;
                    } else if (hrVar instanceof hp) {
                        i11 = 2;
                    } else {
                        i11 = 0;
                    }
                    TapjoyConnectCore.viewWillOpen(uuid, i11);
                    tJCorePlacement2.f55671i.f56800e = new hd() {
                        @Override
                        public final void a(Context context, String str, String str2) {
                            if (str2 == null) {
                                TJCorePlacement.this.f55665c.setRedirectURL(str);
                            } else {
                                TJCorePlacement.this.f55665c.setBaseURL(str);
                                TJCorePlacement.this.f55665c.setHttpResponse(str2);
                            }
                            TJCorePlacement.this.f55665c.setHasProgressSpinner(true);
                            TJCorePlacement.this.f55665c.setContentViewId(uuid);
                            Intent intent = new Intent(TJCorePlacement.this.f55664b, (Class<?>) TJAdUnitActivity.class);
                            intent.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, TJCorePlacement.this.f55665c);
                            intent.setFlags(268435456);
                            context.startActivity(intent);
                        }
                    };
                    hk.a(new Runnable() {
                        @Override
                        public final void run() {
                            TJCorePlacement.this.f55671i.a(hk.a().f56742o, TJCorePlacement.this.f55668f);
                        }
                    });
                } else {
                    tJCorePlacement2.f55665c.setContentViewId(uuid);
                    Intent intent = new Intent(tJCorePlacement2.f55664b, (Class<?>) TJAdUnitActivity.class);
                    intent.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, tJCorePlacement2.f55665c);
                    intent.setFlags(268435456);
                    tJCorePlacement2.f55664b.startActivity(intent);
                }
                tJCorePlacement2.f55667e = 0L;
                tJCorePlacement2.f55674l = false;
                tJCorePlacement2.f55675m = false;
            }
        } finally {
            gj.d("TJPlacement.showContent");
        }
    }

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

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