导航菜单

页面标题

页面副标题

CityMall v1.42.1 - InAppNotificationActivity.java 源代码

正在查看: CityMall v1.42.1 应用的 InAppNotificationActivity.java JAVA 源代码文件

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


package com.clevertap.android.sdk;

import L0.C0331f;
import android.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import com.clevertap.android.sdk.inapp.AbstractC0785e;
import com.clevertap.android.sdk.inapp.CTInAppNotification;
import com.clevertap.android.sdk.inapp.CTInAppNotificationButton;
import com.clevertap.android.sdk.inapp.InAppListener;
import com.clevertap.android.sdk.inapp.y;
import com.clevertap.android.sdk.inapp.z;
import com.facebook.ads.NativeAdScrollView;
import java.lang.ref.WeakReference;
import java.util.HashMap;

public final class InAppNotificationActivity extends FragmentActivity implements InAppListener, DidClickForHardPermissionListener {

    private static boolean f12951h = false;

    private CleverTapInstanceConfig f12952a;

    private CTInAppNotification f12953b;

    private WeakReference f12954c;

    private WeakReference f12955d;

    private v f12956e;

    private Bundle f12957f = null;

    private boolean f12958g = false;

    public interface PushPermissionResultCallback {
        void b();

        void d();
    }

    class a implements DialogInterface.OnClickListener {
        a() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i5) {
            Bundle bundle = new Bundle();
            bundle.putString("wzrk_id", InAppNotificationActivity.this.f12953b.h());
            bundle.putString("wzrk_c2a", ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(0)).g());
            InAppNotificationActivity.this.C(bundle, null);
            String a5 = ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(0)).a();
            if (a5 != null) {
                InAppNotificationActivity.this.F(a5, bundle);
                return;
            }
            if (InAppNotificationActivity.this.f12953b.Z()) {
                InAppNotificationActivity inAppNotificationActivity = InAppNotificationActivity.this;
                inAppNotificationActivity.M(inAppNotificationActivity.f12953b.c());
            } else if (((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(0)).i() == null || !((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(0)).i().equalsIgnoreCase("rfp")) {
                InAppNotificationActivity.this.D(bundle);
            } else {
                InAppNotificationActivity inAppNotificationActivity2 = InAppNotificationActivity.this;
                inAppNotificationActivity2.M(((CTInAppNotificationButton) inAppNotificationActivity2.f12953b.g().get(0)).k());
            }
        }
    }

    class b implements DialogInterface.OnClickListener {
        b() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i5) {
            Bundle bundle = new Bundle();
            bundle.putString("wzrk_id", InAppNotificationActivity.this.f12953b.h());
            bundle.putString("wzrk_c2a", ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(1)).g());
            InAppNotificationActivity.this.C(bundle, null);
            String a5 = ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(1)).a();
            if (a5 != null) {
                InAppNotificationActivity.this.F(a5, bundle);
            } else if (((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(1)).i() == null || !((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(1)).i().equalsIgnoreCase("rfp")) {
                InAppNotificationActivity.this.D(bundle);
            } else {
                InAppNotificationActivity inAppNotificationActivity = InAppNotificationActivity.this;
                inAppNotificationActivity.M(((CTInAppNotificationButton) inAppNotificationActivity.f12953b.g().get(1)).k());
            }
        }
    }

    class c implements DialogInterface.OnClickListener {
        c() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i5) {
            Bundle bundle = new Bundle();
            bundle.putString("wzrk_id", InAppNotificationActivity.this.f12953b.h());
            bundle.putString("wzrk_c2a", ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(2)).g());
            InAppNotificationActivity.this.C(bundle, null);
            String a5 = ((CTInAppNotificationButton) InAppNotificationActivity.this.f12953b.g().get(2)).a();
            if (a5 != null) {
                InAppNotificationActivity.this.F(a5, bundle);
            } else {
                InAppNotificationActivity.this.D(bundle);
            }
        }
    }

    static class d {

        static final int[] f12962a;

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

    private AbstractC0785e B() {
        AlertDialog alertDialog;
        z x4 = this.f12953b.x();
        switch (d.f12962a[x4.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 androidx.datastore.preferences.d.BYTES_FIELD_NUMBER:
                return new y();
            case 9:
                return new com.clevertap.android.sdk.inapp.t();
            case NativeAdScrollView.DEFAULT_MAX_ADS:
                if (this.f12953b.g().size() > 0) {
                    alertDialog = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.f12953b.L()).setMessage(this.f12953b.F()).setPositiveButton(((CTInAppNotificationButton) this.f12953b.g().get(0)).g(), new a()).create();
                    if (this.f12953b.g().size() == 2) {
                        alertDialog.setButton(-2, ((CTInAppNotificationButton) this.f12953b.g().get(1)).g(), new b());
                    }
                    if (this.f12953b.g().size() > 2) {
                        alertDialog.setButton(-3, ((CTInAppNotificationButton) this.f12953b.g().get(2)).g(), new c());
                    }
                } else {
                    alertDialog = null;
                }
                if (alertDialog == null) {
                    this.f12952a.s().h("InAppNotificationActivity: Alert Dialog is null, not showing Alert InApp");
                    return null;
                }
                alertDialog.show();
                f12951h = true;
                E(null);
                return null;
            default:
                this.f12952a.s().a("InAppNotificationActivity: Unhandled InApp Type: " + x4);
                return null;
        }
    }

    private String G() {
        return this.f12952a.d() + ":CT_INAPP_CONTENT_FRAGMENT";
    }

    private void I() {
        if (f12951h) {
            f12951h = false;
        }
        InAppListener H4 = H();
        if (H4 != null && getBaseContext() != null && this.f12953b != null) {
            H4.e(getBaseContext(), this.f12953b, this.f12957f);
        }
        this.f12958g = true;
    }

    void C(Bundle bundle, HashMap hashMap) {
        InAppListener H4 = H();
        if (H4 != null) {
            H4.c(this.f12953b, bundle, hashMap);
        }
    }

    void D(Bundle bundle) {
        this.f12957f = bundle;
        finish();
    }

    void E(Bundle bundle) {
        InAppListener H4 = H();
        if (H4 != null) {
            H4.g(this.f12953b, bundle);
        }
    }

    void F(String str, Bundle bundle) {
        try {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str.replace("\n", "").replace("\r", ""))));
        } catch (Throwable unused) {
        }
        D(bundle);
    }

    InAppListener H() {
        InAppListener inAppListener;
        try {
            inAppListener = (InAppListener) this.f12954c.get();
        } catch (Throwable unused) {
            inAppListener = null;
        }
        if (inAppListener == null) {
            this.f12952a.s().v(this.f12952a.d(), "InAppActivityListener is null for notification: " + this.f12953b.z());
        }
        return inAppListener;
    }

    public void J() {
        ((PushPermissionResultCallback) this.f12955d.get()).d();
    }

    void K(InAppListener inAppListener) {
        this.f12954c = new WeakReference(inAppListener);
    }

    public void L(PushPermissionResultCallback pushPermissionResultCallback) {
        this.f12955d = new WeakReference(pushPermissionResultCallback);
    }

    public void M(boolean z4) {
        this.f12956e.i(z4, (PushPermissionResultCallback) this.f12955d.get());
    }

    @Override
    public void c(CTInAppNotification cTInAppNotification, Bundle bundle, HashMap hashMap) {
        C(bundle, hashMap);
    }

    @Override
    public void e(Context context, CTInAppNotification cTInAppNotification, Bundle bundle) {
        D(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);
        }
        if (this.f12958g) {
            return;
        }
        I();
    }

    @Override
    public void g(CTInAppNotification cTInAppNotification, Bundle bundle) {
        E(bundle);
    }

    @Override
    public void h(boolean z4) {
        M(z4);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        int i5 = getResources().getConfiguration().orientation;
        if (i5 == 2) {
            getWindow().addFlags(1024);
        }
        try {
            Bundle extras = getIntent().getExtras();
            if (extras == null) {
                throw new IllegalArgumentException();
            }
            this.f12953b = (CTInAppNotification) extras.getParcelable("inApp");
            boolean z4 = extras.getBoolean("displayHardPermissionDialog", false);
            Bundle bundle2 = extras.getBundle("configBundle");
            if (bundle2 != null) {
                this.f12952a = (CleverTapInstanceConfig) bundle2.getParcelable("config");
            }
            K(CleverTapAPI.F0(this, this.f12952a).Z().n());
            L(CleverTapAPI.F0(this, this.f12952a).Z().n());
            this.f12956e = new v(this, this.f12952a);
            if (z4) {
                M(extras.getBoolean("shouldShowFallbackSettings", false));
                return;
            }
            CTInAppNotification cTInAppNotification = this.f12953b;
            if (cTInAppNotification == null) {
                finish();
                return;
            }
            if (cTInAppNotification.a0() && !this.f12953b.Y()) {
                if (i5 == 2) {
                    t.d("App in Landscape, dismissing portrait InApp Notification");
                    finish();
                    D(null);
                    return;
                }
                t.d("App in Portrait, displaying InApp Notification anyway");
            }
            if (!this.f12953b.a0() && this.f12953b.Y()) {
                if (i5 == 1) {
                    t.d("App in Portrait, dismissing landscape InApp Notification");
                    finish();
                    D(null);
                    return;
                }
                t.d("App in Landscape, displaying InApp Notification anyway");
            }
            if (bundle != null) {
                if (f12951h) {
                    B();
                    return;
                }
                return;
            }
            AbstractC0785e B4 = B();
            if (B4 != null) {
                Bundle bundle3 = new Bundle();
                bundle3.putParcelable("inApp", this.f12953b);
                bundle3.putParcelable("config", this.f12952a);
                B4.setArguments(bundle3);
                getSupportFragmentManager().p().s(R.animator.fade_in, R.animator.fade_out).c(R.id.content, B4, G()).j();
            }
        } catch (Throwable th) {
            t.u("Cannot find a valid notification bundle to show!", th);
            finish();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        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);
        }
        if (this.f12958g) {
            return;
        }
        I();
    }

    @Override
    public void onRequestPermissionsResult(int i5, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i5, strArr, iArr);
        C0331f.c(this, this.f12952a).e(false);
        C0331f.f(this, this.f12952a);
        if (i5 == 102) {
            if (iArr.length <= 0 || iArr[0] != 0) {
                ((PushPermissionResultCallback) this.f12955d.get()).d();
            } else {
                ((PushPermissionResultCallback) this.f12955d.get()).b();
            }
            D(null);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!this.f12956e.c() || Build.VERSION.SDK_INT < 33) {
            return;
        }
        if (ContextCompat.a(this, "android.permission.POST_NOTIFICATIONS") == 0) {
            ((PushPermissionResultCallback) this.f12955d.get()).b();
        } else {
            ((PushPermissionResultCallback) this.f12955d.get()).d();
        }
        D(null);
    }

    @Override
    public void setTheme(int i5) {
        super.setTheme(R.style.Theme.Translucent.NoTitleBar);
    }
}