导航菜单

页面标题

页面副标题

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

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

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


package com.braze.push;

import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.app.NotificationManagerCompat;
import com.braze.Braze;
import com.braze.BrazeInternal;
import com.braze.Constants;
import com.braze.configuration.BrazeConfigurationProvider;
import com.braze.coroutine.BrazeCoroutineScope;
import com.braze.models.push.BrazeNotificationPayload;
import com.braze.support.BrazeLogger;
import com.braze.ui.inappmessage.BrazeInAppMessageManager;
import com.bukalapak.android.lib.api4.tungku.data.BukaPengirimanDeliveryInsuranceTransaction;
import com.bukalapak.android.lib.api4.tungku.data.LoanWallet;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;

@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0016\u0018\u0000 \n2\u00020\u0001:\u0001\nB\u0007¢\u0006\u0004\b\b\u0010\tJ\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0016¨\u0006\u000b"}, d2 = {"Lcom/braze/push/BrazePushReceiver;", "Landroid/content/BroadcastReceiver;", "Landroid/content/Context;", "context", "Landroid/content/Intent;", "intent", "Llm9;", "onReceive", "<init>", "()V", "Companion", "android-sdk-ui_release"}, k = 1, mv = {1, 8, 0})
public class BrazePushReceiver extends BroadcastReceiver {

    public static final Companion INSTANCE = new Companion(null);

    @Metadata(d1 = {"\u0000B\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\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u000f\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b&\u0010'J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J\"\u0010\n\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u00042\b\b\u0002\u0010\t\u001a\u00020\bH\u0007J \u0010\r\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0018\u0010\u000e\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J\u0018\u0010\u000f\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0007J(\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0012\u001a\u00020\u0010H\u0007J\u001f\u0010\u0018\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0013H\u0001¢\u0006\u0004\b\u0016\u0010\u0017R\u0014\u0010\u001a\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u001a\u0010\u001bR\u0014\u0010\u001c\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u001c\u0010\u001bR\u0014\u0010\u001d\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u001d\u0010\u001bR\u0014\u0010\u001e\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u001e\u0010\u001bR\u0014\u0010\u001f\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u001f\u0010\u001bR\u0014\u0010 \u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b \u0010\u001bR\u0014\u0010!\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b!\u0010\u001bR\u0014\u0010\"\u001a\u00020\u00198\u0006X\u0086T¢\u0006\u0006\n\u0004\b\"\u0010\u001bR\u0014\u0010#\u001a\u00020\u00198\u0006X\u0086T¢\u0006\u0006\n\u0004\b#\u0010\u001bR\u0014\u0010$\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b$\u0010\u001bR\u0014\u0010%\u001a\u00020\u00198\u0002X\u0082T¢\u0006\u0006\n\u0004\b%\u0010\u001b¨\u0006("}, d2 = {"Lcom/braze/push/BrazePushReceiver$Companion;", "", "Landroid/content/Context;", "context", "Landroid/content/Intent;", "intent", "Llm9;", "handlePush", "", "runOnThread", "handleReceivedIntent", "Lcom/braze/configuration/BrazeConfigurationProvider;", "appConfigurationProvider", "handleAdmRegistrationEventIfEnabled", "handleAdmRegistrationIntent", "handlePushNotificationPayload", "Landroid/os/Bundle;", "notificationExtras", "brazeExtras", "Lcom/braze/models/push/BrazeNotificationPayload;", "createPayload", "payload", "logNotificationMetadata$android_sdk_ui_release", "(Landroid/content/Context;Lcom/braze/models/push/BrazeNotificationPayload;)V", "logNotificationMetadata", "", "ADM_ERROR_DESCRIPTION_KEY", "Ljava/lang/String;", "ADM_ERROR_KEY", "ADM_RECEIVE_INTENT_ACTION", "ADM_REGISTRATION_ID_KEY", "ADM_REGISTRATION_INTENT_ACTION", "ADM_UNREGISTERED_KEY", "DELETED_MESSAGES_KEY", "FIREBASE_MESSAGING_SERVICE_ROUTING_ACTION", "HMS_PUSH_SERVICE_ROUTING_ACTION", "MESSAGE_TYPE_KEY", "NUMBER_OF_MESSAGES_DELETED_KEY", "<init>", "()V", "android-sdk-ui_release"}, k = 1, mv = {1, 8, 0})
    public static final class Companion {
        private Companion() {
        }

        public Companion(oq1 oq1Var) {
            this();
        }

        public final void handlePush(Context context, Intent intent) {
            Context applicationContext = context.getApplicationContext();
            String action = intent.getAction();
            try {
                handlePush$performWork(action, applicationContext, intent, context);
            } catch (Exception e) {
                BrazeLogger.INSTANCE.brazelog(this, BrazeLogger.Priority.E, e, new BrazePushReceiver$Companion$handlePush$1(action, intent));
            }
        }

        private static final void handlePush$performWork(java.lang.String r9, android.content.Context r10, android.content.Intent r11, android.content.Context r12) {
            throw new UnsupportedOperationException("Method not decompiled: com.braze.push.BrazePushReceiver.Companion.handlePush$performWork(java.lang.String, android.content.Context, android.content.Intent, android.content.Context):void");
        }

        public static void handleReceivedIntent$default(Companion companion, Context context, Intent intent, boolean z, int i, Object obj) {
            if ((i & 4) != 0) {
                z = true;
            }
            companion.handleReceivedIntent(context, intent, z);
        }

        public final BrazeNotificationPayload createPayload(Context context, BrazeConfigurationProvider appConfigurationProvider, Bundle notificationExtras, Bundle brazeExtras) {
            p64.h(context, "context");
            p64.h(appConfigurationProvider, "appConfigurationProvider");
            p64.h(notificationExtras, "notificationExtras");
            p64.h(brazeExtras, "brazeExtras");
            return Constants.isAmazonDevice() ? new BrazeNotificationPayload(notificationExtras, BrazeNotificationPayload.INSTANCE.getAttachedBrazeExtras(notificationExtras), context, appConfigurationProvider) : new BrazeNotificationPayload(notificationExtras, brazeExtras, context, appConfigurationProvider);
        }

        public final boolean handleAdmRegistrationEventIfEnabled(BrazeConfigurationProvider appConfigurationProvider, Context context, Intent intent) {
            p64.h(appConfigurationProvider, "appConfigurationProvider");
            p64.h(context, "context");
            p64.h(intent, "intent");
            BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
            BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$1(intent), 2, (Object) null);
            if (!Constants.isAmazonDevice() || !appConfigurationProvider.isAdmMessagingRegistrationEnabled()) {
                BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.W, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$3.INSTANCE, 2, (Object) null);
                return false;
            }
            BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationEventIfEnabled$2.INSTANCE, 3, (Object) null);
            handleAdmRegistrationIntent(context, intent);
            return true;
        }

        public final boolean handleAdmRegistrationIntent(Context context, Intent intent) {
            p64.h(context, "context");
            p64.h(intent, "intent");
            String stringExtra = intent.getStringExtra("error");
            String stringExtra2 = intent.getStringExtra("error_description");
            String stringExtra3 = intent.getStringExtra("registration_id");
            String stringExtra4 = intent.getStringExtra(LoanWallet.UNREGISTERED);
            if (stringExtra != null) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$1(stringExtra, stringExtra2), 2, (Object) null);
                return true;
            }
            if (stringExtra3 != null) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$2(stringExtra3), 2, (Object) null);
                Braze.Companion.getInstance(context).setRegisteredPushToken(stringExtra3);
                return true;
            }
            if (stringExtra4 != null) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, new BrazePushReceiver$Companion$handleAdmRegistrationIntent$3(stringExtra4), 2, (Object) null);
                return true;
            }
            BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.W, (Throwable) null, BrazePushReceiver$Companion$handleAdmRegistrationIntent$4.INSTANCE, 2, (Object) null);
            return false;
        }

        public final boolean handlePushNotificationPayload(Context context, Intent intent) {
            p64.h(context, "context");
            p64.h(intent, "intent");
            if (!BrazeNotificationUtils.isBrazePushMessage(intent)) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$1.INSTANCE, 3, (Object) null);
                return false;
            }
            if (p64.c("deleted_messages", intent.getStringExtra("message_type"))) {
                BrazeLogger.brazelog$default(BrazeLogger.INSTANCE, this, BrazeLogger.Priority.I, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$2(intent.getIntExtra("total_deleted", -1)), 2, (Object) null);
                return false;
            }
            Bundle extras = intent.getExtras();
            if (extras == null) {
                return false;
            }
            BrazeLogger brazeLogger = BrazeLogger.INSTANCE;
            BrazeLogger.Priority priority = BrazeLogger.Priority.I;
            BrazeLogger.brazelog$default(brazeLogger, this, priority, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$3(extras), 2, (Object) null);
            Bundle attachedBrazeExtras = BrazeNotificationPayload.INSTANCE.getAttachedBrazeExtras(extras);
            extras.putBundle(BukaPengirimanDeliveryInsuranceTransaction.EXTRA, attachedBrazeExtras);
            if (!extras.containsKey("braze_push_received_timestamp")) {
                extras.putLong("braze_push_received_timestamp", System.currentTimeMillis());
            }
            BrazeInternal brazeInternal = BrazeInternal.INSTANCE;
            BrazeConfigurationProvider configurationProvider = brazeInternal.getConfigurationProvider(context);
            BrazeNotificationPayload createPayload = createPayload(context, configurationProvider, extras, attachedBrazeExtras);
            if (createPayload.getIsUninstallTrackingPush()) {
                BrazeLogger.brazelog$default(brazeLogger, this, priority, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$4.INSTANCE, 2, (Object) null);
                return false;
            }
            String pushUniqueId = createPayload.getPushUniqueId();
            if (pushUniqueId != null && !brazeInternal.validateAndStorePushId(context, pushUniqueId)) {
                BrazeLogger.brazelog$default(brazeLogger, BrazePushReceiver.INSTANCE, priority, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$5$1(pushUniqueId), 2, (Object) null);
                return false;
            }
            BrazeNotificationUtils.handleContentCardsSerializedCardIfPresent(createPayload);
            if (createPayload.getShouldFetchTestTriggers() && configurationProvider.isInAppMessageTestPushEagerDisplayEnabled() && BrazeInAppMessageManager.Companion.getInstance().getActivity() != null) {
                BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$6.INSTANCE, 3, (Object) null);
                BrazeInternal.handleInAppMessageTestPush(context, intent);
                return false;
            }
            if (!BrazeNotificationUtils.isNotificationMessage(intent)) {
                BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$14.INSTANCE, 3, (Object) null);
                BrazeNotificationUtils.sendPushMessageReceivedBroadcast(context, extras, createPayload);
                BrazeNotificationUtils.requestGeofenceRefreshIfAppropriate(createPayload);
                BrazeNotificationUtils.refreshFeatureFlagsIfAppropriate(createPayload);
                return false;
            }
            BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$7.INSTANCE, 3, (Object) null);
            int notificationId = BrazeNotificationUtils.getNotificationId(createPayload);
            extras.putInt("nid", notificationId);
            if (createPayload.getIsPushStory()) {
                if (Constants.isAmazonDevice()) {
                    BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$8.INSTANCE, 3, (Object) null);
                    return false;
                }
                if (!extras.containsKey("braze_story_newly_received")) {
                    BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$9.INSTANCE, 3, (Object) null);
                    extras.putBoolean("braze_story_newly_received", true);
                }
            }
            BrazeLogger.brazelog$default(brazeLogger, this, BrazeLogger.Priority.V, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$10(createPayload), 2, (Object) null);
            Notification createNotification = BrazeNotificationUtils.getActiveNotificationFactory().createNotification(createPayload);
            if (createNotification == null) {
                BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, BrazePushReceiver$Companion$handlePushNotificationPayload$11.INSTANCE, 3, (Object) null);
                return false;
            }
            NotificationManagerCompat from = NotificationManagerCompat.from(context);
            p64.g(from, "from(context)");
            BrazeLogger.brazelog$default(brazeLogger, this, (BrazeLogger.Priority) null, (Throwable) null, new BrazePushReceiver$Companion$handlePushNotificationPayload$12(from), 3, (Object) null);
            from.notify("appboy_notification", notificationId, createNotification);
            BrazeNotificationUtils.sendPushMessageReceivedBroadcast(context, extras, createPayload);
            BrazeNotificationUtils.wakeScreenIfAppropriate(context, configurationProvider, extras);
            Integer pushDuration = createPayload.getPushDuration();
            if (pushDuration != null) {
                BrazeNotificationUtils.setNotificationDurationAlarm(context, BrazePushReceiver.class, notificationId, pushDuration.intValue());
            }
            logNotificationMetadata$android_sdk_ui_release(context, createPayload);
            return true;
        }

        public final void handleReceivedIntent(Context context, Intent intent, boolean z) {
            p64.h(context, "context");
            p64.h(intent, "intent");
            if (z) {
                ja0.d(BrazeCoroutineScope.INSTANCE, (v41) null, (f51) null, new BrazePushReceiver$Companion$handleReceivedIntent$1(context, intent, null), 3, (Object) null);
            } else {
                handlePush(context, intent);
            }
        }

        public final void logNotificationMetadata$android_sdk_ui_release(Context context, BrazeNotificationPayload payload) {
            String campaignId;
            p64.h(context, "context");
            p64.h(payload, "payload");
            if (payload.getIsPushDeliveryEnabled() && (campaignId = payload.getCampaignId()) != null) {
                long c = hh7.c(payload.getFlushMinMinutes(), 0L);
                long c2 = hh7.c(payload.getFlushMaxMinutes(), c);
                TimeUnit timeUnit = TimeUnit.MINUTES;
                long millis = timeUnit.toMillis(c);
                if (c2 > c) {
                    millis = dh7.a.g(millis, timeUnit.toMillis(c2));
                }
                BrazeInternal.INSTANCE.logPushDelivery(context, campaignId, millis);
            }
            String campaignId2 = payload.getCampaignId();
            if (campaignId2 != null) {
                BrazeInternal.INSTANCE.logPushCampaign(context, campaignId2);
            }
        }
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        p64.h(context, "context");
        p64.h(intent, "intent");
        Companion.handleReceivedIntent$default(INSTANCE, context, intent, false, 4, null);
    }
}