导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - MoEPushWorker.java 源代码

正在查看: bbinstant v6.24.0 应用的 MoEPushWorker.java JAVA 源代码文件

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


package com.moengage.pushbase.internal;

import android.app.IntentService;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Keep;
import com.moengage.core.internal.model.a0;
import com.moengage.pushbase.internal.repository.ActionParser;
import com.moengage.pushbase.push.PushMessageListener;
import kotlin.jvm.internal.v;
import kotlin.jvm.internal.w;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

@Keep
public final class MoEPushWorker extends IntentService {
    private final String tag;

    static final class a extends w implements kotlin.jvm.functions.a {
        a() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(MoEPushWorker.this.tag, " dismissNotification() : ");
        }
    }

    static final class b extends w implements kotlin.jvm.functions.a {
        b() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(MoEPushWorker.this.tag, " handleNotificationCleared() : ");
        }
    }

    static final class c extends w implements kotlin.jvm.functions.a {
        final String $intentAction;

        c(String str) {
            super(0);
            this.$intentAction = str;
        }

        public final String invoke() {
            return MoEPushWorker.this.tag + " onHandleIntent() : Action: " + this.$intentAction;
        }
    }

    static final class d extends w implements kotlin.jvm.functions.a {
        d() {
            super(0);
        }

        public final String invoke() {
            return v.stringPlus(MoEPushWorker.this.tag, " onHandleIntent() : ");
        }
    }

    public MoEPushWorker() {
        super("RegistrationIntentService");
        this.tag = "PushBase_6.8.1_MoEPushWorker";
    }

    private final void dismissNotification(Bundle bundle, a0 a0Var) throws JSONException {
        com.moengage.core.internal.logger.f.log$default(a0Var.logger, 0, null, new a(), 3, null);
        Context applicationContext = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext, "applicationContext");
        p.deleteCachedImagesAsync(applicationContext, a0Var, bundle);
        JSONArray actionsFromBundle = p.getActionsFromBundle(bundle);
        if (actionsFromBundle.length() == 0) {
            return;
        }
        ActionParser actionParser = new ActionParser();
        JSONObject jSONObject = actionsFromBundle.getJSONObject(0);
        v.checkNotNullExpressionValue(jSONObject, "actions.getJSONObject(0)");
        com.moengage.pushbase.model.action.f dismissActionFromJson = actionParser.dismissActionFromJson(jSONObject);
        if (dismissActionFromJson.getNotificationId() == -1) {
            return;
        }
        Object systemService = getSystemService("notification");
        if (systemService == null) {
            throw new NullPointerException("null cannot be cast to non-null type android.app.NotificationManager");
        }
        ((NotificationManager) systemService).cancel(dismissActionFromJson.getNotificationId());
        Context applicationContext2 = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext2, "applicationContext");
        m.logNotificationDismissed(applicationContext2, a0Var, bundle);
        com.moengage.pushbase.internal.richnotification.b bVar = com.moengage.pushbase.internal.richnotification.b.INSTANCE;
        Context applicationContext3 = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext3, "applicationContext");
        bVar.onNotificationDismissed$pushbase_release(applicationContext3, bundle, a0Var);
        bundle.putString("action_type", "dismiss_button");
        PushMessageListener messageListenerForInstance$pushbase_release = com.moengage.pushbase.b.Companion.getInstance().getMessageListenerForInstance$pushbase_release(a0Var);
        Context applicationContext4 = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext4, "applicationContext");
        messageListenerForInstance$pushbase_release.onNotificationCleared(applicationContext4, bundle);
    }

    private final void handleNotificationCleared(Bundle bundle, a0 a0Var) {
        com.moengage.core.internal.logger.f.log$default(a0Var.logger, 0, null, new b(), 3, null);
        Context applicationContext = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext, "applicationContext");
        p.deleteCachedImagesAsync(applicationContext, a0Var, bundle);
        bundle.putString("action_type", "swipe");
        PushMessageListener messageListenerForInstance$pushbase_release = com.moengage.pushbase.b.Companion.getInstance().getMessageListenerForInstance$pushbase_release(a0Var);
        Context applicationContext2 = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext2, "applicationContext");
        messageListenerForInstance$pushbase_release.onNotificationCleared(applicationContext2, bundle);
        com.moengage.pushbase.internal.richnotification.b bVar = com.moengage.pushbase.internal.richnotification.b.INSTANCE;
        Context applicationContext3 = getApplicationContext();
        v.checkNotNullExpressionValue(applicationContext3, "applicationContext");
        bVar.onNotificationDismissed$pushbase_release(applicationContext3, bundle, a0Var);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if (intent == null) {
            return;
        }
        try {
            Bundle extras = intent.getExtras();
            if (extras == null || extras.isEmpty()) {
                return;
            }
            com.moengage.core.internal.global.d.notifyPreProcessListenerIfRequired(extras);
            a0 sdkInstanceForPayload = PushHelper.Companion.getInstance().getSdkInstanceForPayload(extras);
            if (sdkInstanceForPayload == null) {
                return;
            }
            com.moengage.core.internal.utils.d.logBundle(sdkInstanceForPayload.logger, this.tag, extras);
            String action = intent.getAction();
            if (action == null) {
                return;
            }
            com.moengage.core.internal.logger.f.log$default(sdkInstanceForPayload.logger, 0, null, new c(action), 3, null);
            if (v.areEqual(action, "ACTION_NOTIFICATION_CLEARED")) {
                handleNotificationCleared(extras, sdkInstanceForPayload);
            } else if (v.areEqual(action, "ACTION_NOTIFICATION_CLOSE_CLICK")) {
                dismissNotification(extras, sdkInstanceForPayload);
            }
        } catch (Exception e2) {
            com.moengage.core.internal.logger.f.Companion.print(1, e2, new d());
        }
    }
}