导航菜单

页面标题

页面副标题

Jurassic World v1.83.4 - UrbanAirshipReceiver.java 源代码

正在查看: Jurassic World v1.83.4 应用的 UrbanAirshipReceiver.java JAVA 源代码文件

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


package com.ludia.framework.notification.remote;

import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import androidx.core.app.NotificationCompat;
import com.ludia.engine.application.Application;
import com.ludia.engine.application.GameActivity;
import com.ludia.framework.notification.local.NotificationSettings;
import com.microsoft.appcenter.ingestion.models.properties.StringTypedProperty;
import com.urbanairship.push.PushMessage;
import com.urbanairship.push.notifications.NotificationArguments;
import com.urbanairship.push.notifications.NotificationProvider;
import com.urbanairship.push.notifications.NotificationResult;
import org.json.nb;

public class UrbanAirshipReceiver implements NotificationProvider {
    @Override
    public void onNotificationCreated(Context context, Notification notification, NotificationArguments notificationArguments) {
    }

    private void prepareIntentFromNotification(Bundle bundle, Intent intent) {
        intent.putExtra("PushNotification", true);
        String string = bundle.getString("utm_source", "");
        String string2 = bundle.getString("utm_param", "");
        if (!string.isEmpty()) {
            intent.putExtra("utm_source", string);
        }
        if (string2.isEmpty()) {
            return;
        }
        intent.putExtra("utm_param", string2);
    }

    @Override
    public NotificationArguments onCreateNotificationArguments(Context context, PushMessage pushMessage) {
        return NotificationArguments.newBuilder(pushMessage).setNotificationChannelId((pushMessage.getNotificationChannel() == null || !NotificationSettings.hasNotificationChannel(context, pushMessage.getNotificationChannel())) ? NotificationSettings.DEFAULT_CHANNEL_ID : pushMessage.getNotificationChannel()).setNotificationId(pushMessage.getNotificationTag(), 1).build();
    }

    @Override
    public NotificationResult onCreateNotification(Context context, NotificationArguments notificationArguments) {
        PushMessage message = notificationArguments.getMessage();
        String string = message.getPushBundle().getString(nb.p);
        if (string != null && string.equals("helpshift")) {
            return NotificationResult.cancel();
        }
        Intent intent = new Intent(context, (Class<?>) GameActivity.class);
        intent.setFlags(67108864);
        intent.putExtra("content", message.getAlert());
        prepareIntentFromNotification(message.getPushBundle(), intent);
        NotificationCompat.Builder autoCancel = new NotificationCompat.Builder(context, notificationArguments.getNotificationChannelId()).setContentTitle((message.getTitle() == null || message.getTitle().isEmpty()) ? context.getString(context.getApplicationInfo().labelRes) : message.getTitle()).setContentText(message.getAlert()).setContentIntent(PendingIntent.getActivity(context, 0, intent, 1140850688)).setWhen(System.currentTimeMillis()).setAutoCancel(true);
        try {
            Resources resources = context.getResources();
            String packageName = context.getPackageName();
            String string2 = resources.getString(resources.getIdentifier("ic_type", StringTypedProperty.TYPE, packageName));
            String string3 = resources.getString(resources.getIdentifier("ic_notif", StringTypedProperty.TYPE, packageName));
            String string4 = resources.getString(resources.getIdentifier("ic_notif_bar", StringTypedProperty.TYPE, packageName));
            int identifier = resources.getIdentifier(string3, string2, packageName);
            if (identifier == 0) {
                identifier = resources.getIdentifier(resources.getString(resources.getIdentifier("ic_launcher", StringTypedProperty.TYPE, packageName)), string2, packageName);
            }
            int identifier2 = resources.getIdentifier(string4, string2, packageName);
            if (identifier2 == 0) {
                identifier2 = identifier;
            }
            if (identifier != 0) {
                autoCancel.setLargeIcon(BitmapFactory.decodeResource(resources, identifier));
            }
            if (identifier2 != 0) {
                autoCancel.setSmallIcon(identifier2);
            }
        } catch (Resources.NotFoundException unused) {
            Application.trace("Resource ID not found, check notification_icons.xml", new Object[0]);
        }
        autoCancel.setStyle(new NotificationCompat.BigTextStyle().bigText(message.getAlert()));
        int i = NotificationSettings.isSoundEnabled(context) ? 5 : 4;
        if (NotificationSettings.isVibrationEnabled(context)) {
            i |= 2;
        }
        autoCancel.setDefaults(i);
        return NotificationResult.notification(autoCancel.build());
    }
}