正在查看: Préstamo Rápido v2.5.7 应用的 SnUniFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Préstamo Rápido v2.5.7 应用的 SnUniFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.itfenbao.snplugin.firebase.cm;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import com.alibaba.fastjson.JSON;
import com.appsflyer.AFKeystoreWrapper$;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.WXSDKManager;
import io.dcloud.PandoraEntryActivity;
import io.dcloud.WebAppActivity;
import io.dcloud.p.x1$$ExternalSyntheticApiModelOutline0;
import java.util.HashMap;
import java.util.Map;
public class SnUniFirebaseMessagingService extends FirebaseMessagingService {
public static final String NOTIFICATION_CHANNEL_KEY = "com.google.firebase.messaging.default_notification_channel_id";
public static final String NOTIFICATION_COLOR_KEY = "com.google.firebase.messaging.default_notification_color";
public static final String NOTIFICATION_ICON_KEY = "com.google.firebase.messaging.default_notification_icon";
private static final String TAG = "SnUniFCM";
private String defaultNotificationChannel;
private int defaultNotificationColor;
private int defaultNotificationIcon;
private Handler mHandler = new Handler(Looper.getMainLooper());
private NotificationManager notificationManager;
@Override
public void onCreate() {
this.notificationManager = (NotificationManager) ContextCompat.getSystemService(this, NotificationManager.class);
try {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getApplicationContext().getPackageName(), 128);
this.defaultNotificationIcon = applicationInfo.metaData.getInt("com.google.firebase.messaging.default_notification_icon", applicationInfo.icon);
this.defaultNotificationChannel = applicationInfo.metaData.getString("com.google.firebase.messaging.default_notification_channel_id", "default");
int i = applicationInfo.metaData.getInt("com.google.firebase.messaging.default_notification_color");
if (i != 0) {
this.defaultNotificationColor = ContextCompat.getColor(this, i);
}
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Failed to load meta-data", e);
} catch (Resources.NotFoundException e2) {
Log.e(TAG, "Failed to load notification color", e2);
}
if (Build.VERSION.SDK_INT < 26 || AFKeystoreWrapper$.ExternalSyntheticApiModelOutline0.m(this.notificationManager, this.defaultNotificationChannel) != null) {
return;
}
NotificationManager notificationManager = this.notificationManager;
x1$$ExternalSyntheticApiModelOutline0.m96m();
AFKeystoreWrapper$.ExternalSyntheticApiModelOutline0.m(notificationManager, AFKeystoreWrapper$.ExternalSyntheticApiModelOutline0.m(this.defaultNotificationChannel, "Firebase", 4));
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
if (remoteMessage.getData().size() > 0) {
m41x7873f669("fcmMessageReceivedData", remoteMessage.getData());
}
if (remoteMessage.getNotification() != null) {
sendNotification(remoteMessage.getNotification(), remoteMessage.getData());
m41x7873f669("fcmMessageReceivedNotification", JSON.parseObject(JSON.toJSONString(remoteMessage.getNotification())));
}
}
@Override
public void onDeletedMessages() {
m41x7873f669("fcmDeletedMessages", null);
}
@Override
public void onNewToken(String str) {
Log.d(TAG, "onNewToken-" + str);
HashMap hashMap = new HashMap();
hashMap.put("token", str);
m41x7873f669("fcmNewToken", hashMap);
}
private void sendNotification(RemoteMessage.Notification notification, Map<String, String> map) {
Intent intent = new Intent(this, (Class<?>) PandoraEntryActivity.class);
intent.addFlags(67108864);
if (map != null) {
Bundle bundle = new Bundle();
for (Map.Entry<String, String> entry : map.entrySet()) {
bundle.putString(entry.getKey(), entry.getValue());
}
intent.putExtras(bundle);
}
PendingIntent activity = PendingIntent.getActivity(this, 0, intent, Build.VERSION.SDK_INT < 31 ? 1073741824 : 67108864);
String string = getString(R.string.default_notification_channel_id);
NotificationCompat.Builder contentIntent = new NotificationCompat.Builder(this, string).setSmallIcon(this.defaultNotificationIcon).setColor(this.defaultNotificationColor).setContentTitle(getString(R.string.fcm_message)).setContentText(notification.getBody()).setAutoCancel(true).setSound(getNotificationSound(notification.getSound())).setContentIntent(activity);
if (Build.VERSION.SDK_INT >= 26) {
AFKeystoreWrapper$.ExternalSyntheticApiModelOutline0.m(this.notificationManager, AFKeystoreWrapper$.ExternalSyntheticApiModelOutline0.m(string, "Channel human readable title", 3));
}
this.notificationManager.notify(0, contentIntent.build());
}
private String getNotificationChannel(RemoteMessage.Notification notification) {
String channelId = notification.getChannelId();
return channelId == null ? this.defaultNotificationChannel : channelId;
}
private Uri getNotificationSound(String str) {
if (str == null || str.isEmpty()) {
return null;
}
if (str.equals("default")) {
return RingtoneManager.getDefaultUri(2);
}
return Uri.parse("android.resource://" + getApplicationContext().getPackageName() + "/raw/" + str);
}
public void m41x7873f669(final String str, final Map map) {
Map<String, WXSDKInstance> allInstanceMap = WXSDKManager.getInstance().getAllInstanceMap();
if (allInstanceMap != null && allInstanceMap.values().size() > 0) {
WXSDKInstance wXSDKInstance = (WXSDKInstance) allInstanceMap.values().toArray()[0];
if (wXSDKInstance != null) {
wXSDKInstance.fireGlobalEventCallback(str, map);
return;
}
return;
}
this.mHandler.postDelayed(new Runnable() {
@Override
public final void run() {
SnUniFirebaseMessagingService.this.m41x7873f669(str, map);
}
}, WebAppActivity.SPLASH_SECOND);
}
}