导航菜单

页面标题

页面副标题

Mitra Bukalapak v2.55.0 - BrazeNotificationUtils.java 源代码

正在查看: Mitra Bukalapak v2.55.0 应用的 BrazeNotificationUtils.java JAVA 源代码文件

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


package com.braze.push;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlarmManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.UiModeManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.SystemClock;
import com.braze.Braze;
import com.braze.BrazeInternal;
import com.braze.Constants;
import com.braze.IBrazeNotificationFactory;
import com.braze.configuration.BrazeConfigurationProvider;
import com.braze.enums.BrazePushEventType;
import com.braze.enums.BrazeViewBounds;
import com.braze.enums.Channel;
import com.braze.models.push.BrazeNotificationPayload;
import com.braze.push.support.HtmlUtils;
import com.braze.support.BrazeLogger;
import com.braze.support.IntentUtils;
import com.braze.support.JsonUtils;
import com.braze.support.PermissionUtils;
import com.braze.ui.BrazeDeeplinkHandler;
import com.braze.ui.actions.UriAction;
import com.braze.ui.support.UriUtils;
import com.bukalapak.android.lib.api4.tungku.data.BukaPengirimanDeliveryInsuranceTransaction;
import defpackage.e80;
import defpackage.f80;
import defpackage.mq5;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;

@Metadata(d1 = {"\u0000z\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u001a\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\n\bÆ\u0002\u0018\u00002\u00020\u0001:\u0001UB\t\b\u0002¢\u0006\u0004\bS\u0010TJ\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0018\u0010\b\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0018\u0010\t\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J*\u0010\t\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u000b\u001a\u00020\n2\b\u0010\r\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002J\f\u0010\u0010\u001a\u00020\u000e*\u00020\u0004H\u0007J\u0010\u0010\u0011\u001a\u00020\u000e2\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J \u0010\u0015\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0012\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0010\u0010\u0016\u001a\u00020\u000e2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0010\u0010\u0017\u001a\u00020\u000e2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J.\u0010\u001d\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\f\u0010\u0019\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u00182\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\u001c\u001a\u00020\u001aH\u0007J\u0010\u0010\u001e\u001a\u00020\u001a2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0010\u0010\u001f\u001a\u00020\u001a2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\"\u0010\"\u001a\u00020\u000e2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010!\u001a\u00020 2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0007J\u0010\u0010\"\u001a\u00020\u000e2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0010\u0010#\u001a\u00020\u00062\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010&\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010'\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010(\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\"\u0010)\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010%\u001a\u00020$2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0007J\"\u0010*\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010%\u001a\u00020$2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0007J\u0018\u0010,\u001a\u00020\u001a2\u0006\u0010+\u001a\u00020 2\u0006\u0010%\u001a\u00020$H\u0007J\u0018\u0010-\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010.\u001a\u00020\u000e2\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010/\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00100\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00101\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00102\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00103\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00104\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u00105\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0010\u00107\u001a\u00020\u000e2\u0006\u00106\u001a\u00020\u001aH\u0007J\u0018\u00108\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0018\u00109\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u001b\u001a\u00020\u001aH\u0007J\u0010\u0010:\u001a\u00020\f2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010;\u001a\u00020\u00062\u0006\u0010%\u001a\u00020$2\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010<\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0010\u0010=\u001a\u00020\u00062\u0006\u0010\u0014\u001a\u00020\u0013H\u0007J\u0018\u0010>\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u001c\u0010B\u001a\u0004\u0018\u00010A2\u0006\u0010@\u001a\u00020?2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0007J\"\u0010E\u001a\u00020D2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010C\u001a\u00020\f2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0002J.\u0010H\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010G\u001a\u00020F2\b\u0010\u0012\u001a\u0004\u0018\u00010\n2\n\b\u0002\u0010\u0014\u001a\u0004\u0018\u00010\u0013H\u0002J\"\u0010H\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010I\u001a\u00020\u00042\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0002R\u0014\u0010J\u001a\u00020\f8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bJ\u0010KR\u0011\u0010O\u001a\u00020L8G¢\u0006\u0006\u001a\u0004\bM\u0010NR\u0015\u0010R\u001a\u0006\u0012\u0002\b\u00030\u00188G¢\u0006\u0006\u001a\u0004\bP\u0010Q¨\u0006V"}, d2 = {"Lcom/braze/push/BrazeNotificationUtils;", "", "Landroid/content/Context;", "context", "Landroid/content/Intent;", "intent", "Llm9;", "handleNotificationOpened", "handleNotificationDeleted", "routeUserWithNotificationOpenedIntent", "Landroid/os/Bundle;", "extras", "", "deepLink", "", "useWebView", "isBrazePushMessage", "isNotificationMessage", "notificationExtras", "Lcom/braze/models/push/BrazeNotificationPayload;", "payload", "sendPushMessageReceivedBroadcast", "requestGeofenceRefreshIfAppropriate", "refreshFeatureFlagsIfAppropriate", "Ljava/lang/Class;", "thisClass", "", "notificationId", "durationInMillis", "setNotificationDurationAlarm", "getNotificationId", "getNotificationPriority", "Lcom/braze/configuration/BrazeConfigurationProvider;", "configurationProvider", "wakeScreenIfAppropriate", "prefetchBitmapsIfNewlyReceivedStoryPush", "Lmq5$e;", "notificationBuilder", "setTitleIfPresent", "setContentIfPresent", "setTickerIfPresent", "setContentIntentIfPresent", "setDeleteIntent", "appConfigurationProvider", "setSmallIcon", "setSetShowWhen", "setLargeIconIfPresentAndSupported", "setSoundIfPresentAndSupported", "setSummaryTextIfPresentAndSupported", "setPriorityIfPresentAndSupported", "setAccentColorIfPresentAndSupported", "setCategoryIfPresentAndSupported", "setVisibilityIfPresentAndSupported", "setPublicVersionIfPresentAndSupported", "visibility", "isValidNotificationVisibility", "handleCancelNotificationAction", "cancelNotification", "getOrCreateNotificationChannelId", "setNotificationBadgeNumberIfPresent", "handlePushStoryPageClicked", "handleContentCardsSerializedCardIfPresent", "sendNotificationOpenedBroadcast", "Landroid/app/NotificationManager;", "notificationManager", "Landroid/app/NotificationChannel;", "getValidNotificationChannel", "action", "Landroid/app/PendingIntent;", "getPushActionPendingIntent", "Lcom/braze/push/BrazeNotificationUtils$BrazeNotificationBroadcastType;", "broadcastType", "sendPushActionIntent", "pushIntent", "TAG", "Ljava/lang/String;", "Lcom/braze/IBrazeNotificationFactory;", "getActiveNotificationFactory", "()Lcom/braze/IBrazeNotificationFactory;", "activeNotificationFactory", "getNotificationReceiverClass", "()Ljava/lang/Class;", "notificationReceiverClass", "<init>", "()V", "BrazeNotificationBroadcastType", "android-sdk-ui_release"}, k = 1, mv = {1, 8, 0})
public final class BrazeNotificationUtils {
    public static final BrazeNotificationUtils INSTANCE = new BrazeNotificationUtils();
    private static final String TAG = BrazeLogger.getBrazeLogTag(BrazeNotificationUtils.class);

    @Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0082\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006j\u0002\b\u0007j\u0002\b\bj\u0002\b\t¨\u0006\n"}, d2 = {"Lcom/braze/push/BrazeNotificationUtils$BrazeNotificationBroadcastType;", "", "brazePushEventType", "Lcom/braze/enums/BrazePushEventType;", "(Ljava/lang/String;ILcom/braze/enums/BrazePushEventType;)V", "getBrazePushEventType", "()Lcom/braze/enums/BrazePushEventType;", "OPENED", "RECEIVED", "DELETED", "android-sdk-ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    enum BrazeNotificationBroadcastType {
        OPENED(BrazePushEventType.NOTIFICATION_OPENED),
        RECEIVED(BrazePushEventType.NOTIFICATION_RECEIVED),
        DELETED(BrazePushEventType.NOTIFICATION_DELETED);

        private final BrazePushEventType brazePushEventType;

        BrazeNotificationBroadcastType(BrazePushEventType brazePushEventType) {
            this.brazePushEventType = brazePushEventType;
        }

        public final BrazePushEventType getBrazePushEventType() {
            return this.brazePushEventType;
        }
    }

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[BrazeNotificationBroadcastType.values().length];
            try {
                iArr[BrazeNotificationBroadcastType.OPENED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[BrazeNotificationBroadcastType.RECEIVED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[BrazeNotificationBroadcastType.DELETED.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            $EnumSwitchMapping$0 = iArr;
        }
    }

    private BrazeNotificationUtils() {
    }

    public static final void cancelNotification(Context context, int i) {
        p64.h(context, "context");
        try {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$cancelNotification$1(i), 3, (Object) null);
            Intent intent = new Intent("com.braze.action.CANCEL_NOTIFICATION").setClass(context, getNotificationReceiverClass());
            p64.g(intent, "Intent(Constants.BRAZE_C…otificationReceiverClass)");
            intent.setPackage(context.getPackageName());
            intent.putExtra("nid", i);
            IntentUtils.addComponentAndSendBroadcast(context, intent);
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$cancelNotification$2.INSTANCE);
        }
    }

    public static final IBrazeNotificationFactory getActiveNotificationFactory() {
        IBrazeNotificationFactory customBrazeNotificationFactory = Braze.Companion.getCustomBrazeNotificationFactory();
        return customBrazeNotificationFactory == null ? BrazeNotificationFactory.INSTANCE.getInstance() : customBrazeNotificationFactory;
    }

    public static final int getNotificationId(BrazeNotificationPayload payload) {
        p64.h(payload, "payload");
        Integer customNotificationId = payload.getCustomNotificationId();
        if (customNotificationId != null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getNotificationId$1(customNotificationId), 3, (Object) null);
            return customNotificationId.intValue();
        }
        String titleText = payload.getTitleText();
        String str = "";
        if (titleText != null) {
            str = "" + titleText;
        }
        String contentText = payload.getContentText();
        if (contentText != null) {
            str = str + contentText;
        }
        int hashCode = str != null ? str.hashCode() : 0;
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getNotificationId$4(hashCode), 3, (Object) null);
        return hashCode;
    }

    public static final int getNotificationPriority(BrazeNotificationPayload payload) {
        p64.h(payload, "payload");
        Integer notificationPriorityInt = payload.getNotificationPriorityInt();
        Integer notificationPriorityInt2 = payload.getNotificationPriorityInt();
        if (notificationPriorityInt2 == null) {
            return 0;
        }
        int intValue = notificationPriorityInt2.intValue();
        if (-2 <= intValue && intValue < 3) {
            return intValue;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, BrazeLogger.Priority.W, (Throwable) null, new BrazeNotificationUtils$getNotificationPriority$1$1(notificationPriorityInt), 2, (Object) null);
        return 0;
    }

    public static final Class<?> getNotificationReceiverClass() {
        return Constants.isAmazonDevice() ? BrazeAmazonDeviceMessagingReceiver.class : BrazePushReceiver.class;
    }

    public static final String getOrCreateNotificationChannelId(BrazeNotificationPayload payload) {
        NotificationChannel notificationChannel;
        NotificationChannel notificationChannel2;
        p64.h(payload, "payload");
        String notificationChannelId = payload.getNotificationChannelId();
        if (Build.VERSION.SDK_INT < 26) {
            return notificationChannelId == null ? "com_appboy_default_notification_channel" : notificationChannelId;
        }
        Context context = payload.getContext();
        BrazeConfigurationProvider configurationProvider = payload.getConfigurationProvider();
        Object systemService = context != null ? context.getSystemService("notification") : null;
        p64.f(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        if (notificationChannelId != null) {
            notificationChannel2 = notificationManager.getNotificationChannel(notificationChannelId);
            if (notificationChannel2 != null) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getOrCreateNotificationChannelId$1(notificationChannelId), 3, (Object) null);
                return notificationChannelId;
            }
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getOrCreateNotificationChannelId$2(notificationChannelId), 3, (Object) null);
        }
        notificationChannel = notificationManager.getNotificationChannel("com_appboy_default_notification_channel");
        if (notificationChannel == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$getOrCreateNotificationChannelId$3.INSTANCE, 3, (Object) null);
            f80.a();
            NotificationChannel a = e80.a("com_appboy_default_notification_channel", configurationProvider != null ? configurationProvider.getDefaultNotificationChannelName() : null, 3);
            a.setDescription(configurationProvider != null ? configurationProvider.getDefaultNotificationChannelDescription() : null);
            notificationManager.createNotificationChannel(a);
        }
        return "com_appboy_default_notification_channel";
    }

    private final PendingIntent getPushActionPendingIntent(Context context, String action, Bundle notificationExtras) {
        Intent intent = new Intent(action).setClass(context, NotificationTrampolineActivity.class);
        p64.g(intent, "Intent(action).setClass(…lineActivity::class.java)");
        if (notificationExtras != null) {
            intent.putExtras(notificationExtras);
        }
        PendingIntent activity = PendingIntent.getActivity(context, IntentUtils.getRequestCode(), intent, 1073741824 | IntentUtils.getImmutablePendingIntentFlags());
        p64.g(activity, "getActivity(context, get… pushActionIntent, flags)");
        return activity;
    }

    @TargetApi(26)
    public static final NotificationChannel getValidNotificationChannel(NotificationManager notificationManager, Bundle notificationExtras) {
        NotificationChannel notificationChannel;
        NotificationChannel notificationChannel2;
        p64.h(notificationManager, "notificationManager");
        if (notificationExtras == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$getValidNotificationChannel$1.INSTANCE, 3, (Object) null);
            return null;
        }
        String string = notificationExtras.getString("ab_nc", null);
        if (string != null && !bu8.y(string)) {
            notificationChannel2 = notificationManager.getNotificationChannel(string);
            if (notificationChannel2 != null) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getValidNotificationChannel$2(string), 3, (Object) null);
                return notificationChannel2;
            }
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$getValidNotificationChannel$3(string), 3, (Object) null);
        }
        notificationChannel = notificationManager.getNotificationChannel("com_appboy_default_notification_channel");
        if (notificationChannel != null) {
            return notificationChannel;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$getValidNotificationChannel$4.INSTANCE, 3, (Object) null);
        return null;
    }

    public static final void handleCancelNotificationAction(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        try {
            if (intent.hasExtra("nid")) {
                int intExtra = intent.getIntExtra("nid", -1);
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$handleCancelNotificationAction$1(intExtra), 3, (Object) null);
                Object systemService = context.getSystemService("notification");
                p64.f(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
                ((NotificationManager) systemService).cancel("appboy_notification", intExtra);
            }
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$handleCancelNotificationAction$2.INSTANCE);
        }
    }

    public static final void handleContentCardsSerializedCardIfPresent(BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(brazeNotificationPayload, "payload");
        String contentCardSyncData = brazeNotificationPayload.getContentCardSyncData();
        String contentCardSyncUserId = brazeNotificationPayload.getContentCardSyncUserId();
        Context context = brazeNotificationPayload.getContext();
        if (contentCardSyncData == null || context == null) {
            return;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$handleContentCardsSerializedCardIfPresent$1(contentCardSyncUserId, contentCardSyncData), 3, (Object) null);
        BrazeInternal.addSerializedContentCardToStorage(context, contentCardSyncData, contentCardSyncUserId);
    }

    public static final void handleNotificationDeleted(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        try {
            BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
            BrazeNotificationUtils brazeNotificationUtils = INSTANCE;
            BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$handleNotificationDeleted$1.INSTANCE, 3, (Object) null);
            Bundle extras = intent.getExtras();
            if (extras != null) {
                brazeNotificationUtils.sendPushActionIntent(context, BrazeNotificationBroadcastType.DELETED, extras, new BrazeNotificationPayload(extras, null, context, null, 10, null));
            } else {
                sendPushActionIntent$default(brazeNotificationUtils, context, BrazeNotificationBroadcastType.DELETED, extras, null, 8, null);
            }
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$handleNotificationDeleted$2.INSTANCE);
        }
    }

    public static final void handleNotificationOpened(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        try {
            Braze.Companion.getInstance(context).logPushNotificationOpened(intent);
            sendNotificationOpenedBroadcast(context, intent);
            if (BrazeInternal.INSTANCE.getConfigurationProvider(context).getDoesHandlePushDeepLinksAutomatically()) {
                routeUserWithNotificationOpenedIntent(context, intent);
            } else {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, BrazeLogger.Priority.I, (Throwable) null, BrazeNotificationUtils$handleNotificationOpened$1.INSTANCE, 2, (Object) null);
            }
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$handleNotificationOpened$2.INSTANCE);
        }
    }

    public static final void handlePushStoryPageClicked(android.content.Context r7, android.content.Intent r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.braze.push.BrazeNotificationUtils.handlePushStoryPageClicked(android.content.Context, android.content.Intent):void");
    }

    public static final boolean isBrazePushMessage(Intent intent) {
        p64.h(intent, "<this>");
        Bundle extras = intent.getExtras();
        if (extras == null) {
            return false;
        }
        return bu8.w("true", extras.getString("_ab"), true);
    }

    public static final boolean isNotificationMessage(Intent intent) {
        p64.h(intent, "intent");
        Bundle extras = intent.getExtras();
        return extras != null && extras.containsKey("t") && extras.containsKey("a");
    }

    @TargetApi(21)
    public static final boolean isValidNotificationVisibility(int visibility) {
        return visibility == -1 || visibility == 0 || visibility == 1;
    }

    public static final void prefetchBitmapsIfNewlyReceivedStoryPush(BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(brazeNotificationPayload, "payload");
        Context context = brazeNotificationPayload.getContext();
        if (context != null && brazeNotificationPayload.getIsPushStory() && brazeNotificationPayload.getIsNewlyReceivedPushStory()) {
            List<BrazeNotificationPayload.PushStoryPage> pushStoryPages = brazeNotificationPayload.getPushStoryPages();
            ArrayList<String> arrayList = new ArrayList();
            Iterator<T> it = pushStoryPages.iterator();
            while (it.hasNext()) {
                String bitmapUrl = ((BrazeNotificationPayload.PushStoryPage) it.next()).getBitmapUrl();
                if (bitmapUrl != null) {
                    arrayList.add(bitmapUrl);
                }
            }
            for (String str : arrayList) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, BrazeLogger.Priority.V, (Throwable) null, new BrazeNotificationUtils$prefetchBitmapsIfNewlyReceivedStoryPush$2$1(str), 2, (Object) null);
                Braze.Companion.getInstance(context).getImageLoader().getPushBitmapFromUrl(context, brazeNotificationPayload.getBrazeExtras(), str, BrazeViewBounds.NOTIFICATION_ONE_IMAGE_STORY);
            }
            brazeNotificationPayload.setNewlyReceivedPushStory(false);
        }
    }

    public static final boolean refreshFeatureFlagsIfAppropriate(BrazeNotificationPayload payload) {
        p64.h(payload, "payload");
        Context context = payload.getContext();
        if (!payload.getShouldRefreshFeatureFlags() || context == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, BrazeLogger.Priority.V, (Throwable) null, BrazeNotificationUtils$refreshFeatureFlagsIfAppropriate$2.INSTANCE, 2, (Object) null);
            return false;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$refreshFeatureFlagsIfAppropriate$1.INSTANCE, 3, (Object) null);
        BrazeInternal.refreshFeatureFlags(context);
        return true;
    }

    public static final boolean requestGeofenceRefreshIfAppropriate(BrazeNotificationPayload payload) {
        p64.h(payload, "payload");
        Context context = payload.getContext();
        if (!payload.getShouldSyncGeofences() || context == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$requestGeofenceRefreshIfAppropriate$2.INSTANCE, 3, (Object) null);
            return false;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$requestGeofenceRefreshIfAppropriate$1.INSTANCE, 3, (Object) null);
        BrazeInternal.requestGeofenceRefresh(context, true);
        return true;
    }

    public static final void routeUserWithNotificationOpenedIntent(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
        BrazeNotificationUtils brazeNotificationUtils = INSTANCE;
        BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$routeUserWithNotificationOpenedIntent$1.INSTANCE, 3, (Object) null);
        Bundle bundleExtra = intent.getBundleExtra(BukaPengirimanDeliveryInsuranceTransaction.EXTRA);
        if (bundleExtra == null) {
            bundleExtra = new Bundle();
        }
        bundleExtra.putString("cid", intent.getStringExtra("cid"));
        bundleExtra.putString("source", "Appboy");
        brazeNotificationUtils.routeUserWithNotificationOpenedIntent(context, bundleExtra, intent.getStringExtra("uri"), bu8.w("true", intent.getStringExtra("ab_use_webview"), true));
    }

    public static final void sendNotificationOpenedBroadcast(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
        BrazeNotificationUtils brazeNotificationUtils = INSTANCE;
        BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$sendNotificationOpenedBroadcast$1.INSTANCE, 3, (Object) null);
        Bundle extras = intent.getExtras();
        if (extras == null) {
            sendPushActionIntent$default(brazeNotificationUtils, context, BrazeNotificationBroadcastType.OPENED, extras, null, 8, null);
        } else {
            brazeNotificationUtils.sendPushActionIntent(context, BrazeNotificationBroadcastType.OPENED, extras, new BrazeNotificationPayload(extras, null, context, null, 10, null));
        }
    }

    private final void sendPushActionIntent(Context context, BrazeNotificationBroadcastType brazeNotificationBroadcastType, Bundle bundle, BrazeNotificationPayload brazeNotificationPayload) {
        Intent intent;
        int i = WhenMappings.$EnumSwitchMapping$0[brazeNotificationBroadcastType.ordinal()];
        if (i == 1) {
            intent = new Intent("com.braze.push.intent.NOTIFICATION_OPENED").setPackage(context.getPackageName());
            p64.g(intent, "{\n                Intent…ackageName)\n            }");
        } else if (i == 2) {
            intent = new Intent("com.braze.push.intent.NOTIFICATION_RECEIVED").setPackage(context.getPackageName());
            p64.g(intent, "{\n                Intent…ackageName)\n            }");
        } else {
            if (i != 3) {
                throw new NoWhenBranchMatchedException();
            }
            intent = new Intent("com.braze.push.intent.NOTIFICATION_DELETED").setPackage(context.getPackageName());
            p64.g(intent, "{\n                Intent…ackageName)\n            }");
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.V, (Throwable) null, new BrazeNotificationUtils$sendPushActionIntent$1(brazeNotificationBroadcastType), 2, (Object) null);
        sendPushActionIntent(context, intent, bundle);
        if (brazeNotificationPayload != null) {
            BrazeInternal.INSTANCE.publishBrazePushAction(context, brazeNotificationBroadcastType.getBrazePushEventType(), brazeNotificationPayload);
        }
    }

    static void sendPushActionIntent$default(BrazeNotificationUtils brazeNotificationUtils, Context context, BrazeNotificationBroadcastType brazeNotificationBroadcastType, Bundle bundle, BrazeNotificationPayload brazeNotificationPayload, int i, Object obj) {
        if ((i & 8) != 0) {
            brazeNotificationPayload = null;
        }
        brazeNotificationUtils.sendPushActionIntent(context, brazeNotificationBroadcastType, bundle, brazeNotificationPayload);
    }

    public static final void sendPushMessageReceivedBroadcast(Context context, Bundle bundle, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(context, "context");
        p64.h(bundle, "notificationExtras");
        p64.h(brazeNotificationPayload, "payload");
        BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
        BrazeNotificationUtils brazeNotificationUtils = INSTANCE;
        BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$sendPushMessageReceivedBroadcast$1.INSTANCE, 3, (Object) null);
        brazeNotificationUtils.sendPushActionIntent(context, BrazeNotificationBroadcastType.RECEIVED, bundle, brazeNotificationPayload);
    }

    public static final void setAccentColorIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        Integer accentColor = brazeNotificationPayload.getAccentColor();
        if (accentColor != null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setAccentColorIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
            eVar.o(accentColor.intValue());
            return;
        }
        BrazeConfigurationProvider configurationProvider = brazeNotificationPayload.getConfigurationProvider();
        if (configurationProvider != null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setAccentColorIfPresentAndSupported$2$1.INSTANCE, 3, (Object) null);
            eVar.o(configurationProvider.getDefaultNotificationAccentColor());
        }
    }

    public static final void setCategoryIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        String notificationCategory = brazeNotificationPayload.getNotificationCategory();
        if (notificationCategory == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setCategoryIfPresentAndSupported$2.INSTANCE, 3, (Object) null);
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setCategoryIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
            eVar.m(notificationCategory);
        }
    }

    public static final void setContentIfPresent(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        BrazeConfigurationProvider configurationProvider;
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setContentIfPresent$1.INSTANCE, 3, (Object) null);
        String contentText = brazeNotificationPayload.getContentText();
        if (contentText == null || (configurationProvider = brazeNotificationPayload.getConfigurationProvider()) == null) {
            return;
        }
        eVar.q(HtmlUtils.getHtmlSpannedTextIfEnabled(contentText, configurationProvider));
    }

    public static final void setContentIntentIfPresent(Context context, mq5.e eVar, Bundle bundle) {
        p64.h(context, "context");
        p64.h(eVar, "notificationBuilder");
        try {
            eVar.p(INSTANCE.getPushActionPendingIntent(context, "com.braze.action.BRAZE_PUSH_CLICKED", bundle));
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$setContentIntentIfPresent$1.INSTANCE);
        }
    }

    public static final void setDeleteIntent(Context context, mq5.e eVar, Bundle bundle) {
        p64.h(context, "context");
        p64.h(eVar, "notificationBuilder");
        try {
            Intent intent = new Intent("com.braze.action.BRAZE_PUSH_DELETED").setClass(context, getNotificationReceiverClass());
            p64.g(intent, "Intent(Constants.BRAZE_P…otificationReceiverClass)");
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            eVar.v(PendingIntent.getBroadcast(context, IntentUtils.getRequestCode(), intent, IntentUtils.getImmutablePendingIntentFlags() | 1073741824));
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$setDeleteIntent$1.INSTANCE);
        }
    }

    public static final boolean setLargeIconIfPresentAndSupported(mq5.e notificationBuilder, BrazeNotificationPayload payload) {
        BrazeConfigurationProvider configurationProvider;
        BrazeLogger brazeLogger;
        BrazeNotificationUtils brazeNotificationUtils;
        String largeIcon;
        p64.h(notificationBuilder, "notificationBuilder");
        p64.h(payload, "payload");
        if (payload.getIsPushStory()) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
            return false;
        }
        Context context = payload.getContext();
        if (context == null || (configurationProvider = payload.getConfigurationProvider()) == null) {
            return false;
        }
        try {
            brazeLogger = BrazeLogger.INSTANCE;
            brazeNotificationUtils = INSTANCE;
            BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$2.INSTANCE, 3, (Object) null);
            largeIcon = payload.getLargeIcon();
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$6.INSTANCE);
        }
        if (largeIcon != null) {
            notificationBuilder.z(Braze.Companion.getInstance(context).getImageLoader().getPushBitmapFromUrl(context, (Bundle) null, largeIcon, BrazeViewBounds.NOTIFICATION_LARGE_ICON));
            return true;
        }
        BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$4.INSTANCE, 3, (Object) null);
        int largeNotificationIconResourceId = configurationProvider.getLargeNotificationIconResourceId();
        if (largeNotificationIconResourceId != 0) {
            notificationBuilder.z(BitmapFactory.decodeResource(context.getResources(), largeNotificationIconResourceId));
            return true;
        }
        BrazeLogger.brazelog$default(brazeLogger, brazeNotificationUtils, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$5.INSTANCE, 3, (Object) null);
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setLargeIconIfPresentAndSupported$7.INSTANCE, 3, (Object) null);
        return false;
    }

    public static final void setNotificationBadgeNumberIfPresent(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        if (Build.VERSION.SDK_INT < 26) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setNotificationBadgeNumberIfPresent$1.INSTANCE, 3, (Object) null);
            return;
        }
        Integer notificationBadgeNumber = brazeNotificationPayload.getNotificationBadgeNumber();
        if (notificationBadgeNumber != null) {
            eVar.C(notificationBadgeNumber.intValue());
        }
    }

    public static final void setNotificationDurationAlarm(Context context, Class<?> cls, int i, int i2) {
        p64.h(context, "context");
        Intent intent = new Intent(context, cls);
        intent.setAction("com.braze.action.CANCEL_NOTIFICATION");
        intent.putExtra("nid", i);
        PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, intent, 134217728 | IntentUtils.getImmutablePendingIntentFlags());
        Object systemService = context.getSystemService("alarm");
        p64.f(systemService, "null cannot be cast to non-null type android.app.AlarmManager");
        AlarmManager alarmManager = (AlarmManager) systemService;
        if (i2 >= 1000) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$setNotificationDurationAlarm$1(i2), 3, (Object) null);
            alarmManager.set(3, SystemClock.elapsedRealtime() + i2, broadcast);
        }
    }

    public static final void setPriorityIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setPriorityIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
        eVar.F(getNotificationPriority(brazeNotificationPayload));
    }

    public static final void setPublicVersionIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        Context context = brazeNotificationPayload.getContext();
        BrazeConfigurationProvider configurationProvider = brazeNotificationPayload.getConfigurationProvider();
        if (context == null || brazeNotificationPayload.getPublicNotificationExtras() == null || configurationProvider == null) {
            return;
        }
        String orCreateNotificationChannelId = getOrCreateNotificationChannelId(brazeNotificationPayload);
        Bundle parseJsonObjectIntoBundle = JsonUtils.parseJsonObjectIntoBundle(brazeNotificationPayload.getPublicNotificationExtras());
        if (parseJsonObjectIntoBundle.isEmpty()) {
            return;
        }
        BrazeNotificationPayload brazeNotificationPayload2 = new BrazeNotificationPayload(parseJsonObjectIntoBundle, null, context, configurationProvider, 2, null);
        mq5.e eVar2 = new mq5.e(context, orCreateNotificationChannelId);
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$setPublicVersionIfPresentAndSupported$2(brazeNotificationPayload2), 3, (Object) null);
        setContentIfPresent(eVar2, brazeNotificationPayload2);
        setTitleIfPresent(eVar2, brazeNotificationPayload2);
        setSummaryTextIfPresentAndSupported(eVar2, brazeNotificationPayload2);
        setSmallIcon(configurationProvider, eVar2);
        setAccentColorIfPresentAndSupported(eVar2, brazeNotificationPayload2);
        eVar.H(eVar2.c());
    }

    public static final void setSetShowWhen(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        if (brazeNotificationPayload.getIsPushStory()) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSetShowWhen$1.INSTANCE, 3, (Object) null);
            eVar.J(false);
        }
    }

    public static final int setSmallIcon(BrazeConfigurationProvider appConfigurationProvider, mq5.e notificationBuilder) {
        p64.h(appConfigurationProvider, "appConfigurationProvider");
        p64.h(notificationBuilder, "notificationBuilder");
        int smallNotificationIconResourceId = appConfigurationProvider.getSmallNotificationIconResourceId();
        if (smallNotificationIconResourceId == 0) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSmallIcon$1.INSTANCE, 3, (Object) null);
            smallNotificationIconResourceId = appConfigurationProvider.getApplicationIconResourceId();
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSmallIcon$2.INSTANCE, 3, (Object) null);
        }
        notificationBuilder.K(smallNotificationIconResourceId);
        return smallNotificationIconResourceId;
    }

    public static final void setSoundIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        String notificationSound = brazeNotificationPayload.getNotificationSound();
        if (notificationSound == null) {
            return;
        }
        if (p64.c(notificationSound, "d")) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSoundIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
            eVar.u(1);
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSoundIfPresentAndSupported$2.INSTANCE, 3, (Object) null);
            eVar.L(Uri.parse(notificationSound));
        }
    }

    public static final void setSummaryTextIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        String summaryText = brazeNotificationPayload.getSummaryText();
        if (summaryText == null) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSummaryTextIfPresentAndSupported$2.INSTANCE, 3, (Object) null);
        } else {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setSummaryTextIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
            eVar.N(summaryText);
        }
    }

    public static final void setTickerIfPresent(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setTickerIfPresent$1.INSTANCE, 3, (Object) null);
        String titleText = brazeNotificationPayload.getTitleText();
        if (titleText == null) {
            return;
        }
        eVar.O(titleText);
    }

    public static final void setTitleIfPresent(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        BrazeConfigurationProvider configurationProvider;
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setTitleIfPresent$1.INSTANCE, 3, (Object) null);
        String titleText = brazeNotificationPayload.getTitleText();
        if (titleText == null || (configurationProvider = brazeNotificationPayload.getConfigurationProvider()) == null) {
            return;
        }
        eVar.r(HtmlUtils.getHtmlSpannedTextIfEnabled(titleText, configurationProvider));
    }

    public static final void setVisibilityIfPresentAndSupported(mq5.e eVar, BrazeNotificationPayload brazeNotificationPayload) {
        p64.h(eVar, "notificationBuilder");
        p64.h(brazeNotificationPayload, "payload");
        Integer notificationVisibility = brazeNotificationPayload.getNotificationVisibility();
        if (notificationVisibility != null) {
            if (!isValidNotificationVisibility(notificationVisibility.intValue())) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, BrazeLogger.Priority.W, (Throwable) null, new BrazeNotificationUtils$setVisibilityIfPresentAndSupported$2(notificationVisibility), 2, (Object) null);
            } else {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$setVisibilityIfPresentAndSupported$1.INSTANCE, 3, (Object) null);
                eVar.Q(notificationVisibility.intValue());
            }
        }
    }

    public static final boolean wakeScreenIfAppropriate(Context context, BrazeConfigurationProvider configurationProvider, Bundle notificationExtras) {
        p64.h(context, "context");
        p64.h(configurationProvider, "configurationProvider");
        return wakeScreenIfAppropriate(new BrazeNotificationPayload(notificationExtras, null, context, configurationProvider, 2, null));
    }

    @SuppressLint({"WakelockTimeout"})
    public static final boolean wakeScreenIfAppropriate(BrazeNotificationPayload payload) {
        BrazeConfigurationProvider configurationProvider;
        int importance;
        p64.h(payload, "payload");
        Context context = payload.getContext();
        if (context == null || (configurationProvider = payload.getConfigurationProvider()) == null) {
            return false;
        }
        Bundle notificationExtras = payload.getNotificationExtras();
        if (!PermissionUtils.hasPermission(context, "android.permission.WAKE_LOCK") || !configurationProvider.isPushWakeScreenForNotificationEnabled()) {
            return false;
        }
        try {
            Object systemService = context.getSystemService("uimode");
            p64.f(systemService, "null cannot be cast to non-null type android.app.UiModeManager");
            if (((UiModeManager) systemService).getCurrentModeType() == 4) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$wakeScreenIfAppropriate$1.INSTANCE, 3, (Object) null);
                return false;
            }
        } catch (Exception e) {
            BrazeLogger.INSTANCE.brazelog(INSTANCE, BrazeLogger.Priority.E, e, BrazeNotificationUtils$wakeScreenIfAppropriate$2.INSTANCE);
        }
        if (Build.VERSION.SDK_INT >= 26) {
            Object systemService2 = context.getSystemService("notification");
            p64.f(systemService2, "null cannot be cast to non-null type android.app.NotificationManager");
            NotificationChannel validNotificationChannel = getValidNotificationChannel((NotificationManager) systemService2, notificationExtras);
            if (validNotificationChannel != null) {
                importance = validNotificationChannel.getImportance();
                if (importance == 1) {
                    BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$wakeScreenIfAppropriate$4(validNotificationChannel), 3, (Object) null);
                    return false;
                }
            } else {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$wakeScreenIfAppropriate$3.INSTANCE, 3, (Object) null);
                return false;
            }
        } else if (getNotificationPriority(payload) == -2) {
            return false;
        }
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, INSTANCE, (BrazeLogger.Priority) null, (Throwable) null, BrazeNotificationUtils$wakeScreenIfAppropriate$5.INSTANCE, 3, (Object) null);
        Object systemService3 = context.getSystemService("power");
        p64.f(systemService3, "null cannot be cast to non-null type android.os.PowerManager");
        PowerManager.WakeLock newWakeLock = ((PowerManager) systemService3).newWakeLock(268435482, TAG);
        newWakeLock.acquire();
        newWakeLock.release();
        return true;
    }

    private final void routeUserWithNotificationOpenedIntent(Context context, Bundle bundle, String str, boolean z) {
        if (str != null && !bu8.y(str)) {
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$routeUserWithNotificationOpenedIntent$3(str, z), 3, (Object) null);
            bundle.putString("uri", str);
            bundle.putBoolean("ab_use_webview", z);
            BrazeDeeplinkHandler.Companion companion = BrazeDeeplinkHandler.INSTANCE;
            UriAction createUriActionFromUrlString = companion.getInstance().createUriActionFromUrlString(str, bundle, z, Channel.PUSH);
            if (createUriActionFromUrlString != null) {
                companion.getInstance().gotoUri(context, createUriActionFromUrlString);
                return;
            }
            return;
        }
        Intent mainActivityIntent = UriUtils.getMainActivityIntent(context, bundle);
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, new BrazeNotificationUtils$routeUserWithNotificationOpenedIntent$5(mainActivityIntent), 3, (Object) null);
        context.startActivity(mainActivityIntent);
    }

    private final void sendPushActionIntent(Context context, Intent intent, Bundle bundle) {
        BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.V, (Throwable) null, new BrazeNotificationUtils$sendPushActionIntent$2(intent), 2, (Object) null);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        IntentUtils.addComponentAndSendBroadcast(context, intent);
    }
}