导航菜单

页面标题

页面副标题

Oolka v2.4.42 - InAppNotificationActivity.java 源代码

正在查看: Oolka v2.4.42 应用的 InAppNotificationActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.clevertap.android.sdk;

import android.R;
import android.annotation.SuppressLint;
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.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import com.clevertap.android.sdk.a2;
import com.clevertap.android.sdk.inapp.CTInAppAction;
import com.clevertap.android.sdk.inapp.CTInAppBaseFullFragment;
import com.clevertap.android.sdk.inapp.CTInAppHtmlCoverFragment;
import com.clevertap.android.sdk.inapp.CTInAppHtmlHalfInterstitialFragment;
import com.clevertap.android.sdk.inapp.CTInAppHtmlInterstitialFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeCoverFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeCoverImageFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeHalfInterstitialFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeHalfInterstitialImageFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeInterstitialFragment;
import com.clevertap.android.sdk.inapp.CTInAppNativeInterstitialImageFragment;
import com.clevertap.android.sdk.inapp.CTInAppNotification;
import com.clevertap.android.sdk.inapp.CTInAppNotificationButton;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

public final class InAppNotificationActivity extends FragmentActivity implements com.clevertap.android.sdk.inapp.a0, e1, a2.c {
    public static boolean C0 = false;
    public boolean A0 = false;
    public CleverTapInstanceConfig G;
    public CTInAppNotification H;
    public WeakReference<com.clevertap.android.sdk.inapp.a0> I;
    public a2 c0;

    public class a extends androidx.activity.z {
        public a(boolean z) {
            super(z);
        }

        public void handleOnBackPressed() {
            InAppNotificationActivity.this.finish();
            InAppNotificationActivity.this.p0(null);
        }
    }

    public static class b {
        public static final int[] a;

        static {
            int[] iArr = new int[com.clevertap.android.sdk.inapp.l.values().length];
            a = iArr;
            try {
                iArr[com.clevertap.android.sdk.inapp.l.CTInAppTypeCoverHTML.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeInterstitialHTML.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeHalfInterstitialHTML.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeCover.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeInterstitial.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeHalfInterstitial.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeCoverImageOnly.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeInterstitialImageOnly.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeHalfInterstitialImageOnly.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[com.clevertap.android.sdk.inapp.l.CTInAppTypeAlert.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
        }
    }

    public void u0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        z0(cTInAppNotificationButton, true);
    }

    public void v0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        z0(cTInAppNotificationButton, false);
    }

    public void w0(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        A0(cTInAppNotificationButton);
    }

    public static void x0(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 y0(Activity activity, CleverTapInstanceConfig cleverTapInstanceConfig, boolean z) {
        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", z);
        activity.startActivity(intent);
    }

    public final void A0(CTInAppNotificationButton cTInAppNotificationButton) {
        p0(o0(cTInAppNotificationButton));
    }

    public void B0(com.clevertap.android.sdk.inapp.a0 a0Var) {
        this.I = new WeakReference<>(a0Var);
    }

    public final void C0() {
        ArrayList<CTInAppNotificationButton> i = this.H.i();
        if (i.isEmpty()) {
            this.G.q().g("InAppNotificationActivity: Notification has no buttons, not showing Alert InApp");
            return;
        }
        final CTInAppNotificationButton cTInAppNotificationButton = i.get(0);
        AlertDialog create = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.H.A()).setMessage(this.H.w()).setPositiveButton(cTInAppNotificationButton.e(), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                InAppNotificationActivity.this.u0(cTInAppNotificationButton, dialogInterface, i2);
            }
        }).create();
        if (this.H.i().size() == 2) {
            final CTInAppNotificationButton cTInAppNotificationButton2 = i.get(1);
            create.setButton(-2, cTInAppNotificationButton2.e(), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    InAppNotificationActivity.this.v0(cTInAppNotificationButton2, dialogInterface, i2);
                }
            });
        }
        if (i.size() > 2) {
            final CTInAppNotificationButton cTInAppNotificationButton3 = i.get(2);
            create.setButton(-3, cTInAppNotificationButton3.e(), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    InAppNotificationActivity.this.w0(cTInAppNotificationButton3, dialogInterface, i2);
                }
            });
        }
        create.show();
        C0 = true;
        r0(null);
    }

    @Override
    public void D(boolean z) {
        D0(z);
    }

    public void D0(boolean z) {
        this.c0.g(this, z);
    }

    @Override
    public Bundle e(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppNotificationButton cTInAppNotificationButton, Context context) {
        com.clevertap.android.sdk.inapp.a0 t0 = t0();
        if (t0 != null) {
            return t0.e(cTInAppNotification, cTInAppNotificationButton, this);
        }
        return null;
    }

    @SuppressLint({"WrongConstant"})
    public void finish() {
        super/*android.app.Activity*/.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 final CTInAppBaseFullFragment n0() {
        com.clevertap.android.sdk.inapp.l s = this.H.s();
        switch (b.a[s.ordinal()]) {
            case 1:
                return new CTInAppHtmlCoverFragment();
            case 2:
                return new CTInAppHtmlInterstitialFragment();
            case 3:
                return new CTInAppHtmlHalfInterstitialFragment();
            case 4:
                return new CTInAppNativeCoverFragment();
            case 5:
                return new CTInAppNativeInterstitialFragment();
            case 6:
                return new CTInAppNativeHalfInterstitialFragment();
            case 7:
                return new CTInAppNativeCoverImageFragment();
            case 8:
                return new CTInAppNativeInterstitialImageFragment();
            case 9:
                return new CTInAppNativeHalfInterstitialImageFragment();
            case 10:
                C0();
                return null;
            default:
                this.G.q().a("InAppNotificationActivity: Unhandled InApp Type: " + s);
                return null;
        }
    }

    public final Bundle o0(CTInAppNotificationButton cTInAppNotificationButton) {
        com.clevertap.android.sdk.inapp.a0 t0 = t0();
        if (t0 != null) {
            return t0.e(this.H, cTInAppNotificationButton, this);
        }
        return null;
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getOnBackPressedDispatcher().i(this, new a(true));
        int i = getResources().getConfiguration().orientation;
        if (i == 2) {
            getWindow().addFlags(1024);
        }
        try {
            Bundle extras = getIntent().getExtras();
            if (extras == null) {
                throw new IllegalArgumentException();
            }
            CleverTapInstanceConfig cleverTapInstanceConfig = (CleverTapInstanceConfig) extras.getParcelable("config");
            this.G = cleverTapInstanceConfig;
            if (cleverTapInstanceConfig == null) {
                throw new IllegalArgumentException();
            }
            CoreState m0 = n0.R0(this, cleverTapInstanceConfig).m0();
            this.c0 = new a2(this.G, m0.f().q(), this);
            if (extras.getBoolean("displayPushPermissionPrompt", false)) {
                D0(extras.getBoolean("shouldShowFallbackSettings", false));
                return;
            }
            B0(m0.o());
            CTInAppNotification cTInAppNotification = (CTInAppNotification) extras.getParcelable("inApp");
            this.H = cTInAppNotification;
            if (cTInAppNotification == null) {
                finish();
                return;
            }
            if (cTInAppNotification.Q() && !this.H.O()) {
                if (i == 2) {
                    w1.c("App in Landscape, dismissing portrait InApp Notification");
                    finish();
                    p0(null);
                    return;
                }
                w1.c("App in Portrait, displaying InApp Notification anyway");
            }
            if (!this.H.Q() && this.H.O()) {
                if (i == 1) {
                    w1.c("App in Portrait, dismissing landscape InApp Notification");
                    finish();
                    p0(null);
                    return;
                }
                w1.c("App in Landscape, displaying InApp Notification anyway");
            }
            if (bundle != null) {
                if (C0) {
                    n0();
                    return;
                }
                return;
            }
            CTInAppBaseFullFragment n0 = n0();
            if (n0 != null) {
                Bundle bundle2 = new Bundle();
                bundle2.putParcelable("inApp", this.H);
                bundle2.putParcelable("config", this.G);
                n0.setArguments(bundle2);
                getSupportFragmentManager().p().t(R.animator.fade_in, R.animator.fade_out).c(R.id.content, n0, s0()).k();
            }
        } catch (Throwable th) {
            w1.u("Cannot find a valid notification bundle to show!", th);
            finish();
        }
    }

    public void onDestroy() {
        super.onDestroy();
        if (isChangingConfigurations()) {
            return;
        }
        q0(null, false);
    }

    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        this.c0.f(this, i, iArr);
    }

    public void onResume() {
        super.onResume();
        this.c0.e(this);
    }

    public void p0(Bundle bundle) {
        q0(bundle, true);
    }

    public void q0(Bundle bundle, boolean z) {
        CTInAppNotification cTInAppNotification;
        if (C0) {
            C0 = false;
        }
        if (!this.A0) {
            com.clevertap.android.sdk.inapp.a0 t0 = t0();
            if (t0 != null && (cTInAppNotification = this.H) != null) {
                t0.x(cTInAppNotification, bundle);
            }
            this.A0 = true;
        }
        if (z) {
            finish();
        }
    }

    public void r0(Bundle bundle) {
        com.clevertap.android.sdk.inapp.a0 t0 = t0();
        if (t0 != null) {
            t0.u(this.H, bundle);
        }
    }

    public final String s0() {
        return this.G.g() + ":CT_INAPP_CONTENT_FRAGMENT";
    }

    public void setTheme(int i) {
        super/*android.content.ContextWrapper*/.setTheme(R.style.Theme.Translucent.NoTitleBar);
    }

    public com.clevertap.android.sdk.inapp.a0 t0() {
        com.clevertap.android.sdk.inapp.a0 a0Var;
        try {
            a0Var = this.I.get();
        } catch (Throwable unused) {
            a0Var = null;
        }
        if (a0Var == null && this.H != null) {
            this.G.q().b(this.G.g(), "InAppActivityListener is null for notification: " + this.H.t());
        }
        return a0Var;
    }

    @Override
    public void u(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
        r0(bundle);
    }

    @Override
    public void x(@NonNull CTInAppNotification cTInAppNotification, Bundle bundle) {
        p0(bundle);
    }

    @Override
    public Bundle y(@NonNull CTInAppNotification cTInAppNotification, @NonNull CTInAppAction cTInAppAction, @NonNull String str, Bundle bundle, Context context) {
        com.clevertap.android.sdk.inapp.a0 t0 = t0();
        if (t0 != null) {
            return t0.y(cTInAppNotification, cTInAppAction, str, bundle, this);
        }
        return null;
    }

    @Override
    public void z(boolean z) {
        p0(null);
    }

    public final void z0(CTInAppNotificationButton cTInAppNotificationButton, boolean z) {
        Bundle o0 = o0(cTInAppNotificationButton);
        if (z && this.H.P()) {
            D0(this.H.d());
            return;
        }
        CTInAppAction a2 = cTInAppNotificationButton.a();
        if (a2 == null || com.clevertap.android.sdk.inapp.s.REQUEST_FOR_PERMISSIONS != a2.i()) {
            p0(o0);
        } else {
            D0(a2.k());
        }
    }
}