导航菜单

页面标题

页面副标题

Vi App v10.18.0 - PendingIntentFactory.java 源代码

正在查看: Vi App v10.18.0 应用的 PendingIntentFactory.java JAVA 源代码文件

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


package com.clevertap.android.pushtemplates.content;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import com.clevertap.android.pushtemplates.PTConstants;
import com.clevertap.android.pushtemplates.PTLog;
import com.clevertap.android.pushtemplates.PTPushNotificationReceiver;
import com.clevertap.android.pushtemplates.PushTemplateReceiver;
import com.clevertap.android.pushtemplates.TemplateRenderer;
import com.clevertap.android.sdk.Constants;
import com.clevertap.android.sdk.Utils;
import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;
import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory;
import java.util.ArrayList;
import java.util.Random;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\bÀ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J(\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0007J<\u0010\u0013\u001a\u0004\u0018\u00010\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00122\b\u0010\u0017\u001a\u0004\u0018\u00010\u0018H\u0007J\u0010\u0010\u0019\u001a\u00020\u00122\u0006\u0010\u0016\u001a\u00020\u0012H\u0003J \u0010\u001a\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u001b\u001a\u00020\u0004H\u0007J2\u0010\u001c\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\r\u001a\u00020\u000e2\b\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u001d\u001a\u00020\u0012H\u0007R\u001c\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\b¨\u0006\u001e"}, d2 = {"Lcom/clevertap/android/pushtemplates/content/PendingIntentFactory;", "", "()V", "launchIntent", "Landroid/content/Intent;", "getLaunchIntent", "()Landroid/content/Intent;", "setLaunchIntent", "(Landroid/content/Intent;)V", "getCtaLaunchPendingIntent", "Landroid/app/PendingIntent;", "context", "Landroid/content/Context;", "extras", "Landroid/os/Bundle;", "dl", "", "notificationId", "", "getPendingIntent", "isLauncher", "", "identifier", "renderer", "Lcom/clevertap/android/pushtemplates/TemplateRenderer;", "getRatingStarNumber", "setDismissIntent", "intent", "setPendingIntent", "requestCode", "clevertap-pushtemplates_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class PendingIntentFactory {

    @NotNull
    public static final PendingIntentFactory INSTANCE = new PendingIntentFactory();

    @Nullable
    private static Intent launchIntent;

    private PendingIntentFactory() {
    }

    @JvmStatic
    @NotNull
    public static final PendingIntent getCtaLaunchPendingIntent(@NotNull Context context, @NotNull Bundle extras, @NotNull String dl, int notificationId) {
        Class<?> cls;
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(extras, "extras");
        Intrinsics.checkNotNullParameter(dl, "dl");
        try {
            cls = Class.forName("com.clevertap.android.sdk.pushnotification.CTNotificationIntentService");
        } catch (ClassNotFoundException unused) {
            PTLog.debug("No Intent Service found");
            cls = null;
        }
        boolean isServiceAvailable = Utils.isServiceAvailable(context, cls);
        if (Build.VERSION.SDK_INT >= 31 || !isServiceAvailable) {
            extras.putString(Constants.DEEP_LINK_KEY, dl);
            PendingIntent activityIntent = LaunchPendingIntentFactory.getActivityIntent(extras, context);
            Intrinsics.checkNotNullExpressionValue(activityIntent, "{\n            extras.put…xtras, context)\n        }");
            return activityIntent;
        }
        extras.putBoolean("autoCancel", true);
        extras.putInt("notificationId", notificationId);
        Intent intent = new Intent(CTNotificationIntentService.MAIN_ACTION);
        launchIntent = intent;
        Intrinsics.checkNotNull(intent);
        intent.putExtras(extras);
        Intent intent2 = launchIntent;
        Intrinsics.checkNotNull(intent2);
        intent2.putExtra("dl", dl);
        Intent intent3 = launchIntent;
        Intrinsics.checkNotNull(intent3);
        intent3.setPackage(context.getPackageName());
        Intent intent4 = launchIntent;
        Intrinsics.checkNotNull(intent4);
        intent4.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK);
        int nextInt = new Random().nextInt();
        Intent intent5 = launchIntent;
        Intrinsics.checkNotNull(intent5);
        PendingIntent service = PendingIntent.getService(context, nextInt, intent5, 201326592);
        Intrinsics.checkNotNullExpressionValue(service, "{\n            extras.put…t\n            )\n        }");
        return service;
    }

    @JvmStatic
    @Nullable
    public static final PendingIntent getPendingIntent(@NotNull Context context, int notificationId, @NotNull Bundle extras, boolean isLauncher, int identifier, @Nullable TemplateRenderer renderer) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(extras, "extras");
        launchIntent = null;
        if (isLauncher && Build.VERSION.SDK_INT < 31) {
            launchIntent = new Intent(context, (Class<?>) PTPushNotificationReceiver.class);
        } else if (!isLauncher) {
            launchIntent = new Intent(context, (Class<?>) PushTemplateReceiver.class);
        }
        int i = Build.VERSION.SDK_INT;
        int nextInt = new Random().nextInt();
        switch (identifier) {
            case 1:
            case 2:
            case 3:
                break;
            case 4:
                Intent intent = launchIntent;
                Intrinsics.checkNotNull(intent);
                intent.putExtra(PTConstants.PT_RIGHT_SWIPE, true);
                Intent intent2 = launchIntent;
                Intrinsics.checkNotNull(intent2);
                intent2.putExtra("notificationId", notificationId);
                Intent intent3 = launchIntent;
                Intrinsics.checkNotNull(intent3);
                intent3.putExtras(extras);
                return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
            case 5:
                Intent intent4 = launchIntent;
                Intrinsics.checkNotNull(intent4);
                intent4.putExtra(PTConstants.PT_RIGHT_SWIPE, false);
                Intent intent5 = launchIntent;
                Intrinsics.checkNotNull(intent5);
                intent5.putExtra("notificationId", notificationId);
                Intent intent6 = launchIntent;
                Intrinsics.checkNotNull(intent6);
                intent6.putExtras(extras);
                return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
            case 6:
                return setDismissIntent(context, extras, new Intent(context, (Class<?>) PushTemplateReceiver.class));
            case 7:
                extras.putString(Constants.DEEP_LINK_KEY, renderer != null ? renderer.getPt_rating_default_dl() : null);
                return i < 31 ? setPendingIntent(context, notificationId, extras, launchIntent, nextInt) : LaunchPendingIntentFactory.getActivityIntent(extras, context);
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
                int ratingStarNumber = getRatingStarNumber(identifier);
                Intent intent7 = launchIntent;
                Intrinsics.checkNotNull(intent7);
                intent7.putExtras(extras);
                Intent intent8 = launchIntent;
                Intrinsics.checkNotNull(intent8);
                intent8.putExtra("click" + ratingStarNumber, true);
                Intent intent9 = launchIntent;
                Intrinsics.checkNotNull(intent9);
                intent9.putExtra(PTConstants.KEY_CLICKED_STAR, ratingStarNumber);
                Intent intent10 = launchIntent;
                Intrinsics.checkNotNull(intent10);
                intent10.putExtra("notificationId", notificationId);
                Intent intent11 = launchIntent;
                Intrinsics.checkNotNull(intent11);
                intent11.putExtra(Constants.KEY_CONFIG, renderer != null ? renderer.getConfig() : null);
                int[] intArray = extras.getIntArray(PTConstants.KEY_REQUEST_CODES);
                Integer valueOf = intArray != null ? Integer.valueOf(intArray[ratingStarNumber - 1]) : null;
                Intrinsics.checkNotNull(valueOf);
                int intValue = valueOf.intValue();
                Intent intent12 = launchIntent;
                Intrinsics.checkNotNull(intent12);
                return PendingIntent.getBroadcast(context, intValue, intent12, 67108864);
            case 13:
                extras.putString(Constants.DEEP_LINK_KEY, null);
                return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
            default:
                switch (identifier) {
                    case 20:
                    case 29:
                    case 30:
                    case 31:
                        break;
                    case 21:
                        Intent intent13 = launchIntent;
                        Intrinsics.checkNotNull(intent13);
                        intent13.putExtras(extras);
                        Intent intent14 = launchIntent;
                        Intrinsics.checkNotNull(intent14);
                        intent14.putExtra(PTConstants.PT_CURRENT_POSITION, 0);
                        Intent intent15 = launchIntent;
                        Intrinsics.checkNotNull(intent15);
                        intent15.putExtra("notificationId", notificationId);
                        Intent intent16 = launchIntent;
                        Intrinsics.checkNotNull(intent16);
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release);
                        intent16.putExtra(PTConstants.PT_BUY_NOW_DL, deepLinkList$clevertap_pushtemplates_release.get(0));
                        Intent intent17 = launchIntent;
                        Intrinsics.checkNotNull(intent17);
                        return PendingIntent.getBroadcast(context, nextInt, intent17, 67108864);
                    case 22:
                        Intent intent18 = launchIntent;
                        Intrinsics.checkNotNull(intent18);
                        intent18.putExtras(extras);
                        Intent intent19 = launchIntent;
                        Intrinsics.checkNotNull(intent19);
                        intent19.putExtra(PTConstants.PT_CURRENT_POSITION, 1);
                        Intent intent20 = launchIntent;
                        Intrinsics.checkNotNull(intent20);
                        intent20.putExtra("notificationId", notificationId);
                        Intent intent21 = launchIntent;
                        Intrinsics.checkNotNull(intent21);
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release2 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release2);
                        intent21.putExtra(PTConstants.PT_BUY_NOW_DL, deepLinkList$clevertap_pushtemplates_release2.get(1));
                        Intent intent22 = launchIntent;
                        Intrinsics.checkNotNull(intent22);
                        return PendingIntent.getBroadcast(context, nextInt, intent22, 67108864);
                    case 23:
                        Intent intent23 = launchIntent;
                        Intrinsics.checkNotNull(intent23);
                        intent23.putExtras(extras);
                        Intent intent24 = launchIntent;
                        Intrinsics.checkNotNull(intent24);
                        intent24.putExtra(PTConstants.PT_CURRENT_POSITION, 2);
                        Intent intent25 = launchIntent;
                        Intrinsics.checkNotNull(intent25);
                        intent25.putExtra("notificationId", notificationId);
                        Intent intent26 = launchIntent;
                        Intrinsics.checkNotNull(intent26);
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release3 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release3);
                        intent26.putExtra(PTConstants.PT_BUY_NOW_DL, deepLinkList$clevertap_pushtemplates_release3.get(2));
                        Intent intent27 = launchIntent;
                        Intrinsics.checkNotNull(intent27);
                        return PendingIntent.getBroadcast(context, nextInt, intent27, 67108864);
                    case 24:
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release4 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release4);
                        extras.putString(Constants.DEEP_LINK_KEY, deepLinkList$clevertap_pushtemplates_release4.get(0));
                        return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
                    case 25:
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release5 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release5);
                        extras.putString(Constants.DEEP_LINK_KEY, deepLinkList$clevertap_pushtemplates_release5.get(1));
                        return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
                    case 26:
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release6 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release6);
                        extras.putString(Constants.DEEP_LINK_KEY, deepLinkList$clevertap_pushtemplates_release6.get(2));
                        return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
                    case 27:
                        Intent intent28 = launchIntent;
                        Intrinsics.checkNotNull(intent28);
                        intent28.putExtra(PTConstants.PT_IMAGE_1, true);
                        Intent intent29 = launchIntent;
                        Intrinsics.checkNotNull(intent29);
                        intent29.putExtra("notificationId", notificationId);
                        Intent intent30 = launchIntent;
                        Intrinsics.checkNotNull(intent30);
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release7 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release7);
                        intent30.putExtra(PTConstants.PT_BUY_NOW_DL, deepLinkList$clevertap_pushtemplates_release7.get(0));
                        Intent intent31 = launchIntent;
                        Intrinsics.checkNotNull(intent31);
                        intent31.putExtra(PTConstants.PT_BUY_NOW, true);
                        Intent intent32 = launchIntent;
                        Intrinsics.checkNotNull(intent32);
                        intent32.putExtra(Constants.KEY_CONFIG, renderer != null ? renderer.getConfig() : null);
                        Intent intent33 = launchIntent;
                        Intrinsics.checkNotNull(intent33);
                        intent33.putExtras(extras);
                        Intent intent34 = launchIntent;
                        Intrinsics.checkNotNull(intent34);
                        return PendingIntent.getBroadcast(context, nextInt, intent34, 67108864);
                    case 28:
                        return setDismissIntent(context, extras, new Intent(context, (Class<?>) PushTemplateReceiver.class));
                    case 32:
                        ArrayList<String> deepLinkList$clevertap_pushtemplates_release8 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                        Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release8);
                        if (deepLinkList$clevertap_pushtemplates_release8.size() > 0) {
                            ArrayList<String> deepLinkList$clevertap_pushtemplates_release9 = renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null;
                            Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release9);
                            extras.putString(Constants.DEEP_LINK_KEY, deepLinkList$clevertap_pushtemplates_release9.get(0));
                        }
                        Intent intent35 = launchIntent;
                        Intrinsics.checkNotNull(intent35);
                        intent35.putExtra(PTConstants.PT_INPUT_FEEDBACK, renderer != null ? renderer.getPt_input_feedback() : null);
                        Intent intent36 = launchIntent;
                        Intrinsics.checkNotNull(intent36);
                        intent36.putExtra(PTConstants.PT_INPUT_AUTO_OPEN, renderer != null ? renderer.getPt_input_auto_open() : null);
                        Intent intent37 = launchIntent;
                        Intrinsics.checkNotNull(intent37);
                        intent37.putExtra(Constants.KEY_CONFIG, renderer != null ? renderer.getConfig() : null);
                        if (renderer.getDeepLinkList$clevertap_pushtemplates_release() == null) {
                            extras.putString(Constants.DEEP_LINK_KEY, null);
                        }
                        return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
                    default:
                        throw new IllegalArgumentException("invalid pendingIntentType");
                }
        }
        if ((renderer != null ? renderer.getDeepLinkList$clevertap_pushtemplates_release() : null) != null) {
            ArrayList<String> deepLinkList$clevertap_pushtemplates_release10 = renderer.getDeepLinkList$clevertap_pushtemplates_release();
            Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release10);
            if (deepLinkList$clevertap_pushtemplates_release10.size() > 0) {
                ArrayList<String> deepLinkList$clevertap_pushtemplates_release11 = renderer.getDeepLinkList$clevertap_pushtemplates_release();
                Intrinsics.checkNotNull(deepLinkList$clevertap_pushtemplates_release11);
                extras.putString(Constants.DEEP_LINK_KEY, deepLinkList$clevertap_pushtemplates_release11.get(0));
                return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
            }
        }
        if (extras.get(Constants.DEEP_LINK_KEY) == null) {
            extras.putString(Constants.DEEP_LINK_KEY, null);
        }
        return setPendingIntent(context, notificationId, extras, launchIntent, nextInt);
    }

    @JvmStatic
    private static final int getRatingStarNumber(int identifier) {
        switch (identifier) {
            case 8:
                return 1;
            case 9:
                return 2;
            case 10:
                return 3;
            case 11:
                return 4;
            default:
                return 5;
        }
    }

    @JvmStatic
    @NotNull
    public static final PendingIntent setDismissIntent(@NotNull Context context, @NotNull Bundle extras, @NotNull Intent intent) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(extras, "extras");
        Intrinsics.checkNotNullParameter(intent, "intent");
        intent.putExtras(extras);
        intent.putExtra(PTConstants.PT_DISMISS_INTENT, true);
        PendingIntent broadcast = PendingIntent.getBroadcast(context, new Random().nextInt(), intent, 335544320);
        Intrinsics.checkNotNullExpressionValue(broadcast, "getBroadcast(\n          …chPendingIntent\n        )");
        return broadcast;
    }

    @JvmStatic
    @NotNull
    public static final PendingIntent setPendingIntent(@NotNull Context context, int notificationId, @NotNull Bundle extras, @Nullable Intent launchIntent2, int requestCode) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(extras, "extras");
        Object obj = extras.get(Constants.DEEP_LINK_KEY);
        extras.putInt("notificationId", notificationId);
        if (obj != null) {
            extras.putBoolean(PTConstants.DEFAULT_DL, true);
        }
        if (launchIntent2 == null) {
            PendingIntent activityIntent = LaunchPendingIntentFactory.getActivityIntent(extras, context);
            Intrinsics.checkNotNullExpressionValue(activityIntent, "getActivityIntent(extras, context)");
            return activityIntent;
        }
        launchIntent2.putExtras(extras);
        launchIntent2.removeExtra(Constants.WZRK_ACTIONS);
        launchIntent2.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);
        launchIntent2.setFlags(872415232);
        PendingIntent broadcast = PendingIntent.getBroadcast(context, requestCode, launchIntent2, 134217728 | (launchIntent2.hasExtra(PTConstants.PT_INPUT_FEEDBACK) ? 33554432 : 67108864));
        Intrinsics.checkNotNullExpressionValue(broadcast, "getBroadcast(\n          …ndingIntent\n            )");
        return broadcast;
    }

    @Nullable
    public final Intent getLaunchIntent() {
        return launchIntent;
    }

    public final void setLaunchIntent(@Nullable Intent intent) {
        launchIntent = intent;
    }
}