正在查看: Pulsar v1.0.0 应用的 CustomeFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Pulsar v1.0.0 应用的 CustomeFirebaseMessagingService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xly.module.push;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.widget.RemoteViews;
import androidx.core.app.b2;
import androidx.core.app.c4;
import androidx.core.app.h0;
import androidx.core.app.i4;
import androidx.core.app.j4;
import androidx.core.app.r0;
import androidx.core.app.s0;
import androidx.core.graphics.drawable.IconCompat;
import com.facebook.react.bridge.ReadableMap;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.b1;
import com.google.firebase.messaging.f;
import com.xly.module.DistributeActivity;
import com.xly.module.jpush.e;
import com.xly.module.push.CustomeFirebaseMessagingService;
import io.invertase.firebase.common.g;
import io.invertase.firebase.messaging.r;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.i0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.i1;
import kotlin.jvm.internal.l0;
import kotlin.jvm.internal.p1;
import org.jetbrains.annotations.NotNull;
@p1({"SMAP\nCustomeFirebaseMessagingService.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CustomeFirebaseMessagingService.kt\ncom/xly/module/push/CustomeFirebaseMessagingService\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,321:1\n1#2:322\n*E\n"})
@Metadata(d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\n\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b.\u0010/J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J8\u0010\u0010\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\b2\u0006\u0010\r\u001a\u00020\b2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002JN\u0010\u001b\u001a\u00020\u00062\u0006\u0010\u0011\u001a\u00020\b2\u0006\u0010\u0013\u001a\u00020\u00122\b\u0010\u0015\u001a\u0004\u0018\u00010\u00142\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0018\u001a\u00020\b2\u0012\u0010\u001a\u001a\u000e\u0012\u0004\u0012\u00020\u0016\u0012\u0004\u0012\u00020\u00060\u0019H\u0002J\u0018\u0010 \u001a\u00020\u001c2\u0006\u0010\u001d\u001a\u00020\u001c2\u0006\u0010\u001f\u001a\u00020\u001eH\u0002J\b\u0010\"\u001a\u00020!H\u0002J\b\u0010#\u001a\u00020\bH\u0002J\u001c\u0010(\u001a\u00020\u00062\u0006\u0010$\u001a\u00020\b2\n\u0010'\u001a\u00060%j\u0002`&H\u0016J\b\u0010)\u001a\u00020\u0006H\u0016J\u0010\u0010*\u001a\u00020\u00062\u0006\u0010$\u001a\u00020\bH\u0016J\u0010\u0010,\u001a\u00020\u00062\u0006\u0010+\u001a\u00020\bH\u0016J\u0010\u0010-\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0004H\u0016¨\u00060"}, d2 = {"Lcom/xly/module/push/CustomeFirebaseMessagingService;", "Lcom/google/firebase/messaging/FirebaseMessagingService;", "Lio/invertase/firebase/common/b;", "event", "Lcom/google/firebase/messaging/b1;", "remoteMessage", "", "s", "", v6.a.c, "messageContent", "appSmallIconUri", "appLargeIconUri", "appBigPicPath", "Lw6/b;", "testFcmMessage", "t", "imageUrl", "", "isLargePic", "Landroid/widget/RemoteViews;", "remoteViews", "Landroidx/core/app/b2$g;", "builder", v6.a.d, "Lkotlin/Function1;", "callback", "p", "Landroid/graphics/Bitmap;", "bitmap", "", "cornerRadius", "r", "", "n", "o", "messageId", "Ljava/lang/Exception;", "Lkotlin/Exception;", "sendError", "onSendError", "onDeletedMessages", "onMessageSent", v6.a.l, "onNewToken", "onMessageReceived", "<init>", "()V", "jpush_release"}, k = 1, mv = {1, 9, 0})
public final class CustomeFirebaseMessagingService extends FirebaseMessagingService {
static final class a extends l0 implements Function1<b2.g, Unit> {
final String b;
final RemoteViews c;
final String d;
final String e;
final String f;
static final class C0122a extends l0 implements Function1<b2.g, Unit> {
final CustomeFirebaseMessagingService a;
final String b;
final RemoteViews c;
final String d;
final String e;
static final class C0123a extends l0 implements Function1<b2.g, Unit> {
final CustomeFirebaseMessagingService a;
final b2.g b;
C0123a(CustomeFirebaseMessagingService customeFirebaseMessagingService, b2.g gVar) {
super(1);
this.a = customeFirebaseMessagingService;
this.b = gVar;
}
public static final void b(CustomeFirebaseMessagingService this$0, b2.g builder) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(builder, "$builder");
if (this$0.n()) {
j4.from(this$0).notify((int) System.currentTimeMillis(), builder.build());
}
}
@Override
public Unit invoke(b2.g gVar) {
invoke2(gVar);
return Unit.a;
}
public final void invoke2(@NotNull b2.g it) {
Intrinsics.checkNotNullParameter(it, "it");
final CustomeFirebaseMessagingService customeFirebaseMessagingService = this.a;
final b2.g gVar = this.b;
com.xly.module.push.utils.a.runByMainThread(new Runnable() {
@Override
public final void run() {
CustomeFirebaseMessagingService.a.C0122a.C0123a.b(CustomeFirebaseMessagingService.this, gVar);
}
});
}
}
C0122a(CustomeFirebaseMessagingService customeFirebaseMessagingService, String str, RemoteViews remoteViews, String str2, String str3) {
super(1);
this.a = customeFirebaseMessagingService;
this.b = str;
this.c = remoteViews;
this.d = str2;
this.e = str3;
}
@Override
public Unit invoke(b2.g gVar) {
invoke2(gVar);
return Unit.a;
}
public final void invoke2(@NotNull b2.g builder) {
Intrinsics.checkNotNullParameter(builder, "builder");
CustomeFirebaseMessagingService customeFirebaseMessagingService = this.a;
customeFirebaseMessagingService.p(this.b, 2, this.c, builder, this.d, this.e, new C0123a(customeFirebaseMessagingService, builder));
}
}
a(String str, RemoteViews remoteViews, String str2, String str3, String str4) {
super(1);
this.b = str;
this.c = remoteViews;
this.d = str2;
this.e = str3;
this.f = str4;
}
@Override
public Unit invoke(b2.g gVar) {
invoke2(gVar);
return Unit.a;
}
public final void invoke2(@NotNull b2.g builder) {
Intrinsics.checkNotNullParameter(builder, "builder");
CustomeFirebaseMessagingService customeFirebaseMessagingService = CustomeFirebaseMessagingService.this;
String str = this.b;
RemoteViews remoteViews = this.c;
String str2 = this.d;
String str3 = this.e;
customeFirebaseMessagingService.p(str, 1, remoteViews, builder, str2, str3, new C0122a(customeFirebaseMessagingService, this.f, remoteViews, str2, str3));
}
}
public final boolean n() {
if (Build.VERSION.SDK_INT < 33) {
return true;
}
Object systemService = getSystemService("notification");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
boolean a2 = i4.a((NotificationManager) systemService);
if (a2) {
return true;
}
if (a2) {
throw new i0();
}
return false;
}
private final String o() {
if (Build.VERSION.SDK_INT >= 26) {
s0.a();
NotificationChannel a2 = r0.a("FCM_PUSH_CHANNEL_ID", "FCM Push Message", 3);
h0.a(a2, "Push Message");
Object systemService = getSystemService("notification");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
c4.a((NotificationManager) systemService, a2);
}
return "FCM_PUSH_CHANNEL_ID";
}
public final void p(final String imageUrl, final int isLargePic, final RemoteViews remoteViews, final b2.g builder, final String title, final String content, final Function1<? super b2.g, Unit> callback) {
final i1.h hVar = new i1.h();
if (TextUtils.isEmpty(imageUrl)) {
callback.invoke(builder);
} else {
com.xly.module.push.utils.a.runByIOThread(new Runnable() {
@Override
public final void run() {
CustomeFirebaseMessagingService.q(imageUrl, hVar, callback, builder, isLargePic, remoteViews, this, title, content);
}
});
}
}
public static final void q(String imageUrl, i1.h bitmap, Function1 callback, b2.g builder, int i, RemoteViews remoteViews, CustomeFirebaseMessagingService this$0, String title, String content) {
b2.g style;
Intrinsics.checkNotNullParameter(imageUrl, "$imageUrl");
Intrinsics.checkNotNullParameter(bitmap, "$bitmap");
Intrinsics.checkNotNullParameter(callback, "$callback");
Intrinsics.checkNotNullParameter(builder, "$builder");
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(title, "$title");
Intrinsics.checkNotNullParameter(content, "$content");
try {
URLConnection openConnection = new URL(imageUrl).openConnection();
openConnection.setDoInput(true);
openConnection.connect();
InputStream inputStream = openConnection.getInputStream();
bitmap.a = BitmapFactory.decodeStream(inputStream);
inputStream.close();
T t = bitmap.a;
if (((Bitmap) t) != null) {
if (i == 0) {
if (remoteViews != null) {
int i2 = e.a.b;
Intrinsics.checkNotNull(t);
remoteViews.setImageViewBitmap(i2, this$0.r((Bitmap) t, 20.0f));
}
style = builder.setStyle(new b2.d().bigPicture((Bitmap) bitmap.a).setBigContentTitle(title).setSummaryText(content));
} else if (i == 1) {
if (remoteViews != null) {
int i3 = e.a.c;
Intrinsics.checkNotNull(t);
remoteViews.setImageViewBitmap(i3, this$0.r((Bitmap) t, 20.0f));
}
style = builder.setLargeIcon((Bitmap) bitmap.a);
} else if (i == 2) {
Intrinsics.checkNotNull(t);
style = builder.setSmallIcon(IconCompat.createWithBitmap((Bitmap) t));
}
Intrinsics.checkNotNull(style);
}
callback.invoke(builder);
} catch (Exception e) {
callback.invoke(builder);
e.printStackTrace();
}
}
private final Bitmap r(Bitmap bitmap, float cornerRadius) {
Bitmap createBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
Intrinsics.checkNotNullExpressionValue(createBitmap, "createBitmap(...)");
Canvas canvas = new Canvas(createBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(-16777216);
Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
canvas.drawRoundRect(new RectF(rect), cornerRadius, cornerRadius, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return createBitmap;
}
private final void s(io.invertase.firebase.common.b event, b1 remoteMessage) {
String str;
String str2;
String string;
String string2;
String string3;
ReadableMap map = event.getEventBody().getMap("data");
if (map == null || (str = map.getString(v6.a.c)) == null) {
str = "Title";
}
if (map == null || (str2 = map.getString(v6.a.d)) == null) {
str2 = "Message Content";
}
String str3 = str2;
String str4 = (map == null || (string3 = map.getString("appBigPicPath")) == null) ? "" : string3;
String str5 = (map == null || (string2 = map.getString("appLargeIconUri")) == null) ? "" : string2;
String str6 = (map == null || (string = map.getString("appSmallIconUri")) == null) ? "" : string;
if (map != null) {
t(str, str3, str6, str5, str4, new w6.b(Long.valueOf(remoteMessage.getSentTime()), new w6.a(map.getString("open_type"), str3, map.getString("msgId"), str, map.getString("extend"), map.getString("channelCode"), map.getString("url_cmd"), map.getString("dbPrimaryId"), map.getString("id"), map.getString("msgType"), str6, map.getString("push_time"), str5, str4), remoteMessage.getMessageId(), Integer.valueOf(remoteMessage.getTtl()), remoteMessage.getFrom()));
}
}
private final void t(String title, String messageContent, String appSmallIconUri, String appLargeIconUri, String appBigPicPath, w6.b testFcmMessage) {
String o = o();
Intent intent = new Intent(this, (Class<?>) DistributeActivity.class);
intent.putExtra(FCMBroadcastReceiver.b, testFcmMessage);
intent.addFlags(268435456);
PendingIntent activity = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 67108864);
RemoteViews remoteViews = new RemoteViews(getPackageName(), e.b.a);
remoteViews.setTextViewText(e.a.d, TextUtils.isEmpty(title) ? "" : title);
remoteViews.setTextViewText(e.a.a, TextUtils.isEmpty(messageContent) ? "" : messageContent);
b2.g priority = new b2.g(this, o).setSmallIcon(MTPushPackage.getIconId()).setContentTitle(title).setContentText(messageContent).setAutoCancel(true).setContentIntent(activity).setPriority(0);
Intrinsics.checkNotNullExpressionValue(priority, "setPriority(...)");
int i = Build.VERSION.SDK_INT;
if (i != 31) {
if (i > 31) {
priority.setCustomContentView(remoteViews);
}
p(appBigPicPath, 0, remoteViews, priority, title, messageContent, new a(appLargeIconUri, remoteViews, title, messageContent, appSmallIconUri));
}
priority.setCustomBigContentView(remoteViews);
p(appBigPicPath, 0, remoteViews, priority, title, messageContent, new a(appLargeIconUri, remoteViews, title, messageContent, appSmallIconUri));
}
@Override
public void onDeletedMessages() {
Log.e("FCM TAG", "onDeletedMessages");
g sharedInstance = g.getSharedInstance();
Intrinsics.checkNotNullExpressionValue(sharedInstance, "getSharedInstance(...)");
sharedInstance.sendEvent(r.messagesDeletedToEvent());
}
@Override
public void onMessageReceived(@NotNull b1 remoteMessage) {
Intrinsics.checkNotNullParameter(remoteMessage, "remoteMessage");
Log.e("FCM TAG", "onMessageReceived");
io.invertase.firebase.common.b remoteMessageToEvent = r.remoteMessageToEvent(remoteMessage, Boolean.TRUE);
Intrinsics.checkNotNullExpressionValue(remoteMessageToEvent, "remoteMessageToEvent(...)");
ReadableMap map = remoteMessageToEvent.getEventBody().getMap("data");
if (Intrinsics.areEqual(map != null ? map.getString("channelCode") : null, f.C0073f.a)) {
s(remoteMessageToEvent, remoteMessage);
}
}
@Override
public void onMessageSent(@NotNull String messageId) {
Intrinsics.checkNotNullParameter(messageId, "messageId");
Log.e("FCM TAG", "onMessageSent");
g sharedInstance = g.getSharedInstance();
Intrinsics.checkNotNullExpressionValue(sharedInstance, "getSharedInstance(...)");
sharedInstance.sendEvent(r.messageSentToEvent(messageId));
}
@Override
public void onNewToken(@NotNull String token) {
Intrinsics.checkNotNullParameter(token, "token");
Log.d("FCM TAG", "onNewToken " + token);
u6.c.getInstance(MTPushModule.reactContext).setFcmToken(token);
if (c.a) {
Log.d("FCM TAG", "push long connected, direct set token");
d2.d.uploadPlatformToken(MTPushModule.reactContext, (byte) 8, token, "US");
} else {
Log.d("FCM TAG", "push long not connected, cache token");
c.b = token;
}
g sharedInstance = g.getSharedInstance();
Intrinsics.checkNotNullExpressionValue(sharedInstance, "getSharedInstance(...)");
sharedInstance.sendEvent(r.newTokenToTokenEvent(token));
}
@Override
public void onSendError(@NotNull String messageId, @NotNull Exception sendError) {
Intrinsics.checkNotNullParameter(messageId, "messageId");
Intrinsics.checkNotNullParameter(sendError, "sendError");
Log.e("FCM TAG", "onSendError");
g sharedInstance = g.getSharedInstance();
Intrinsics.checkNotNullExpressionValue(sharedInstance, "getSharedInstance(...)");
sharedInstance.sendEvent(r.messageSendErrorToEvent(messageId, sendError));
}
}