正在查看: FanCode v7.24.0 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: FanCode v7.24.0 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.sdk;
import android.R;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import com.clevertap.android.sdk.InAppNotificationActivity;
import com.clevertap.android.sdk.inapp.CTInAppAction;
import com.clevertap.android.sdk.inapp.CTInAppNotification;
import com.clevertap.android.sdk.inapp.CTInAppNotificationButton;
import com.connectsdk.service.DeviceService;
import com.newrelic.agent.android.api.v2.TraceFieldInterface;
import com.newrelic.agent.android.background.ApplicationStateMonitor;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.tracing.Trace;
import com.newrelic.agent.android.tracing.TraceMachine;
import d6.t0;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@Instrumented
public final class InAppNotificationActivity extends FragmentActivity implements l6.o, t0, TraceFieldInterface {
private static boolean f9368n = false;
private CleverTapInstanceConfig f9369a;
private CTInAppNotification f9370b;
private WeakReference<l6.o> f9371c;
private WeakReference<c> f9372d;
private v f9373e;
private boolean f9374i = false;
public Trace f9375k;
class a extends androidx.activity.t {
a(boolean z9) {
super(z9);
}
@Override
public void d() {
InAppNotificationActivity.this.finish();
InAppNotificationActivity.this.w(null);
}
}
static class b {
static final int[] f9377a;
static {
int[] iArr = new int[l6.h.values().length];
f9377a = iArr;
try {
iArr[l6.h.CTInAppTypeCoverHTML.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f9377a[l6.h.CTInAppTypeInterstitialHTML.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f9377a[l6.h.CTInAppTypeHalfInterstitialHTML.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f9377a[l6.h.CTInAppTypeCover.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f9377a[l6.h.CTInAppTypeInterstitial.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f9377a[l6.h.CTInAppTypeHalfInterstitial.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
f9377a[l6.h.CTInAppTypeCoverImageOnly.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
f9377a[l6.h.CTInAppTypeInterstitialImageOnly.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
f9377a[l6.h.CTInAppTypeHalfInterstitialImageOnly.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
f9377a[l6.h.CTInAppTypeAlert.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
}
}
public interface c {
void b();
void c();
}
public void B(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i9) {
F(cTInAppNotificationButton, true);
}
public void C(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i9) {
F(cTInAppNotificationButton, false);
}
public void D(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i9) {
G(cTInAppNotificationButton);
}
private void F(CTInAppNotificationButton cTInAppNotificationButton, boolean z9) {
Bundle v9 = v(cTInAppNotificationButton);
if (z9 && this.f9370b.X()) {
K(this.f9370b.d());
return;
}
CTInAppAction a9 = cTInAppNotificationButton.a();
if (a9 == null || l6.k.REQUEST_FOR_PERMISSIONS != a9.j()) {
w(v9);
} else {
K(a9.l());
}
}
private void G(CTInAppNotificationButton cTInAppNotificationButton) {
w(v(cTInAppNotificationButton));
}
private void J() {
ArrayList<CTInAppNotificationButton> i9 = this.f9370b.i();
if (i9.isEmpty()) {
this.f9369a.q().f("InAppNotificationActivity: Notification has no buttons, not showing Alert InApp");
return;
}
final CTInAppNotificationButton cTInAppNotificationButton = i9.get(0);
AlertDialog create = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.f9370b.B()).setMessage(this.f9370b.x()).setPositiveButton(cTInAppNotificationButton.e(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
InAppNotificationActivity.this.B(cTInAppNotificationButton, dialogInterface, i10);
}
}).create();
if (this.f9370b.i().size() == 2) {
final CTInAppNotificationButton cTInAppNotificationButton2 = i9.get(1);
create.setButton(-2, cTInAppNotificationButton2.e(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
InAppNotificationActivity.this.C(cTInAppNotificationButton2, dialogInterface, i10);
}
});
}
if (i9.size() > 2) {
final CTInAppNotificationButton cTInAppNotificationButton3 = i9.get(2);
create.setButton(-3, cTInAppNotificationButton3.e(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
InAppNotificationActivity.this.D(cTInAppNotificationButton3, dialogInterface, i10);
}
});
}
create.show();
f9368n = true;
y(null);
}
private com.clevertap.android.sdk.inapp.b u() {
l6.h s9 = this.f9370b.s();
switch (b.f9377a[s9.ordinal()]) {
case 1:
return new com.clevertap.android.sdk.inapp.h();
case 2:
return new l6.e();
case 3:
return new l6.d();
case 4:
return new com.clevertap.android.sdk.inapp.k();
case 5:
return new com.clevertap.android.sdk.inapp.q();
case 6:
return new com.clevertap.android.sdk.inapp.n();
case 7:
return new com.clevertap.android.sdk.inapp.l();
case 8:
return new com.clevertap.android.sdk.inapp.r();
case 9:
return new com.clevertap.android.sdk.inapp.o();
case 10:
J();
return null;
default:
this.f9369a.q().verbose("InAppNotificationActivity: Unhandled InApp Type: " + s9);
return null;
}
}
private Bundle v(CTInAppNotificationButton cTInAppNotificationButton) {
l6.o A = A();
if (A != null) {
return A.a(this.f9370b, cTInAppNotificationButton, this);
}
return null;
}
private String z() {
return this.f9369a.e() + ":CT_INAPP_CONTENT_FRAGMENT";
}
l6.o A() {
l6.o oVar;
try {
oVar = this.f9371c.get();
} catch (Throwable unused) {
oVar = null;
}
if (oVar == null) {
this.f9369a.q().a(this.f9369a.e(), "InAppActivityListener is null for notification: " + this.f9370b.u());
}
return oVar;
}
public void E() {
this.f9372d.get().c();
}
void H(l6.o oVar) {
this.f9371c = new WeakReference<>(oVar);
}
public void I(c cVar) {
this.f9372d = new WeakReference<>(cVar);
}
@SuppressLint({"NewApi"})
public void K(boolean z9) {
this.f9373e.i(z9, this.f9372d.get());
}
@Override
public Bundle a(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppNotificationButton cTInAppNotificationButton, Context context) {
l6.o A = A();
if (A != null) {
return A.a(cTInAppNotification, cTInAppNotificationButton, this);
}
return null;
}
@Override
public void d(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
y(bundle);
}
@Override
public void e(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
w(bundle);
}
@Override
public Bundle f(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppAction cTInAppAction, @NonNull String str, Bundle bundle, Context context) {
l6.o A = A();
if (A != null) {
return A.f(cTInAppNotification, cTInAppAction, str, bundle, this);
}
return null;
}
@Override
@SuppressLint({"WrongConstant"})
public void finish() {
super.finish();
if (Build.VERSION.SDK_INT >= 34) {
overrideActivityTransition(1, R.anim.fade_in, R.anim.fade_out);
} else {
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
}
@Override
public void g(boolean z9) {
K(z9);
}
@Override
public void onCreate(Bundle bundle) {
TraceMachine.startTracing("InAppNotificationActivity");
try {
TraceMachine.enterMethod(this.f9375k, "InAppNotificationActivity#onCreate", (ArrayList) null);
} catch (NoSuchFieldError unused) {
TraceMachine.enterMethod((Trace) null, "InAppNotificationActivity#onCreate", (ArrayList) null);
}
super.onCreate(bundle);
getOnBackPressedDispatcher().h(this, new a(true));
int i9 = getResources().getConfiguration().orientation;
if (i9 == 2) {
getWindow().addFlags(1024);
}
try {
Bundle extras = getIntent().getExtras();
if (extras == null) {
IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
TraceMachine.exitMethod();
throw illegalArgumentException;
}
this.f9370b = (CTInAppNotification) extras.getParcelable("inApp");
boolean z9 = extras.getBoolean("displayHardPermissionDialog", false);
Bundle bundle2 = extras.getBundle("configBundle");
if (bundle2 != null) {
this.f9369a = (CleverTapInstanceConfig) bundle2.getParcelable(DeviceService.KEY_CONFIG);
}
H(h.a1(this, this.f9369a).q0().o());
I(h.a1(this, this.f9369a).q0().o());
this.f9373e = new v(this, this.f9369a);
if (z9) {
K(extras.getBoolean("shouldShowFallbackSettings", false));
TraceMachine.exitMethod();
return;
}
CTInAppNotification cTInAppNotification = this.f9370b;
if (cTInAppNotification == null) {
finish();
TraceMachine.exitMethod();
return;
}
if (cTInAppNotification.Y() && !this.f9370b.S()) {
if (i9 == 2) {
t.b("App in Landscape, dismissing portrait InApp Notification");
finish();
w(null);
TraceMachine.exitMethod();
return;
}
t.b("App in Portrait, displaying InApp Notification anyway");
}
if (!this.f9370b.Y() && this.f9370b.S()) {
if (i9 == 1) {
t.b("App in Portrait, dismissing landscape InApp Notification");
finish();
w(null);
TraceMachine.exitMethod();
return;
}
t.b("App in Landscape, displaying InApp Notification anyway");
}
if (bundle == null) {
com.clevertap.android.sdk.inapp.b u9 = u();
if (u9 != null) {
Bundle bundle3 = new Bundle();
bundle3.putParcelable("inApp", this.f9370b);
bundle3.putParcelable(DeviceService.KEY_CONFIG, this.f9369a);
u9.setArguments(bundle3);
getSupportFragmentManager().p().v(R.animator.fade_in, R.animator.fade_out).c(R.id.content, u9, z()).j();
}
} else if (f9368n) {
u();
}
TraceMachine.exitMethod();
} catch (Throwable th) {
t.t("Cannot find a valid notification bundle to show!", th);
finish();
TraceMachine.exitMethod();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (isChangingConfigurations()) {
return;
}
x(null, false);
}
@Override
public void onRequestPermissionsResult(int i9, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i9, strArr, iArr);
boolean z9 = false;
d6.i.c(this, this.f9369a).e(false);
d6.i.f(this, this.f9369a);
if (i9 == 102) {
if (iArr.length > 0 && iArr[0] == 0) {
z9 = true;
}
if (z9) {
this.f9372d.get().b();
} else {
this.f9372d.get().c();
}
w(null);
}
}
@Override
protected void onResume() {
super.onResume();
if (!this.f9373e.c() || Build.VERSION.SDK_INT < 33) {
return;
}
if (androidx.core.content.a.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
this.f9372d.get().b();
} else {
this.f9372d.get().c();
}
w(null);
}
@Override
protected void onStart() {
super.onStart();
ApplicationStateMonitor.getInstance().activityStarted();
}
@Override
protected void onStop() {
super.onStop();
ApplicationStateMonitor.getInstance().activityStopped();
}
@Override
public void setTheme(int i9) {
super.setTheme(R.style.Theme.Translucent.NoTitleBar);
}
void w(Bundle bundle) {
x(bundle, true);
}
void x(Bundle bundle, boolean z9) {
CTInAppNotification cTInAppNotification;
if (f9368n) {
f9368n = false;
}
if (!this.f9374i) {
l6.o A = A();
if (A != null && (cTInAppNotification = this.f9370b) != null) {
A.e(cTInAppNotification, bundle);
}
this.f9374i = true;
}
if (z9) {
finish();
}
}
void y(Bundle bundle) {
l6.o A = A();
if (A != null) {
A.d(this.f9370b, bundle);
}
}
}