- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
248 lines
11 KiB
Java
248 lines
11 KiB
Java
package com.tapjoy;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Looper;
|
|
import android.os.SystemClock;
|
|
import android.text.TextUtils;
|
|
import com.google.android.gms.drive.DriveFile;
|
|
import com.tapjoy.TapjoyErrorMessage;
|
|
import java.lang.ref.WeakReference;
|
|
import java.lang.reflect.Proxy;
|
|
import java.util.HashMap;
|
|
import java.util.UUID;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class TJPlacement {
|
|
public final TJCorePlacement a;
|
|
public final TJPlacementListener b;
|
|
public final TJPlacementListener c;
|
|
public final String d;
|
|
public TJEntryPoint e;
|
|
|
|
@Deprecated
|
|
public TJPlacement(Context context, String str, TJPlacementListener tJPlacementListener) {
|
|
this.e = null;
|
|
TJCorePlacement a = TJPlacementManager.a(str);
|
|
a = a == null ? TJPlacementManager.a(str, false) : a;
|
|
a.setContext(context);
|
|
this.a = a;
|
|
this.d = UUID.randomUUID().toString();
|
|
this.b = tJPlacementListener;
|
|
this.c = tJPlacementListener != null ? (TJPlacementListener) Proxy.newProxyInstance(TJPlacementListener.class.getClassLoader(), new Class[]{TJPlacementListener.class}, new com.tapjoy.internal.e(tJPlacementListener, Thread.currentThread(), Looper.myLooper())) : null;
|
|
}
|
|
|
|
public static void dismissContent() {
|
|
if ("true".equals(TapjoyConnectCore.getInstance().getConnectFlagValue("TJC_OPTION_DISMISS_CONTENT_ALL"))) {
|
|
TJPlacementManager.dismissContentShowing();
|
|
}
|
|
}
|
|
|
|
public TJEntryPoint getEntryPoint() {
|
|
return this.e;
|
|
}
|
|
|
|
public String getGUID() {
|
|
return this.d;
|
|
}
|
|
|
|
public TJPlacementListener getListener() {
|
|
return this.b;
|
|
}
|
|
|
|
public String getName() {
|
|
return this.a.getPlacementData() != null ? this.a.getPlacementData().getPlacementName() : "";
|
|
}
|
|
|
|
public boolean isContentAvailable() {
|
|
return this.a.isContentAvailable();
|
|
}
|
|
|
|
public boolean isContentReady() {
|
|
return this.a.isContentReady();
|
|
}
|
|
|
|
public void requestContent() {
|
|
String name = getName();
|
|
TapjoyLog.i("TJPlacement", "requestContent() called for placement " + name);
|
|
if (TJPrivacyPolicy.getInstance() != null && TJPrivacyPolicy.getInstance().getUserConsent() == TJStatus.UNKNOWN) {
|
|
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 (!TapjoyConnectCore.getInstance().isConnected()) {
|
|
this.a.a(this, TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, new TJError(0, "SDK not connected -- connect must be called first with a successful callback"));
|
|
return;
|
|
}
|
|
if (this.a.getContext() == null) {
|
|
TJCorePlacement tJCorePlacement = this.a;
|
|
Context context = com.tapjoy.internal.j.a;
|
|
if (context == null) {
|
|
WeakReference weakReference = com.tapjoy.internal.j.c.a;
|
|
context = (Context) (weakReference != null ? weakReference.get() : null);
|
|
}
|
|
tJCorePlacement.setContext(context);
|
|
}
|
|
if (this.a.getContext() == null) {
|
|
this.a.a(this, TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, new TJError(0, "Context is null -- TJPlacement requires a valid Context."));
|
|
return;
|
|
}
|
|
if (TextUtils.isEmpty(name)) {
|
|
this.a.a(this, TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, new TJError(0, "Invalid placement name -- TJPlacement requires a valid placement name."));
|
|
return;
|
|
}
|
|
TJCorePlacement tJCorePlacement2 = this.a;
|
|
tJCorePlacement2.a("REQUEST", this);
|
|
if (tJCorePlacement2.g - SystemClock.elapsedRealtime() > 0) {
|
|
TapjoyLog.d("TJCorePlacement", "Content has not expired yet for " + tJCorePlacement2.d.getPlacementName());
|
|
if (!tJCorePlacement2.n) {
|
|
tJCorePlacement2.a(this);
|
|
return;
|
|
}
|
|
tJCorePlacement2.m = false;
|
|
tJCorePlacement2.a(this);
|
|
tJCorePlacement2.a();
|
|
return;
|
|
}
|
|
synchronized (tJCorePlacement2) {
|
|
String url = tJCorePlacement2.d.getUrl();
|
|
if (TextUtils.isEmpty(url)) {
|
|
url = tJCorePlacement2.getPlacementContentUrl();
|
|
if (TextUtils.isEmpty(url)) {
|
|
tJCorePlacement2.a(tJCorePlacement2.a("REQUEST"), TapjoyErrorMessage.ErrorType.SDK_ERROR, new TJError(0, "TJPlacement is missing APP_ID"));
|
|
return;
|
|
}
|
|
tJCorePlacement2.d.updateUrl(url);
|
|
}
|
|
TapjoyLog.d("TJCorePlacement", "sendContentRequest -- URL: " + url + " name: " + tJCorePlacement2.d.getPlacementName());
|
|
tJCorePlacement2.c(url);
|
|
}
|
|
}
|
|
|
|
public void setCurrencyAmountRequired(String str, int i, TJSetCurrencyAmountRequiredListener tJSetCurrencyAmountRequiredListener) {
|
|
if (str != null && !str.isEmpty() && this.a.e.i.contains(str) && i > 0) {
|
|
TJCurrencyParameters tJCurrencyParameters = this.a.e;
|
|
tJCurrencyParameters.d = str;
|
|
tJCurrencyParameters.e = i;
|
|
tJCurrencyParameters.h.put(str, Integer.valueOf(i));
|
|
if (tJSetCurrencyAmountRequiredListener != null) {
|
|
tJSetCurrencyAmountRequiredListener.onSetCurrencyAmountRequiredSuccess();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (str != null && str.isEmpty() && tJSetCurrencyAmountRequiredListener != null) {
|
|
tJSetCurrencyAmountRequiredListener.onSetCurrencyAmountRequiredFailure(1, "Currency id is null or empty");
|
|
return;
|
|
}
|
|
if (!this.a.e.i.contains(str) && tJSetCurrencyAmountRequiredListener != null) {
|
|
tJSetCurrencyAmountRequiredListener.onSetCurrencyAmountRequiredFailure(1, "Invalid currency id");
|
|
} else {
|
|
if (i > 0 || tJSetCurrencyAmountRequiredListener == null) {
|
|
return;
|
|
}
|
|
tJSetCurrencyAmountRequiredListener.onSetCurrencyAmountRequiredFailure(1, "Amount is negative or zero");
|
|
}
|
|
}
|
|
|
|
public void setCurrencyBalance(String str, int i, TJSetCurrencyBalanceListener tJSetCurrencyBalanceListener) {
|
|
if (str != null && !str.isEmpty() && this.a.e.i.contains(str)) {
|
|
TJCurrencyParameters tJCurrencyParameters = this.a.e;
|
|
if (tJCurrencyParameters.f && i >= 0) {
|
|
tJCurrencyParameters.b = str;
|
|
tJCurrencyParameters.c = i;
|
|
tJCurrencyParameters.g.put(str, Integer.valueOf(i));
|
|
if (tJSetCurrencyBalanceListener != null) {
|
|
tJSetCurrencyBalanceListener.onSetCurrencyBalanceSuccess();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
if (str != null && str.isEmpty() && tJSetCurrencyBalanceListener != null) {
|
|
tJSetCurrencyBalanceListener.onSetCurrencyBalanceFailure(1, "Currency id is null or empty");
|
|
return;
|
|
}
|
|
if (!this.a.e.i.contains(str) && tJSetCurrencyBalanceListener != null) {
|
|
tJSetCurrencyBalanceListener.onSetCurrencyBalanceFailure(1, "Invalid currency id");
|
|
return;
|
|
}
|
|
if (!this.a.e.f && tJSetCurrencyBalanceListener != null) {
|
|
tJSetCurrencyBalanceListener.onSetCurrencyBalanceFailure(1, "App uses Tapjoy managed currencies");
|
|
} else {
|
|
if (i >= 0 || tJSetCurrencyBalanceListener == null) {
|
|
return;
|
|
}
|
|
tJSetCurrencyBalanceListener.onSetCurrencyBalanceFailure(1, "Balance is negative");
|
|
}
|
|
}
|
|
|
|
public void setEntryPoint(TJEntryPoint tJEntryPoint) {
|
|
this.e = tJEntryPoint;
|
|
}
|
|
|
|
public void showContent() {
|
|
TapjoyLog.i("TJPlacement", "showContent() called for placement " + getName());
|
|
if (!this.a.isContentAvailable()) {
|
|
TapjoyLog.e("TJPlacement", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "No placement content available. Can not show content for non-200 placement."));
|
|
return;
|
|
}
|
|
TJCorePlacement tJCorePlacement = this.a;
|
|
tJCorePlacement.getClass();
|
|
if (TapjoyConnectCore.getInstance().isViewOpen()) {
|
|
TapjoyLog.w("TJCorePlacement", "Only one view can be presented at a time.");
|
|
return;
|
|
}
|
|
tJCorePlacement.a("SHOW", this);
|
|
tJCorePlacement.d.setContentViewId(UUID.randomUUID().toString());
|
|
TJMemoryDataStorage.getInstance().put(tJCorePlacement.d.getPlacementName(), tJCorePlacement.d);
|
|
Intent intent = new Intent(tJCorePlacement.b, (Class<?>) TJAdUnitActivity.class);
|
|
intent.putExtra(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_NAME, tJCorePlacement.d.getPlacementName());
|
|
intent.setFlags(DriveFile.MODE_READ_ONLY);
|
|
TapjoyLog.i("TJCorePlacement", "Content shown for placement " + tJCorePlacement.d.getPlacementName());
|
|
TJPlacement a = tJCorePlacement.a("SHOW");
|
|
if (a != null && a.getListener() != null) {
|
|
a.getListener().onContentShow(a);
|
|
}
|
|
if (tJCorePlacement.h.getSdkBeacon() != null) {
|
|
com.tapjoy.internal.z0 sdkBeacon = tJCorePlacement.h.getSdkBeacon();
|
|
if (!TextUtils.isEmpty(sdkBeacon.c) && !sdkBeacon.f) {
|
|
sdkBeacon.f = true;
|
|
new com.tapjoy.internal.x0(sdkBeacon, new HashMap(sdkBeacon.b)).start();
|
|
}
|
|
}
|
|
TapjoyUtil.runOnMainThread(new d0(tJCorePlacement, intent));
|
|
tJCorePlacement.g = 0L;
|
|
tJCorePlacement.n = false;
|
|
tJCorePlacement.o = false;
|
|
}
|
|
|
|
public int getCurrencyAmountRequired(String str) {
|
|
if (!this.a.e.i.contains(str)) {
|
|
return -1;
|
|
}
|
|
TJCurrencyParameters tJCurrencyParameters = this.a.e;
|
|
if (tJCurrencyParameters.h.containsKey(str)) {
|
|
return ((Integer) tJCurrencyParameters.h.get(str)).intValue();
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public int getCurrencyBalance(String str) {
|
|
if ((str != null || this.a.e.f) && !this.a.e.i.contains(str)) {
|
|
return -1;
|
|
}
|
|
TJCurrencyParameters tJCurrencyParameters = this.a.e;
|
|
if (tJCurrencyParameters.g.containsKey(str)) {
|
|
return ((Integer) tJCurrencyParameters.g.get(str)).intValue();
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public TJPlacement(TJCorePlacement tJCorePlacement, TJPlacementListener tJPlacementListener) {
|
|
this.e = null;
|
|
this.a = tJCorePlacement;
|
|
this.d = UUID.randomUUID().toString();
|
|
this.b = tJPlacementListener;
|
|
this.c = tJPlacementListener != null ? (TJPlacementListener) Proxy.newProxyInstance(TJPlacementListener.class.getClassLoader(), new Class[]{TJPlacementListener.class}, new com.tapjoy.internal.e(tJPlacementListener, Thread.currentThread(), Looper.myLooper())) : null;
|
|
}
|
|
}
|