导航菜单

页面标题

页面副标题

OLX India v19.42.007 - InAppNotificationActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 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 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 androidx.fragment.app.r implements com.clevertap.android.sdk.inapp.m, r0 {
    private static boolean V = false;
    private CleverTapInstanceConfig Q;
    private CTInAppNotification R;
    private WeakReference S;
    private WeakReference T;
    private j1 U;

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

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

    static class b {
        static final int[] a;

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

    public interface c {
        void a();

        void b();
    }

    private CTInAppBaseFullFragment h2() {
        com.clevertap.android.sdk.inapp.f o = this.R.o();
        switch (b.a[o.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:
                w2();
                return null;
            default:
                this.Q.m().a("InAppNotificationActivity: Unhandled InApp Type: " + o);
                return null;
        }
    }

    private Bundle i2(CTInAppNotificationButton cTInAppNotificationButton) {
        com.clevertap.android.sdk.inapp.m n2 = n2();
        if (n2 != null) {
            return n2.C0(this.R, cTInAppNotificationButton, this);
        }
        return null;
    }

    private String m2() {
        return this.Q.c() + ":CT_INAPP_CONTENT_FRAGMENT";
    }

    public void o2(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        s2(cTInAppNotificationButton, true);
    }

    public void p2(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        s2(cTInAppNotificationButton, false);
    }

    public void q2(CTInAppNotificationButton cTInAppNotificationButton, DialogInterface dialogInterface, int i) {
        t2(cTInAppNotificationButton);
    }

    private void s2(CTInAppNotificationButton cTInAppNotificationButton, boolean z) {
        Bundle i2 = i2(cTInAppNotificationButton);
        if (z && this.R.K()) {
            y2(this.R.c());
            return;
        }
        CTInAppAction a2 = cTInAppNotificationButton.a();
        if (a2 == null || com.clevertap.android.sdk.inapp.i.REQUEST_FOR_PERMISSIONS != a2.h()) {
            j2(i2);
        } else {
            y2(a2.j());
        }
    }

    private void t2(CTInAppNotificationButton cTInAppNotificationButton) {
        j2(i2(cTInAppNotificationButton));
    }

    private void w2() {
        ArrayList g = this.R.g();
        if (g.isEmpty()) {
            this.Q.m().g("InAppNotificationActivity: Notification has no buttons, not showing Alert InApp");
            return;
        }
        final CTInAppNotificationButton cTInAppNotificationButton = (CTInAppNotificationButton) g.get(0);
        AlertDialog create = new AlertDialog.Builder(this, R.style.Theme.Material.Light.Dialog.Alert).setCancelable(false).setTitle(this.R.w()).setMessage(this.R.s()).setPositiveButton(cTInAppNotificationButton.e(), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                InAppNotificationActivity.this.o2(cTInAppNotificationButton, dialogInterface, i);
            }
        }).create();
        if (this.R.g().size() == 2) {
            final CTInAppNotificationButton cTInAppNotificationButton2 = (CTInAppNotificationButton) g.get(1);
            create.setButton(-2, cTInAppNotificationButton2.e(), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    InAppNotificationActivity.this.p2(cTInAppNotificationButton2, dialogInterface, i);
                }
            });
        }
        if (g.size() > 2) {
            final CTInAppNotificationButton cTInAppNotificationButton3 = (CTInAppNotificationButton) g.get(2);
            create.setButton(-3, cTInAppNotificationButton3.e(), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    InAppNotificationActivity.this.q2(cTInAppNotificationButton3, dialogInterface, i);
                }
            });
        }
        create.show();
        V = true;
        k2(null);
    }

    @Override
    public void B1(CTInAppNotification cTInAppNotification, Bundle bundle) {
        k2(bundle);
    }

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

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

    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);
        }
    }

    void j2(Bundle bundle) {
        CTInAppNotification cTInAppNotification;
        if (V) {
            V = false;
        }
        finish();
        com.clevertap.android.sdk.inapp.m n2 = n2();
        if (n2 == null || (cTInAppNotification = this.R) == null) {
            return;
        }
        n2.m0(cTInAppNotification, bundle);
    }

    void k2(Bundle bundle) {
        com.clevertap.android.sdk.inapp.m n2 = n2();
        if (n2 != null) {
            n2.B1(this.R, bundle);
        }
    }

    @Override
    public void m0(CTInAppNotification cTInAppNotification, Bundle bundle) {
        j2(bundle);
    }

    com.clevertap.android.sdk.inapp.m n2() {
        com.clevertap.android.sdk.inapp.m mVar;
        try {
            mVar = (com.clevertap.android.sdk.inapp.m) this.S.get();
        } catch (Throwable unused) {
            mVar = null;
        }
        if (mVar == null) {
            this.Q.m().b(this.Q.c(), "InAppActivityListener is null for notification: " + this.R.p());
        }
        return mVar;
    }

    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();
            }
            this.R = (CTInAppNotification) extras.getParcelable("inApp");
            boolean z = extras.getBoolean("displayHardPermissionDialog", false);
            Bundle bundle2 = extras.getBundle("configBundle");
            if (bundle2 != null) {
                this.Q = (CleverTapInstanceConfig) bundle2.getParcelable("config");
            }
            u2(b0.M(this, this.Q).y().l());
            v2(b0.M(this, this.Q).y().l());
            this.U = new j1(this, this.Q);
            if (z) {
                y2(extras.getBoolean("shouldShowFallbackSettings", false));
                return;
            }
            CTInAppNotification cTInAppNotification = this.R;
            if (cTInAppNotification == null) {
                finish();
                return;
            }
            if (cTInAppNotification.L() && !this.R.J()) {
                if (i == 2) {
                    e1.c("App in Landscape, dismissing portrait InApp Notification");
                    finish();
                    j2(null);
                    return;
                }
                e1.c("App in Portrait, displaying InApp Notification anyway");
            }
            if (!this.R.L() && this.R.J()) {
                if (i == 1) {
                    e1.c("App in Portrait, dismissing landscape InApp Notification");
                    finish();
                    j2(null);
                    return;
                }
                e1.c("App in Landscape, displaying InApp Notification anyway");
            }
            if (bundle != null) {
                if (V) {
                    h2();
                    return;
                }
                return;
            }
            CTInAppBaseFullFragment h2 = h2();
            if (h2 != null) {
                Bundle bundle3 = new Bundle();
                bundle3.putParcelable("inApp", this.R);
                bundle3.putParcelable("config", this.Q);
                h2.setArguments(bundle3);
                getSupportFragmentManager().s().x(R.animator.fade_in, R.animator.fade_out).c(R.id.content, h2, m2()).k();
            }
        } catch (Throwable th) {
            e1.u("Cannot find a valid notification bundle to show!", th);
            finish();
        }
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        o.c(this, this.Q).e(false);
        o.f(this, this.Q);
        if (i == 102) {
            if (iArr.length <= 0 || iArr[0] != 0) {
                ((c) this.T.get()).b();
            } else {
                ((c) this.T.get()).a();
            }
            j2(null);
        }
    }

    protected void onResume() {
        super.onResume();
        if (!this.U.c() || Build.VERSION.SDK_INT < 33) {
            return;
        }
        if (androidx.core.content.b.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
            ((c) this.T.get()).a();
        } else {
            ((c) this.T.get()).b();
        }
        j2(null);
    }

    public void r2() {
        ((c) this.T.get()).b();
    }

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

    void u2(com.clevertap.android.sdk.inapp.m mVar) {
        this.S = new WeakReference(mVar);
    }

    public void v2(c cVar) {
        this.T = new WeakReference(cVar);
    }

    @Override
    public void y0(boolean z) {
        y2(z);
    }

    public void y2(boolean z) {
        this.U.i(z, (c) this.T.get());
    }
}