- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
91 lines
4.5 KiB
Java
91 lines
4.5 KiB
Java
package com.ea.nimble;
|
|
|
|
import android.app.Notification;
|
|
import android.app.NotificationManager;
|
|
import android.app.PendingIntent;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import androidx.core.app.NotificationCompat;
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
|
|
import com.ea.nimble.Log;
|
|
import java.util.HashMap;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class NimbleLocalNotificationReceiver extends BroadcastReceiver {
|
|
public static final String NIMBLE_LOCAL_NOTIFICATION_RECEIVED = "nimble.notification.localNotificationReceived";
|
|
private static final String NOTIFICATION_TRACKING2_LOG_EVENT = "nimble.notification.tracking2.logEvent";
|
|
|
|
@Override // android.content.BroadcastReceiver
|
|
public final void onReceive(Context context, Intent intent) {
|
|
handleNewLocalNotification(context, intent.getExtras());
|
|
}
|
|
|
|
public void handleNewLocalNotification(Context context, Bundle bundle) {
|
|
Intent intent;
|
|
Notification notification;
|
|
Object parcelable;
|
|
String string = bundle.getString(FCMMessageService.PushIntentExtraKeys.PUSH_ID, "");
|
|
String string2 = bundle.getString("deepLinkUrl");
|
|
if (string2 != null) {
|
|
intent = new Intent("android.intent.action.VIEW", Uri.parse(string2));
|
|
Log.Helper.LOGI(this, "[handleNewLocalNotification]: Local notification clicked with URL: " + string2, new Object[0]);
|
|
} else {
|
|
String pushTargetActivity = getPushTargetActivity(context);
|
|
Log.Helper.LOGD(this, "[handleNewLocalNotification]: Local notification received with target activity: " + pushTargetActivity, new Object[0]);
|
|
try {
|
|
intent = new Intent(context, Class.forName(pushTargetActivity));
|
|
} catch (ClassNotFoundException e) {
|
|
Log.Helper.LOGD(this, String.format("[handleNewLocalNotification]: Could not launch target activity: %s, exception: %s", pushTargetActivity, e.toString()), new Object[0]);
|
|
return;
|
|
}
|
|
}
|
|
intent.putExtras(bundle);
|
|
intent.putExtra("PushNotification", "true");
|
|
intent.setFlags(603979776);
|
|
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1140850688);
|
|
if (!ApplicationEnvironment.isMainApplicationActive()) {
|
|
if (Build.VERSION.SDK_INT >= 33) {
|
|
parcelable = bundle.getParcelable("notification", Notification.class);
|
|
notification = (Notification) parcelable;
|
|
} else {
|
|
notification = (Notification) bundle.getParcelable("notification");
|
|
}
|
|
if (notification == null) {
|
|
Log.Helper.LOGE(this, String.format("[handleNewLocalNotification]: Unable to create Local Notification", new Object[0]), new Object[0]);
|
|
return;
|
|
} else if (activity != null) {
|
|
notification.contentIntent = activity;
|
|
((NotificationManager) context.getSystemService("notification")).notify(string.hashCode(), notification);
|
|
return;
|
|
} else {
|
|
Log.Helper.LOGE(this, String.format("[handleNewLocalNotification]: Unable to create PendingIntent", new Object[0]), new Object[0]);
|
|
return;
|
|
}
|
|
}
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put("en", "message");
|
|
Bundle bundle2 = new Bundle();
|
|
bundle2.putSerializable("core", hashMap);
|
|
bundle2.putString("msg_id", string);
|
|
bundle2.putString("type", "pn");
|
|
bundle2.putString(NotificationCompat.CATEGORY_SERVICE, "local");
|
|
bundle2.putString("status", "received");
|
|
bundle2.putString("format", "pn");
|
|
Intent intent2 = new Intent();
|
|
intent2.setAction(NOTIFICATION_TRACKING2_LOG_EVENT);
|
|
intent2.putExtras(bundle2);
|
|
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).sendBroadcast(intent2);
|
|
Utility.sendBroadcast(NIMBLE_LOCAL_NOTIFICATION_RECEIVED, bundle);
|
|
}
|
|
|
|
public String getPushTargetActivity(Context context) {
|
|
Context applicationContext = context.getApplicationContext();
|
|
return applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName()).resolveActivity(applicationContext.getPackageManager()).getClassName();
|
|
}
|
|
}
|