Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e

以下内容为反编译后的 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.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.messaging.Constants;
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 a;
    private TJCorePlacement b;
    private TJPlacementListener c;
    private TJPlacementVideoListener d;
    private String e;
    public String pushId;

    @Deprecated
    public TJPlacement(Context context, String str, TJPlacementListener tJPlacementListener) {
        TJCorePlacement a = TJPlacementManager.a(str);
        a = a == null ? TJPlacementManager.a(str, "", "", false, false) : a;
        a.setContext(context);
        a(a, 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.a = 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().a)) {
            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"));
        } else 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."));
        } else 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."));
        } else {
            try {
                this.b.g.setSdkBeacon();
                TJCorePlacement tJCorePlacement = this.b;
                tJCorePlacement.a("REQUEST", this);
                if (tJCorePlacement.e - SystemClock.elapsedRealtime() > 0) {
                    String str = TJCorePlacement.a;
                    TapjoyLog.d(str, "Content has not expired yet for " + tJCorePlacement.c.getPlacementName());
                    if (tJCorePlacement.l) {
                        gj.b("TJPlacement.requestContent").a(FirebaseAnalytics.Param.CONTENT_TYPE, tJCorePlacement.b()).a(Constants.MessagePayloadKeys.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(Constants.MessagePayloadKeys.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 str2 : tJCorePlacement.r.keySet()) {
                                hashMap.put(TJAdUnitConstants.AUCTION_PARAM_PREFIX.concat(String.valueOf(str2)), tJCorePlacement.r.get(str2));
                            }
                            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.a;
        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.a, "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.a, "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, TJAdUnitActivity.class);
                    intent.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, tJCorePlacement2.c);
                    intent.setFlags(268435456);
                    tJCorePlacement2.b.startActivity(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() {
                        @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, TJAdUnitActivity.class);
                            intent2.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_DATA, TJCorePlacement.this.c);
                            intent2.setFlags(268435456);
                            context.startActivity(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.a, "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 a = TJPlacementManager.a(getName(), str, "", false, isLimited());
        this.b = a;
        a.p = str;
        a.n = str;
        a.c.setPlacementType(str);
        String e = a.e();
        if (!TextUtils.isEmpty(e)) {
            a.c.setMediationURL(TapjoyConnectCore.getPlacementURL() + "v1/apps/" + e + "/mediation_content?");
        } else {
            TapjoyLog.i(TJCorePlacement.a, "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);
    }
}