导航菜单

页面标题

页面副标题

Easycash v3.75.13 - MessageReceiverService.java 源代码

正在查看: Easycash v3.75.13 应用的 MessageReceiverService.java JAVA 源代码文件

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


package com.lingyue.easycash.services;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import com.appsflyer.AppsFlyerLib;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.lingyue.easycash.R;
import com.lingyue.easycash.activity.launch.EasyCashLaunchActivity;
import com.lingyue.easycash.models.IPushExcludeDisplay;
import com.lingyue.easycash.models.InnerPushData;
import com.lingyue.easycash.models.PushType;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.InternalPushUtil;
import com.lingyue.idnbaselib.utils.DevUtil;
import com.lingyue.idnbaselib.utils.JsonParamsBuilder;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.supertoolkit.resourcetools.SharedPreferenceUtils;
import com.sensorsdata.analytics.android.sdk.aop.push.PushAutoTrackHelper;
import com.veda.android.bananalibrary.common.BananaBaseApplication;
import com.veda.android.bananalibrary.infrastructure.Logger;
import dagger.android.AndroidInjection;
import java.util.Map;
import javax.inject.Inject;

public class MessageReceiverService extends FirebaseMessagingService {

    @Inject
    FireBaseIDTokenManager a;

    private void c(String str, Map<String, String> map) {
        String str2 = map.get("nativeTitle");
        String str3 = map.get("nativeContent");
        String str4 = map.get("nativeRedirectUrl");
        Logger.c().b("MessageReceiverService ipush is :" + str2);
        ThirdPartEventUtils.D(BananaBaseApplication.getContext(), EasycashUmengEvent.S3, new JsonParamsBuilder().d("pushId").a(str).c());
        InnerPushData innerPushData = new InnerPushData();
        innerPushData.title = str2;
        innerPushData.content = str3;
        innerPushData.pushId = str;
        innerPushData.redirectUrl = str4;
        innerPushData.pushType = PushType.INTERNAL_PUSH;
        innerPushData.imageUrl = map.get("imageUrl");
        innerPushData.buttonText = map.get("buttonText");
        innerPushData.rowData = map.get("rowData");
        String str5 = map.get("expireTimestamp");
        if (!TextUtils.isEmpty(str5)) {
            innerPushData.expireTimestamp = Long.parseLong(str5);
        }
        innerPushData.needApiConfirm = Boolean.parseBoolean(map.get("needApiConfirm"));
        innerPushData.excludeDisplay = IPushExcludeDisplay.fromName(map.get("excludeDisplay"));
        InternalPushUtil.g().k(innerPushData);
    }

    private void d(String str, String str2, String str3, String str4, Context context) {
        if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3)) {
            return;
        }
        if (TextUtils.isEmpty(str)) {
            str = context.getResources().getString(2131886116);
        }
        if (TextUtils.isEmpty(str2)) {
            str2 = context.getResources().getString(R.string.new_message);
        }
        int b = NotificationIdManager.b(context);
        Notification f = f(context, str, str2, e(context, b, str3, str4));
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager == null || f == null) {
            NotificationIdManager.a(context, Integer.valueOf(b));
            return;
        }
        ThirdPartEventUtils.z(this, EasycashUmengEvent.v, new JsonParamsBuilder().d("pushId").a(str4).c());
        notificationManager.notify(b, f);
        PushAutoTrackHelper.onNotify(notificationManager, b, f);
    }

    private PendingIntent e(Context context, int i, @NonNull String str, @NonNull String str2) {
        Intent intent = new Intent(context, (Class<?>) EasyCashLaunchActivity.class);
        intent.putExtra("redirectUrl", str);
        intent.putExtra("push_notification_id", i);
        intent.putExtra("pushId", str2);
        int i2 = Build.VERSION.SDK_INT >= 23 ? 201326592 : 134217728;
        try {
            PushAutoTrackHelper.hookIntentGetActivity(context, i, intent, i2);
            PendingIntent activity = PendingIntent.getActivity(context, i, intent, i2);
            PushAutoTrackHelper.hookPendingIntentGetActivity(activity, context, i, intent, i2);
            return activity;
        } catch (IllegalArgumentException e) {
            DevUtil.a(e);
            return null;
        }
    }

    private Notification f(Context context, String str, String str2, PendingIntent pendingIntent) {
        return new NotificationCompat.Builder(context, "primary_channel").setSmallIcon(R.mipmap.ic_launcher).setContentTitle(str).setContentText(str2).setGroup(context.getPackageName()).setAutoCancel(true).setContentIntent(pendingIntent).build();
    }

    public static String g(@NonNull Intent intent) {
        return intent.getStringExtra("pushId");
    }

    public static String h(@NonNull Intent intent) {
        return intent.getStringExtra("redirectUrl");
    }

    public static boolean i(@NonNull Intent intent) {
        Bundle extras = intent.getExtras();
        return extras != null && extras.containsKey("redirectUrl");
    }

    private void j(Context context, Map<String, String> map) {
        if (map == null || map.isEmpty() || context == null || map.containsKey("af-uinstall-tracking")) {
            return;
        }
        String str = map.get("title");
        String str2 = map.get("content");
        String str3 = map.get("redirectUrl");
        String str4 = map.get("pushId");
        if (PushType.fromName(map.get("pushType")) == PushType.ORIGINAL_PUSH) {
            d(str, str2, str3, str4, context);
        } else {
            c(str4, map);
        }
    }

    private void k(String str) {
        if (TextUtils.isEmpty(str) || str.equals(SharedPreferenceUtils.s(getApplicationContext(), "fireBaseCloudMessageToken", ""))) {
            return;
        }
        SharedPreferenceUtils.J(getApplicationContext(), "fireBaseCloudMessageToken", str);
        FireBaseIDTokenManager fireBaseIDTokenManager = this.a;
        if (fireBaseIDTokenManager != null) {
            fireBaseIDTokenManager.d(str);
        }
    }

    public void onCreate() {
        super/*android.app.Service*/.onCreate();
        AndroidInjection.d(this);
        ThirdPartEventUtils.v("ec_tech_app_push_server_start");
    }

    public void onDeletedMessages() {
        super.onDeletedMessages();
    }

    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
        Logger c = Logger.c();
        StringBuilder sb = new StringBuilder();
        sb.append("MessageReceiverService notifycation is null:");
        sb.append(remoteMessage.a() == null);
        c.b(sb.toString());
        j(this, remoteMessage.getData());
    }

    public void onMessageSent(String str) {
        super.onMessageSent(str);
    }

    public void onNewToken(String str) {
        super.onNewToken(str);
        AppsFlyerLib.getInstance().updateServerUninstallToken(getApplicationContext(), str);
        k(str);
    }

    public void onSendError(String str, Exception exc) {
        super.onSendError(str, exc);
    }
}