- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
226 lines
8.1 KiB
Java
226 lines
8.1 KiB
Java
package com.applovin.impl.sdk;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.webkit.WebView;
|
|
import com.applovin.impl.e4;
|
|
import com.applovin.impl.sdk.h;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.sj;
|
|
import com.applovin.impl.yp;
|
|
import com.applovin.sdk.AppLovinPrivacySettings;
|
|
import com.applovin.sdk.AppLovinSdkUtils;
|
|
import com.applovin.sdk.AppLovinUserService;
|
|
import com.applovin.sdk.AppLovinWebViewActivity;
|
|
import csdk.gluads.Consts;
|
|
import java.io.Serializable;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class i implements AppLovinWebViewActivity.EventListener, h.a {
|
|
private static final AtomicBoolean h = new AtomicBoolean();
|
|
private static WeakReference i;
|
|
private final j a;
|
|
private final n b;
|
|
private AppLovinUserService.OnConsentDialogDismissListener c;
|
|
private h d;
|
|
private WeakReference e;
|
|
private com.applovin.impl.p f;
|
|
private AtomicBoolean g = new AtomicBoolean();
|
|
|
|
public class a extends com.applovin.impl.p {
|
|
public a() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityStarted(Activity activity) {
|
|
i.this.e = new WeakReference(activity);
|
|
}
|
|
}
|
|
|
|
public class b extends com.applovin.impl.p {
|
|
public b() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityStarted(Activity activity) {
|
|
if (activity instanceof AppLovinWebViewActivity) {
|
|
if (!i.this.f() || i.i.get() != activity) {
|
|
AppLovinWebViewActivity appLovinWebViewActivity = (AppLovinWebViewActivity) activity;
|
|
WeakReference unused = i.i = new WeakReference(appLovinWebViewActivity);
|
|
appLovinWebViewActivity.loadUrl((String) i.this.a.a(sj.k0), i.this);
|
|
}
|
|
i.h.set(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
public i(j jVar) {
|
|
this.e = new WeakReference(null);
|
|
this.a = jVar;
|
|
this.b = jVar.J();
|
|
if (jVar.G() != null) {
|
|
this.e = new WeakReference(jVar.G());
|
|
}
|
|
j.a(j.l()).a(new a());
|
|
this.d = new h(this, jVar);
|
|
}
|
|
|
|
private void e() {
|
|
this.a.e().b(this.f);
|
|
if (f()) {
|
|
AppLovinWebViewActivity appLovinWebViewActivity = (AppLovinWebViewActivity) i.get();
|
|
i = null;
|
|
if (appLovinWebViewActivity != null) {
|
|
appLovinWebViewActivity.finish();
|
|
AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener = this.c;
|
|
if (onConsentDialogDismissListener != null) {
|
|
onConsentDialogDismissListener.onDismiss();
|
|
this.c = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.sdk.h.a
|
|
public void a() {
|
|
}
|
|
|
|
public void b(final long j) {
|
|
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
i.this.a(j);
|
|
}
|
|
});
|
|
}
|
|
|
|
public boolean f() {
|
|
WeakReference weakReference = i;
|
|
return (weakReference == null || weakReference.get() == null) ? false : true;
|
|
}
|
|
|
|
public void g() {
|
|
if (this.g.getAndSet(true)) {
|
|
return;
|
|
}
|
|
final String str = (String) this.a.a(sj.k0);
|
|
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
i.this.a(str);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.applovin.sdk.AppLovinWebViewActivity.EventListener
|
|
public void onReceivedEvent(String str) {
|
|
if ("accepted".equalsIgnoreCase(str)) {
|
|
AppLovinPrivacySettings.setHasUserConsent(true, j.l());
|
|
e();
|
|
} else if ("rejected".equalsIgnoreCase(str)) {
|
|
AppLovinPrivacySettings.setHasUserConsent(false, j.l());
|
|
a(((Boolean) this.a.a(sj.n0)).booleanValue(), ((Long) this.a.a(sj.s0)).longValue());
|
|
} else if (Consts.PLACEMENT_STATUS_CLOSED.equalsIgnoreCase(str)) {
|
|
a(((Boolean) this.a.a(sj.o0)).booleanValue(), ((Long) this.a.a(sj.t0)).longValue());
|
|
} else if (AppLovinWebViewActivity.EVENT_DISMISSED_VIA_BACK_BUTTON.equalsIgnoreCase(str)) {
|
|
a(((Boolean) this.a.a(sj.p0)).booleanValue(), ((Long) this.a.a(sj.u0)).longValue());
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.sdk.h.a
|
|
public void b() {
|
|
final Activity activity = (Activity) this.e.get();
|
|
if (activity != null) {
|
|
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
i.this.a(activity);
|
|
}
|
|
}, ((Long) this.a.a(sj.m0)).longValue());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(String str) {
|
|
WebView a2 = yp.a(j.l(), "preloading consent dialog", true);
|
|
if (a2 == null) {
|
|
return;
|
|
}
|
|
a2.loadUrl(str);
|
|
}
|
|
|
|
public void a(final Activity activity, final AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener) {
|
|
activity.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
i.this.a(onConsentDialogDismissListener, activity);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener, Activity activity) {
|
|
if (!a(this.a) || h.getAndSet(true)) {
|
|
if (onConsentDialogDismissListener != null) {
|
|
onConsentDialogDismissListener.onDismiss();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
this.e = new WeakReference(activity);
|
|
this.c = onConsentDialogDismissListener;
|
|
this.f = new b();
|
|
this.a.e().a(this.f);
|
|
Intent intent = new Intent(activity, (Class<?>) AppLovinWebViewActivity.class);
|
|
intent.putExtra(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
|
|
intent.putExtra(AppLovinWebViewActivity.INTENT_EXTRA_KEY_IMMERSIVE_MODE_ON, (Serializable) this.a.a(sj.l0));
|
|
activity.startActivity(intent);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(long j) {
|
|
if (n.a()) {
|
|
this.b.a("ConsentDialogManager", "Scheduling repeating consent alert");
|
|
}
|
|
this.d.a(j, this.a, this);
|
|
}
|
|
|
|
private void a(boolean z, long j) {
|
|
e();
|
|
if (z) {
|
|
b(j);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(Activity activity) {
|
|
a(activity, (AppLovinUserService.OnConsentDialogDismissListener) null);
|
|
}
|
|
|
|
private boolean a(j jVar) {
|
|
if (f()) {
|
|
n.h("AppLovinSdk", "Consent dialog already showing");
|
|
return false;
|
|
}
|
|
if (!e4.a(j.l())) {
|
|
n.h("AppLovinSdk", "No internet available, skip showing of consent dialog");
|
|
return false;
|
|
}
|
|
if (!((Boolean) jVar.a(sj.j0)).booleanValue()) {
|
|
if (n.a()) {
|
|
this.b.b("ConsentDialogManager", "Blocked publisher from showing consent dialog");
|
|
}
|
|
return false;
|
|
}
|
|
if (StringUtils.isValidString((String) jVar.a(sj.k0))) {
|
|
return true;
|
|
}
|
|
if (n.a()) {
|
|
this.b.b("ConsentDialogManager", "AdServer returned empty consent dialog URL");
|
|
}
|
|
return false;
|
|
}
|
|
}
|