- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
198 lines
7.9 KiB
Java
198 lines
7.9 KiB
Java
package com.ironsource;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import com.ironsource.mediationsdk.IronSource;
|
|
import com.ironsource.mediationsdk.model.BasePlacement;
|
|
import com.ironsource.mediationsdk.utils.IronSourceConstants;
|
|
import com.ironsource.mediationsdk.utils.IronSourceUtils;
|
|
import com.ironsource.qe;
|
|
import java.util.Calendar;
|
|
import java.util.TimeZone;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class fo implements qe, qe.a {
|
|
private static final String a = "CappingManager.IS_DELIVERY_ENABLED";
|
|
private static final String b = "CappingManager.IS_CAPPING_ENABLED";
|
|
private static final String c = "CappingManager.IS_PACING_ENABLED";
|
|
private static final String d = "CappingManager.MAX_NUMBER_OF_SHOWS";
|
|
private static final String e = "CappingManager.CAPPING_TYPE";
|
|
private static final String f = "CappingManager.SECONDS_BETWEEN_SHOWS";
|
|
private static final String g = "CappingManager.CURRENT_NUMBER_OF_SHOWS";
|
|
private static final String h = "CappingManager.CAPPING_TIME_THRESHOLD";
|
|
private static final String i = "CappingManager.TIME_OF_THE_PREVIOUS_SHOW";
|
|
|
|
public static /* synthetic */ class a {
|
|
static final /* synthetic */ int[] a;
|
|
|
|
static {
|
|
int[] iArr = new int[go.values().length];
|
|
a = iArr;
|
|
try {
|
|
iArr[go.PER_DAY.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
a[go.PER_HOUR.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum b {
|
|
CAPPED_PER_DELIVERY,
|
|
CAPPED_PER_COUNT,
|
|
CAPPED_PER_PACE,
|
|
NOT_CAPPED
|
|
}
|
|
|
|
private long a(go goVar) {
|
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
|
int i2 = a.a[goVar.ordinal()];
|
|
if (i2 == 1) {
|
|
calendar.set(14, 0);
|
|
calendar.set(13, 0);
|
|
calendar.set(12, 0);
|
|
calendar.set(11, 0);
|
|
calendar.add(6, 1);
|
|
} else if (i2 == 2) {
|
|
calendar.set(14, 0);
|
|
calendar.set(13, 0);
|
|
calendar.set(12, 0);
|
|
calendar.add(11, 1);
|
|
}
|
|
return calendar.getTimeInMillis();
|
|
}
|
|
|
|
private String a(IronSource.AD_UNIT ad_unit) {
|
|
return ad_unit == IronSource.AD_UNIT.REWARDED_VIDEO ? IronSourceConstants.REWARDED_VIDEO_AD_UNIT : ad_unit == IronSource.AD_UNIT.INTERSTITIAL ? "Interstitial" : ad_unit == IronSource.AD_UNIT.BANNER ? "Banner" : ad_unit == IronSource.AD_UNIT.NATIVE_AD ? IronSourceConstants.NATIVE_AD_UNIT : ad_unit.toString();
|
|
}
|
|
|
|
private String a(String str, String str2, String str3) {
|
|
return str + "_" + str2 + "_" + str3;
|
|
}
|
|
|
|
private void a(Context context, String str, String str2) {
|
|
go goVar;
|
|
int i2 = 0;
|
|
if (IronSourceUtils.getBooleanFromSharedPrefs(context, a(str, c, str2), false)) {
|
|
IronSourceUtils.saveLongToSharedPrefs(context, a(str, i, str2), System.currentTimeMillis());
|
|
}
|
|
if (IronSourceUtils.getBooleanFromSharedPrefs(context, a(str, b, str2), false)) {
|
|
String a2 = a(str, g, str2);
|
|
int intFromSharedPrefs = IronSourceUtils.getIntFromSharedPrefs(context, a2, 0);
|
|
if (intFromSharedPrefs == 0) {
|
|
String stringFromSharedPrefs = IronSourceUtils.getStringFromSharedPrefs(context, a(str, e, str2), go.PER_DAY.toString());
|
|
go[] values = go.values();
|
|
int length = values.length;
|
|
while (true) {
|
|
if (i2 >= length) {
|
|
goVar = null;
|
|
break;
|
|
}
|
|
goVar = values[i2];
|
|
if (goVar.a.equals(stringFromSharedPrefs)) {
|
|
break;
|
|
} else {
|
|
i2++;
|
|
}
|
|
}
|
|
IronSourceUtils.saveLongToSharedPrefs(context, a(str, h, str2), a(goVar));
|
|
}
|
|
IronSourceUtils.saveIntToSharedPrefs(context, a2, intFromSharedPrefs + 1);
|
|
}
|
|
}
|
|
|
|
private void a(Context context, String str, String str2, co coVar) {
|
|
boolean e2 = coVar.e();
|
|
IronSourceUtils.saveBooleanToSharedPrefs(context, a(str, a, str2), e2);
|
|
if (e2) {
|
|
boolean d2 = coVar.d();
|
|
IronSourceUtils.saveBooleanToSharedPrefs(context, a(str, b, str2), d2);
|
|
if (d2) {
|
|
IronSourceUtils.saveIntToSharedPrefs(context, a(str, d, str2), coVar.b());
|
|
IronSourceUtils.saveStringToSharedPrefs(context, a(str, e, str2), coVar.a().toString());
|
|
}
|
|
boolean f2 = coVar.f();
|
|
IronSourceUtils.saveBooleanToSharedPrefs(context, a(str, c, str2), f2);
|
|
if (f2) {
|
|
IronSourceUtils.saveIntToSharedPrefs(context, a(str, f, str2), coVar.c());
|
|
}
|
|
}
|
|
}
|
|
|
|
private b b(Context context, String str, String str2) {
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (!IronSourceUtils.getBooleanFromSharedPrefs(context, a(str, a, str2), true)) {
|
|
return b.CAPPED_PER_DELIVERY;
|
|
}
|
|
if (IronSourceUtils.getBooleanFromSharedPrefs(context, a(str, c, str2), false)) {
|
|
if (currentTimeMillis - IronSourceUtils.getLongFromSharedPrefs(context, a(str, i, str2), 0L) < IronSourceUtils.getIntFromSharedPrefs(context, a(str, f, str2), 0) * 1000) {
|
|
return b.CAPPED_PER_PACE;
|
|
}
|
|
}
|
|
if (IronSourceUtils.getBooleanFromSharedPrefs(context, a(str, b, str2), false)) {
|
|
int intFromSharedPrefs = IronSourceUtils.getIntFromSharedPrefs(context, a(str, d, str2), 0);
|
|
String a2 = a(str, g, str2);
|
|
int intFromSharedPrefs2 = IronSourceUtils.getIntFromSharedPrefs(context, a2, 0);
|
|
String a3 = a(str, h, str2);
|
|
if (currentTimeMillis >= IronSourceUtils.getLongFromSharedPrefs(context, a3, 0L)) {
|
|
IronSourceUtils.saveIntToSharedPrefs(context, a2, 0);
|
|
IronSourceUtils.saveLongToSharedPrefs(context, a3, 0L);
|
|
} else if (intFromSharedPrefs2 >= intFromSharedPrefs) {
|
|
return b.CAPPED_PER_COUNT;
|
|
}
|
|
}
|
|
return b.NOT_CAPPED;
|
|
}
|
|
|
|
@Override // com.ironsource.qe
|
|
public synchronized b a(Context context, BasePlacement basePlacement, IronSource.AD_UNIT ad_unit) {
|
|
if (context == null) {
|
|
return b.NOT_CAPPED;
|
|
}
|
|
if (basePlacement == null) {
|
|
return b.NOT_CAPPED;
|
|
}
|
|
String a2 = a(ad_unit);
|
|
if (basePlacement.getPlacementName() == null) {
|
|
return b.NOT_CAPPED;
|
|
}
|
|
if (basePlacement.getPlacementAvailabilitySettings() == null) {
|
|
return b.NOT_CAPPED;
|
|
}
|
|
return b(context, a2, basePlacement.getPlacementName());
|
|
}
|
|
|
|
@Override // com.ironsource.qe.a
|
|
public synchronized void a(Context context, String str, IronSource.AD_UNIT ad_unit) {
|
|
if (context == null) {
|
|
return;
|
|
}
|
|
if (str == null) {
|
|
return;
|
|
}
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
a(context, a(ad_unit), str);
|
|
}
|
|
|
|
@Override // com.ironsource.qe
|
|
public synchronized boolean b(Context context, BasePlacement basePlacement, IronSource.AD_UNIT ad_unit) {
|
|
return a(context, basePlacement, ad_unit) != b.NOT_CAPPED;
|
|
}
|
|
|
|
@Override // com.ironsource.qe.a
|
|
public synchronized void c(Context context, BasePlacement basePlacement, IronSource.AD_UNIT ad_unit) {
|
|
if (context == null || basePlacement == null) {
|
|
return;
|
|
}
|
|
co placementAvailabilitySettings = basePlacement.getPlacementAvailabilitySettings();
|
|
if (placementAvailabilitySettings == null) {
|
|
return;
|
|
}
|
|
a(context, a(ad_unit), basePlacement.getPlacementName(), placementAvailabilitySettings);
|
|
}
|
|
}
|