正在查看: Chaupal v3.2 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Chaupal v3.2 应用的 InAppNotificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.sdk;
import android.R;
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 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.inapp.CTInAppType;
import com.clevertap.android.sdk.inapp.InAppActionType;
import com.clevertap.android.sdk.inapp.e0;
import com.clevertap.android.sdk.inapp.y;
import com.connectsdk.service.DeviceService;
import com.google.ads.interactivemedia.v3.internal.aen;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import r3.f0;
import r3.g0;
import r3.h0;
import r3.i0;
import r3.z;
public final class InAppNotificationActivity extends androidx.fragment.app.h implements e0, z {
private static boolean f8120g = false;
private CleverTapInstanceConfig f8121a;
private CTInAppNotification f8122c;
private WeakReference<e0> f8123d;
private WeakReference<c> f8124e;
private v f8125f;
class a extends androidx.activity.g {
a(boolean z6) {
super(z6);
}
@Override
public void handleOnBackPressed() {
InAppNotificationActivity.this.finish();
InAppNotificationActivity.this.a0(null);
}
}
static class b {
static final int[] f8127a;
static {
int[] iArr = new int[CTInAppType.values().length];
f8127a = iArr;
try {
iArr[CTInAppType.CTInAppTypeCoverHTML.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f8127a[CTInAppType.CTInAppTypeInterstitialHTML.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f8127a[CTInAppType.CTInAppTypeHalfInterstitialHTML.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f8127a[CTInAppType.CTInAppTypeCover.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f8127a[CTInAppType.CTInAppTypeInterstitial.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f8127a[CTInAppType.CTInAppTypeHalfInterstitial.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
f8127a[CTInAppType.CTInAppTypeCoverImageOnly.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
f8127a[CTInAppType.CTInAppTypeInterstitialImageOnly.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
f8127a[CTInAppType.CTInAppTypeHalfInterstitialImageOnly.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
f8127a[CTInAppType.CTInAppTypeAlert.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
}
}
public interface c {
void a();
void b();
}
private com.clevertap.android.sdk.inapp.e Y() {
CTInAppType w6 = this.f8122c.w();
switch (b.f8127a[w6.ordinal()]) {
case 1:
return new com.clevertap.android.sdk.inapp.k();
case 2:
return new com.clevertap.android.sdk.inapp.o();
case 3:
return new com.clevertap.android.sdk.inapp.m();
case 4:
return new com.clevertap.android.sdk.inapp.p();
case 5:
return new com.clevertap.android.sdk.inapp.x();
case 6:
return new com.clevertap.android.sdk.inapp.s();
case 7:
return new com.clevertap.android.sdk.inapp.q();
case 8:
return new y();
case 9:
return new com.clevertap.android.sdk.inapp.t();
case 10:
o0();
return null;
default:
this.f8121a.p().verbose("InAppNotificationActivity: Unhandled InApp Type: " + w6);
return null;
}
}
private Bundle Z(CTInAppNotificationButton cTInAppNotificationButton) {
e0 d02 = d0();
if (d02 != null) {
return d02.d(this.f8122c, cTInAppNotificationButton, this);
}
return null;
}
private String c0() {
return this.f8121a.c() + ":CT_INAPP_CONTENT_FRAGMENT";
}
public void e0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
k0(cTInAppNotificationButton, true);
}
public void f0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
k0(cTInAppNotificationButton, false);
}
public void g0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
l0(cTInAppNotificationButton);
}
public void h0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
l0(cTInAppNotificationButton);
}
public void i0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i7) {
l0(cTInAppNotificationButton);
}
private void k0(CTInAppNotificationButton cTInAppNotificationButton, boolean z6) {
Bundle Z = Z(cTInAppNotificationButton);
if (z6 && this.f8122c.U()) {
p0(this.f8122c.d());
return;
}
CTInAppAction a7 = cTInAppNotificationButton.a();
if (a7 == null || InAppActionType.REQUEST_FOR_PERMISSIONS != a7.k()) {
a0(Z);
} else {
p0(a7.m());
}
}
private void l0(CTInAppNotificationButton cTInAppNotificationButton) {
a0(Z(cTInAppNotificationButton));
}
private void o0() {
AlertDialog create;
ArrayList<CTInAppNotificationButton> k7 = this.f8122c.k();
if (k7.isEmpty()) {
this.f8121a.p().f("InAppNotificationActivity: Notification has no buttons, not showing Alert InApp");
return;
}
CTInAppNotificationButton cTInAppNotificationButton = k7.get(0);
if (Build.VERSION.SDK_INT >= 21) {
create = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.f8122c.F()).setMessage(this.f8122c.B()).setPositiveButton((CharSequence) cTInAppNotificationButton.i(), (DialogInterface.OnClickListener) new f0(this, cTInAppNotificationButton)).create();
if (this.f8122c.k().size() == 2) {
CTInAppNotificationButton cTInAppNotificationButton2 = k7.get(1);
create.setButton(-2, (CharSequence) cTInAppNotificationButton2.i(), (DialogInterface.OnClickListener) new i0(this, cTInAppNotificationButton2));
}
} else {
create = new AlertDialog.Builder(this).setCancelable(false).setTitle(this.f8122c.F()).setMessage(this.f8122c.B()).setPositiveButton((CharSequence) cTInAppNotificationButton.i(), (DialogInterface.OnClickListener) new h0(this, cTInAppNotificationButton)).create();
if (this.f8122c.k().size() == 2) {
CTInAppNotificationButton cTInAppNotificationButton3 = k7.get(1);
create.setButton(-2, (CharSequence) cTInAppNotificationButton3.i(), (DialogInterface.OnClickListener) new g0(this, cTInAppNotificationButton3));
}
}
if (k7.size() > 2) {
CTInAppNotificationButton cTInAppNotificationButton4 = k7.get(2);
create.setButton(-3, (CharSequence) cTInAppNotificationButton4.i(), (DialogInterface.OnClickListener) new r3.e0(this, cTInAppNotificationButton4));
}
create.show();
f8120g = true;
b0(null);
}
@Override
public void E(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
b0(bundle);
}
@Override
public void I(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
a0(bundle);
}
@Override
public Bundle J(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppAction cTInAppAction, @NonNull String str, Bundle bundle, Context context) {
e0 d02 = d0();
if (d02 != null) {
return d02.J(cTInAppNotification, cTInAppAction, str, bundle, this);
}
return null;
}
@Override
public void K(boolean z6) {
p0(z6);
}
void a0(Bundle bundle) {
CTInAppNotification cTInAppNotification;
if (f8120g) {
f8120g = false;
}
finish();
e0 d02 = d0();
if (d02 == null || (cTInAppNotification = this.f8122c) == null) {
return;
}
d02.I(cTInAppNotification, bundle);
}
void b0(Bundle bundle) {
e0 d02 = d0();
if (d02 != null) {
d02.E(this.f8122c, bundle);
}
}
@Override
public Bundle d(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppNotificationButton cTInAppNotificationButton, Context context) {
e0 d02 = d0();
if (d02 != null) {
return d02.d(cTInAppNotification, cTInAppNotificationButton, this);
}
return null;
}
e0 d0() {
e0 e0Var;
try {
e0Var = this.f8123d.get();
} catch (Throwable unused) {
e0Var = null;
}
if (e0Var == null) {
this.f8121a.p().a(this.f8121a.c(), "InAppActivityListener is null for notification: " + this.f8122c.y());
}
return e0Var;
}
@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);
}
}
public void j0() {
this.f8124e.get().b();
}
void m0(e0 e0Var) {
this.f8123d = new WeakReference<>(e0Var);
}
public void n0(c cVar) {
this.f8124e = new WeakReference<>(cVar);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
getOnBackPressedDispatcher().c(this, new a(true));
int i7 = getResources().getConfiguration().orientation;
if (i7 == 2) {
getWindow().addFlags(aen.f10468r);
}
try {
Bundle extras = getIntent().getExtras();
if (extras == null) {
throw new IllegalArgumentException();
}
this.f8122c = (CTInAppNotification) extras.getParcelable("inApp");
boolean z6 = extras.getBoolean("displayHardPermissionDialog", false);
Bundle bundle2 = extras.getBundle("configBundle");
if (bundle2 != null) {
this.f8121a = (CleverTapInstanceConfig) bundle2.getParcelable(DeviceService.KEY_CONFIG);
}
m0(CleverTapAPI.V(this, this.f8121a).E().l());
n0(CleverTapAPI.V(this, this.f8121a).E().l());
this.f8125f = new v(this, this.f8121a);
if (z6) {
p0(extras.getBoolean("shouldShowFallbackSettings", false));
return;
}
CTInAppNotification cTInAppNotification = this.f8122c;
if (cTInAppNotification == null) {
finish();
return;
}
if (cTInAppNotification.V() && !this.f8122c.T()) {
if (i7 == 2) {
t.b("App in Landscape, dismissing portrait InApp Notification");
finish();
a0(null);
return;
}
t.b("App in Portrait, displaying InApp Notification anyway");
}
if (!this.f8122c.V() && this.f8122c.T()) {
if (i7 == 1) {
t.b("App in Portrait, dismissing landscape InApp Notification");
finish();
a0(null);
return;
}
t.b("App in Landscape, displaying InApp Notification anyway");
}
if (bundle != null) {
if (f8120g) {
Y();
return;
}
return;
}
com.clevertap.android.sdk.inapp.e Y = Y();
if (Y != null) {
Bundle bundle3 = new Bundle();
bundle3.putParcelable("inApp", this.f8122c);
bundle3.putParcelable(DeviceService.KEY_CONFIG, this.f8121a);
Y.setArguments(bundle3);
getSupportFragmentManager().q().s(R.animator.fade_in, R.animator.fade_out).c(R.id.content, Y, c0()).k();
}
} catch (Throwable th) {
t.t("Cannot find a valid notification bundle to show!", th);
finish();
}
}
@Override
public void onRequestPermissionsResult(int i7, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i7, strArr, iArr);
boolean z6 = false;
r3.h.c(this, this.f8121a).e(false);
r3.h.f(this, this.f8121a);
if (i7 == 102) {
if (iArr.length > 0 && iArr[0] == 0) {
z6 = true;
}
if (z6) {
this.f8124e.get().a();
} else {
this.f8124e.get().b();
}
a0(null);
}
}
@Override
protected void onResume() {
super.onResume();
if (!this.f8125f.c() || Build.VERSION.SDK_INT < 33) {
return;
}
if (androidx.core.content.a.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
this.f8124e.get().a();
} else {
this.f8124e.get().b();
}
a0(null);
}
public void p0(boolean z6) {
this.f8125f.i(z6, this.f8124e.get());
}
@Override
public void setTheme(int i7) {
super.setTheme(R.style.Theme.Translucent.NoTitleBar);
}
}