导航菜单

页面标题

页面副标题

TezFinance v1.1.1 - CloudMsgService.java 源代码

正在查看: TezFinance v1.1.1 应用的 CloudMsgService.java JAVA 源代码文件

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


package com.finance.tez.firebase;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.Util;
import com.finance.tez.R;
import com.finance.tez.net.ServerClient;
import com.finance.tez.pages.FirstActivity;
import com.finance.tez.tools.BridgeNames;
import com.finance.tez.tools.IKeys;
import com.finance.tez.tools.PeterLog;
import com.finance.tez.tools.SpTool;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.concurrent.ThreadsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\"\u0010\u0003\u001a\u00020\u00042\u0018\u0010\u0005\u001a\u0014\u0012\u0006\u0012\u0004\u0018\u00010\u0007\u0012\u0006\u0012\u0004\u0018\u00010\u0007\u0018\u00010\u0006H\u0002J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH\u0016J\u0010\u0010\f\u001a\u00020\t2\u0006\u0010\r\u001a\u00020\u0007H\u0016J\u0010\u0010\u000e\u001a\u00020\t2\u0006\u0010\u000f\u001a\u00020\u0007H\u0002¨\u0006\u0010"}, d2 = {"Lcom/finance/tez/firebase/CloudMsgService;", "Lcom/google/firebase/messaging/FirebaseMessagingService;", "()V", "isAdjustUninstallDetectionPayload", "", "payload", "", "", "onMessageReceived", "", "remoteMessage", "Lcom/google/firebase/messaging/RemoteMessage;", BridgeNames.onNewToken, "token", "uploadFcmToken", IKeys.fcmToken, "TezFinance_111_2025_06_03_10_18_04_ProdRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class CloudMsgService extends FirebaseMessagingService {
    public void onNewToken(String token) {
        Intrinsics.checkNotNullParameter(token, "token");
        super.onNewToken(token);
        if (TextUtils.isEmpty(token)) {
            return;
        }
        SpTool.INSTANCE.saveFcmToken(token);
        uploadFcmToken(token);
        Adjust.setPushToken(token, (Context) this);
    }

    private final void uploadFcmToken(final String fcmToken) {
        if (SpTool.isLogin()) {
            ThreadsKt.thread$default(false, false, (ClassLoader) null, (String) null, 0, new Function0<Unit>() {
                {
                    super(0);
                }

                public Object invoke() {
                    m112invoke();
                    return Unit.INSTANCE;
                }

                public final void m112invoke() {
                    try {
                        ServerClient.INSTANCE.getApiServer().saveFireBaseToken(fcmToken).execute();
                    } catch (Exception e) {
                        PeterLog.e$default("uploadFcmToken error -> " + e.getMessage(), null, 2, null);
                    }
                }
            }, 31, (Object) null);
        }
    }

    public void onMessageReceived(RemoteMessage remoteMessage) {
        RemoteMessage.Notification notification;
        Intrinsics.checkNotNullParameter(remoteMessage, "remoteMessage");
        super.onMessageReceived(remoteMessage);
        Map data = remoteMessage.getData();
        Intrinsics.checkNotNullExpressionValue(data, "getData(...)");
        if (isAdjustUninstallDetectionPayload(data) || (notification = remoteMessage.getNotification()) == null) {
            return;
        }
        String body = notification.getBody();
        String title = notification.getTitle();
        String str = body;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Object systemService = getSystemService("notification");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        String string = getString(R.string.app_name);
        Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
        if (Build.VERSION.SDK_INT >= 26) {
            String string2 = getString(R.string.app_name);
            Intrinsics.checkNotNullExpressionValue(string2, "getString(...)");
            String string3 = getString(R.string.s_notification, new Object[]{string2});
            Intrinsics.checkNotNullExpressionValue(string3, "getString(...)");
            NotificationChannel notificationChannel = new NotificationChannel(string, string2, 4);
            notificationChannel.setDescription(string3);
            notificationChannel.enableLights(true);
            notificationChannel.setLightColor(-65536);
            notificationChannel.enableVibration(true);
            notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
            notificationManager.createNotificationChannel(notificationChannel);
        }
        NotificationCompat.Style bigTextStyle = new NotificationCompat.BigTextStyle();
        String str2 = title;
        bigTextStyle.setBigContentTitle(str2);
        bigTextStyle.bigText(str);
        Context context = (Context) this;
        NotificationCompat.Builder autoCancel = new NotificationCompat.Builder(context, string).setContentTitle(str2).setContentText(str).setPriority(1).setStyle(bigTextStyle).setAutoCancel(true);
        Intrinsics.checkNotNullExpressionValue(autoCancel, "setAutoCancel(...)");
        if (Build.VERSION.SDK_INT >= 26) {
            autoCancel.setSmallIcon(R.drawable.ic_notification);
        } else {
            autoCancel.setSmallIcon(R.drawable.ic_notification).setColor(Color.parseColor("#FFFFFF"));
        }
        Intent intent = new Intent(context, (Class<?>) FirstActivity.class);
        intent.addFlags(268468224);
        PendingIntent.getActivity(context, 0, intent, 201326592);
        int id = NotificationId.INSTANCE.getId();
        PeterLog.d$default("notify id -> " + id, null, 2, null);
        notificationManager.notify(id, autoCancel.build());
    }

    private final boolean isAdjustUninstallDetectionPayload(Map<String, String> payload) {
        return Util.isAdjustUninstallDetectionPayload(payload);
    }
}