正在查看: Namma Yatri v3.3.7 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Namma Yatri v3.3.7 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.sdk;
import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import androidx.activity.F;
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.clevertap.android.sdk.t;
import j0.C1311h;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import k3.InterfaceC1369k0;
import s3.C1568d;
import s3.InterfaceC1561A;
public final class InAppNotificationActivity extends FragmentActivity implements InterfaceC1561A, InterfaceC1369k0, t.c {
private static boolean f17000f = false;
private CleverTapInstanceConfig f17001a;
private CTInAppNotification f17002b;
private WeakReference f17003c;
private t f17004d;
private boolean f17005e = false;
class a extends F {
a(boolean z6) {
super(z6);
}
@Override
public void handleOnBackPressed() {
InAppNotificationActivity.this.finish();
InAppNotificationActivity.this.P(null);
}
}
static class b {
static final int[] f17007a;
static {
int[] iArr = new int[s3.n.values().length];
f17007a = iArr;
try {
iArr[s3.n.CTInAppTypeCoverHTML.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f17007a[s3.n.CTInAppTypeInterstitialHTML.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f17007a[s3.n.CTInAppTypeHalfInterstitialHTML.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f17007a[s3.n.CTInAppTypeCover.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f17007a[s3.n.CTInAppTypeInterstitial.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f17007a[s3.n.CTInAppTypeHalfInterstitial.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
f17007a[s3.n.CTInAppTypeCoverImageOnly.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
f17007a[s3.n.CTInAppTypeInterstitialImageOnly.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
f17007a[s3.n.CTInAppTypeHalfInterstitialImageOnly.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
f17007a[s3.n.CTInAppTypeAlert.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
}
}
private com.clevertap.android.sdk.inapp.b N() {
s3.n H6 = this.f17002b.H();
switch (b.f17007a[H6.ordinal()]) {
case 1:
return new com.clevertap.android.sdk.inapp.h();
case 2:
return new s3.g();
case 3:
return new C1568d();
case 4:
return new com.clevertap.android.sdk.inapp.k();
case 5:
return new com.clevertap.android.sdk.inapp.q();
case C1311h.STRING_SET_FIELD_NUMBER:
return new com.clevertap.android.sdk.inapp.n();
case C1311h.DOUBLE_FIELD_NUMBER:
return new com.clevertap.android.sdk.inapp.l();
case C1311h.BYTES_FIELD_NUMBER:
return new com.clevertap.android.sdk.inapp.r();
case 9:
return new com.clevertap.android.sdk.inapp.o();
case 10:
c0();
return null;
default:
this.f17001a.z().a("InAppNotificationActivity: Unhandled InApp Type: " + H6);
return null;
}
}
private Bundle O(CTInAppNotificationButton cTInAppNotificationButton) {
InterfaceC1561A T6 = T();
if (T6 != null) {
return T6.b(this.f17002b, cTInAppNotificationButton, this);
}
return null;
}
private String S() {
return this.f17001a.h() + ":CT_INAPP_CONTENT_FRAGMENT";
}
public void U(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
Z(cTInAppNotificationButton, true);
}
public void V(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
Z(cTInAppNotificationButton, false);
}
public void W(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
a0(cTInAppNotificationButton);
}
public static void X(Context context, CTInAppNotification cTInAppNotification, CleverTapInstanceConfig cleverTapInstanceConfig) {
Intent intent = new Intent(context, (Class<?>) InAppNotificationActivity.class);
intent.putExtra("inApp", cTInAppNotification);
intent.putExtra("config", cleverTapInstanceConfig);
context.startActivity(intent);
}
public static void Y(Activity activity, CleverTapInstanceConfig cleverTapInstanceConfig, boolean z6) {
if (activity.getClass().equals(InAppNotificationActivity.class)) {
return;
}
Intent intent = new Intent(activity, (Class<?>) InAppNotificationActivity.class);
intent.putExtra("config", cleverTapInstanceConfig);
intent.putExtra("displayPushPermissionPrompt", true);
intent.putExtra("shouldShowFallbackSettings", z6);
activity.startActivity(intent);
}
private void Z(CTInAppNotificationButton cTInAppNotificationButton, boolean z6) {
Bundle O6 = O(cTInAppNotificationButton);
if (z6 && this.f17002b.s0()) {
d0(this.f17002b.e());
return;
}
CTInAppAction a7 = cTInAppNotificationButton.a();
if (a7 == null || com.clevertap.android.sdk.inapp.t.f17326g != a7.m()) {
P(O6);
} else {
d0(a7.o());
}
}
private void a0(CTInAppNotificationButton cTInAppNotificationButton) {
P(O(cTInAppNotificationButton));
}
private void c0() {
ArrayList m7 = this.f17002b.m();
if (m7.isEmpty()) {
this.f17001a.z().g("InAppNotificationActivity: Notification has no buttons, not showing Alert InApp");
return;
}
final CTInAppNotificationButton cTInAppNotificationButton = (CTInAppNotificationButton) m7.get(0);
AlertDialog create = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.f17002b.U()).setMessage(this.f17002b.O()).setPositiveButton(cTInAppNotificationButton.g(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
InAppNotificationActivity.this.U(cTInAppNotificationButton, dialogInterface, i7);
}
}).create();
if (this.f17002b.m().size() == 2) {
final CTInAppNotificationButton cTInAppNotificationButton2 = (CTInAppNotificationButton) m7.get(1);
create.setButton(-2, cTInAppNotificationButton2.g(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
InAppNotificationActivity.this.V(cTInAppNotificationButton2, dialogInterface, i7);
}
});
}
if (m7.size() > 2) {
final CTInAppNotificationButton cTInAppNotificationButton3 = (CTInAppNotificationButton) m7.get(2);
create.setButton(-3, cTInAppNotificationButton3.g(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
InAppNotificationActivity.this.W(cTInAppNotificationButton3, dialogInterface, i7);
}
});
}
create.show();
f17000f = true;
R(null);
}
void P(Bundle bundle) {
Q(bundle, true);
}
void Q(Bundle bundle, boolean z6) {
CTInAppNotification cTInAppNotification;
if (f17000f) {
f17000f = false;
}
if (!this.f17005e) {
InterfaceC1561A T6 = T();
if (T6 != null && (cTInAppNotification = this.f17002b) != null) {
T6.g(cTInAppNotification, bundle);
}
this.f17005e = true;
}
if (z6) {
finish();
}
}
void R(Bundle bundle) {
InterfaceC1561A T6 = T();
if (T6 != null) {
T6.f(this.f17002b, bundle);
}
}
InterfaceC1561A T() {
InterfaceC1561A interfaceC1561A;
try {
interfaceC1561A = (InterfaceC1561A) this.f17003c.get();
} catch (Throwable unused) {
interfaceC1561A = null;
}
if (interfaceC1561A == null && this.f17002b != null) {
this.f17001a.z().b(this.f17001a.h(), "InAppActivityListener is null for notification: " + this.f17002b.K());
}
return interfaceC1561A;
}
@Override
public Bundle b(CTInAppNotification cTInAppNotification, CTInAppNotificationButton cTInAppNotificationButton, Context context) {
InterfaceC1561A T6 = T();
if (T6 != null) {
return T6.b(cTInAppNotification, cTInAppNotificationButton, this);
}
return null;
}
void b0(InterfaceC1561A interfaceC1561A) {
this.f17003c = new WeakReference(interfaceC1561A);
}
public void d0(boolean z6) {
this.f17004d.g(this, z6);
}
@Override
public void f(CTInAppNotification cTInAppNotification, Bundle bundle) {
R(bundle);
}
@Override
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(CTInAppNotification cTInAppNotification, Bundle bundle) {
P(bundle);
}
@Override
public Bundle h(CTInAppNotification cTInAppNotification, CTInAppAction cTInAppAction, String str, Bundle bundle, Context context) {
InterfaceC1561A T6 = T();
if (T6 != null) {
return T6.h(cTInAppNotification, cTInAppAction, str, bundle, this);
}
return null;
}
@Override
public void i(boolean z6) {
P(null);
}
@Override
public void j(boolean z6) {
d0(z6);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
getOnBackPressedDispatcher().i(this, new a(true));
int i7 = getResources().getConfiguration().orientation;
if (i7 == 2) {
getWindow().addFlags(1024);
}
try {
Bundle extras = getIntent().getExtras();
if (extras == null) {
throw new IllegalArgumentException();
}
CleverTapInstanceConfig cleverTapInstanceConfig = (CleverTapInstanceConfig) extras.getParcelable("config");
this.f17001a = cleverTapInstanceConfig;
if (cleverTapInstanceConfig == null) {
throw new IllegalArgumentException();
}
m p02 = i.a1(this, cleverTapInstanceConfig).p0();
this.f17004d = new t(this.f17001a, p02.f().q(), this);
if (extras.getBoolean("displayPushPermissionPrompt", false)) {
d0(extras.getBoolean("shouldShowFallbackSettings", false));
return;
}
b0(p02.o());
CTInAppNotification cTInAppNotification = (CTInAppNotification) extras.getParcelable("inApp");
this.f17002b = cTInAppNotification;
if (cTInAppNotification == null) {
finish();
return;
}
if (cTInAppNotification.t0() && !this.f17002b.r0()) {
if (i7 == 2) {
r.c("App in Landscape, dismissing portrait InApp Notification");
finish();
P(null);
return;
}
r.c("App in Portrait, displaying InApp Notification anyway");
}
if (!this.f17002b.t0() && this.f17002b.r0()) {
if (i7 == 1) {
r.c("App in Portrait, dismissing landscape InApp Notification");
finish();
P(null);
return;
}
r.c("App in Landscape, displaying InApp Notification anyway");
}
if (bundle != null) {
if (f17000f) {
N();
return;
}
return;
}
com.clevertap.android.sdk.inapp.b N6 = N();
if (N6 != null) {
Bundle bundle2 = new Bundle();
bundle2.putParcelable("inApp", this.f17002b);
bundle2.putParcelable("config", this.f17001a);
N6.setArguments(bundle2);
getSupportFragmentManager().p().s(R.animator.fade_in, R.animator.fade_out).c(R.id.content, N6, S()).j();
}
} catch (Throwable th) {
r.u("Cannot find a valid notification bundle to show!", th);
finish();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (isChangingConfigurations()) {
return;
}
Q(null, false);
}
@Override
public void onRequestPermissionsResult(int i7, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i7, strArr, iArr);
this.f17004d.f(this, i7, iArr);
}
@Override
protected void onResume() {
super.onResume();
this.f17004d.e(this);
}
@Override
public void setTheme(int i7) {
super.setTheme(R.style.Theme.Translucent.NoTitleBar);
}
}