导航菜单

页面标题

页面副标题

Housing v14.7.8 - MoEPushWorker.java 源代码

正在查看: Housing v14.7.8 应用的 MoEPushWorker.java JAVA 源代码文件

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


package com.moengage.pushbase.internal;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Keep;
import com.moengage.core.internal.global.IntentProcessorKt;
import com.moengage.core.internal.logger.Logger;
import com.moengage.core.internal.model.SdkInstance;
import com.moengage.core.internal.utils.CoreUtils;
import com.moengage.pushbase.MoEPushConstants;
import com.moengage.pushbase.internal.repository.ActionParser;
import com.moengage.pushbase.internal.richnotification.RichNotificationManager;
import com.moengage.pushbase.model.action.DismissAction;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.jvm.internal.r;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

@Keep
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\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\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0007\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u001f\u0010\t\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\t\u0010\nJ\u001f\u0010\u000b\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\u000b\u0010\nJ\u0019\u0010\u000e\u001a\u00020\b2\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0015¢\u0006\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0011\u001a\u00020\u00108\u0002X\u0082D¢\u0006\u0006\n\u0004\b\u0011\u0010\u0012¨\u0006\u0013"}, d2 = {"Lcom/moengage/pushbase/internal/MoEPushWorker;", "Landroid/app/IntentService;", "<init>", "()V", "Landroid/os/Bundle;", "extras", "Lcom/moengage/core/internal/model/SdkInstance;", "sdkInstance", "Lzp/j0;", "dismissNotification", "(Landroid/os/Bundle;Lcom/moengage/core/internal/model/SdkInstance;)V", "handleNotificationCleared", "Landroid/content/Intent;", "intent", "onHandleIntent", "(Landroid/content/Intent;)V", "", "tag", "Ljava/lang/String;", "pushbase_defaultRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class MoEPushWorker extends IntentService {

    @NotNull
    private final String tag;

    public MoEPushWorker() {
        super("RegistrationIntentService");
        this.tag = "PushBase_8.3.1_MoEPushWorker";
    }

    private final void dismissNotification(Bundle extras, SdkInstance sdkInstance) throws JSONException {
        Logger.log$default(sdkInstance.logger, 0, null, null, new MoEPushWorker$dismissNotification$1(this), 7, null);
        Context applicationContext = getApplicationContext();
        r.j(applicationContext, "getApplicationContext(...)");
        UtilsKt.deleteCachedImagesAsync$default(applicationContext, sdkInstance, extras, false, 8, null);
        JSONArray actionsFromBundle = UtilsKt.getActionsFromBundle(extras);
        if (actionsFromBundle.length() == 0) {
            return;
        }
        ActionParser actionParser = new ActionParser();
        JSONObject jSONObject = actionsFromBundle.getJSONObject(0);
        r.j(jSONObject, "getJSONObject(...)");
        DismissAction dismissActionFromJson = actionParser.dismissActionFromJson(jSONObject);
        Context applicationContext2 = getApplicationContext();
        r.j(applicationContext2, "getApplicationContext(...)");
        UtilsKt.removeNotificationFromDrawer(applicationContext2, PushConstantsInternal.DEFAULT_NOTIFICATION_ID, dismissActionFromJson.getNotificationTag());
        Context applicationContext3 = getApplicationContext();
        r.j(applicationContext3, "getApplicationContext(...)");
        StatsTrackerKt.logNotificationDismissed(applicationContext3, sdkInstance, extras);
        RichNotificationManager richNotificationManager = RichNotificationManager.INSTANCE;
        Context applicationContext4 = getApplicationContext();
        r.j(applicationContext4, "getApplicationContext(...)");
        richNotificationManager.onNotificationDismissed$pushbase_defaultRelease(applicationContext4, extras, sdkInstance);
        extras.putString("action_type", MoEPushConstants.NOTIFICATION_CLEARED_USING_DISMISS_CTA_CLICK);
        NotificationHandler notificationHandlerForInstance = PushBaseInstanceProvider.INSTANCE.getNotificationHandlerForInstance(sdkInstance);
        Context applicationContext5 = getApplicationContext();
        r.j(applicationContext5, "getApplicationContext(...)");
        notificationHandlerForInstance.notifyNotificationCleared(applicationContext5, extras);
    }

    private final void handleNotificationCleared(Bundle extras, SdkInstance sdkInstance) {
        Logger.log$default(sdkInstance.logger, 0, null, null, new MoEPushWorker$handleNotificationCleared$1(this), 7, null);
        Context applicationContext = getApplicationContext();
        r.j(applicationContext, "getApplicationContext(...)");
        UtilsKt.deleteCachedImagesAsync$default(applicationContext, sdkInstance, extras, false, 8, null);
        extras.putString("action_type", MoEPushConstants.NOTIFICATION_CLEARED_USING_SYSTEM_SWIPE);
        NotificationHandler notificationHandlerForInstance = PushBaseInstanceProvider.INSTANCE.getNotificationHandlerForInstance(sdkInstance);
        Context applicationContext2 = getApplicationContext();
        r.j(applicationContext2, "getApplicationContext(...)");
        notificationHandlerForInstance.notifyNotificationCleared(applicationContext2, extras);
        RichNotificationManager richNotificationManager = RichNotificationManager.INSTANCE;
        Context applicationContext3 = getApplicationContext();
        r.j(applicationContext3, "getApplicationContext(...)");
        richNotificationManager.onNotificationDismissed$pushbase_defaultRelease(applicationContext3, extras, sdkInstance);
    }

    @Override
    @Deprecated(message = "Deprecated in Java")
    public void onHandleIntent(@Nullable Intent intent) {
        if (intent == null) {
            return;
        }
        try {
            Bundle extras = intent.getExtras();
            if (extras != null && !extras.isEmpty()) {
                IntentProcessorKt.notifyPreProcessListenerIfRequired(extras);
                SdkInstance sdkInstanceForPayload = PushHelper.INSTANCE.getInstance().getSdkInstanceForPayload(extras);
                if (sdkInstanceForPayload == null) {
                    return;
                }
                CoreUtils.logBundle(sdkInstanceForPayload.logger, this.tag, extras);
                String action = intent.getAction();
                if (action == null) {
                    return;
                }
                Logger.log$default(sdkInstanceForPayload.logger, 0, null, null, new MoEPushWorker$onHandleIntent$1(this, action), 7, null);
                if (action.equals(PushConstantsInternal.INTENT_ACTION_NOTIFICATION_CLEARED)) {
                    handleNotificationCleared(extras, sdkInstanceForPayload);
                } else if (action.equals(PushConstantsInternal.INTENT_ACTION_NOTIFICATION_CLOSE_CLICKED)) {
                    dismissNotification(extras, sdkInstanceForPayload);
                }
            }
        } catch (Exception e) {
            Logger.Companion.print$default(Logger.INSTANCE, 1, e, null, new MoEPushWorker$onHandleIntent$2(this), 4, null);
        }
    }
}