正在查看: i.BarIS v2024.401.30.180 应用的 MyFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: i.BarIS v2024.401.30.180 应用的 MyFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.gae.scaffolder.plugin;
import android.content.Context;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import sk.kaso.ibaris.FcmHandler;
import sk.kaso.ibaris.MainActivity;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FCMPlugin";
@Override
public void onNewToken(String str) {
super.onNewToken(str);
Log.d("FCMPlugin", "New token: " + str);
FCMPlugin.sendTokenRefresh(str);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("FCMPlugin", "==> MyFirebaseMessagingService onMessageReceived");
if (remoteMessage.getNotification() != null) {
Log.d("FCMPlugin", "\tNotification Title: " + remoteMessage.getNotification().getTitle());
Log.d("FCMPlugin", "\tNotification Message: " + remoteMessage.getNotification().getBody());
}
HashMap hashMap = new HashMap();
hashMap.put("wasTapped", false);
if (remoteMessage.getNotification() != null) {
hashMap.put("title", remoteMessage.getNotification().getTitle());
hashMap.put("body", remoteMessage.getNotification().getBody());
}
for (String str : remoteMessage.getData().keySet()) {
String str2 = remoteMessage.getData().get(str);
Log.d("FCMPlugin", "\tKey: " + str + " Value: " + ((Object) str2));
hashMap.put(str, str2);
}
Log.d("FCMPlugin", "\tNotification Data: " + hashMap.toString());
doFcmDataStuff(remoteMessage, hashMap, false, this);
}
public static void doFcmDataStuff(RemoteMessage remoteMessage, Map<String, Object> map, boolean z, Context context) {
try {
Type type = new TypeToken<HashMap<String, String>>() {
}.getType();
HashMap hashMap = new HashMap();
hashMap.putAll(remoteMessage.getData());
hashMap.putAll((Map) new Gson().fromJson((String) hashMap.get("BODY"), type));
if (remoteMessage.getNotification() != null) {
hashMap.put("title", remoteMessage.getNotification().getTitle());
hashMap.put("body", remoteMessage.getNotification().getBody());
}
if (((String) hashMap.get("ACTION")).equals("ACK") || ((String) hashMap.get("ACTION")).equals("MODIF_CHAT") || (((String) hashMap.get("ACTION")).equals("NEW_CHAT") && MainActivity.isInFg && !z)) {
throw new RuntimeException("continue to cordova");
}
FcmHandler.handle(hashMap, context.getApplicationContext());
} catch (Throwable th) {
Log.e("sendPushPayload", th.getMessage());
FCMPlugin.sendPushPayload(map);
}
}
}