正在查看: BAM Crawford v6.14.1 应用的 PushIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BAM Crawford v6.14.1 应用的 PushIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.subsplash.thechurchapp.api;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.o0;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.subsplash.thechurchapp.TheChurchApp;
import com.subsplash.thechurchapp.dataObjects.ImageSet;
import com.subsplash.thechurchapp.dataObjects.MetricData;
import com.subsplash.thechurchapp.dataObjects.MetricsRequestData;
import com.subsplash.thechurchapp.handlers.chat.ChatHandler;
import com.subsplash.thechurchapp.handlers.common.NavigationHandler;
import com.subsplash.thechurchapp.handlers.notes.NoteHandler;
import com.subsplash.thechurchapp.handlers.notification.NotificationHandler;
import com.subsplash.util.ApplicationInstance;
import com.subsplash.util.PushUtil;
import com.subsplash.util.e0;
import com.subsplash.util.h0;
import java.net.URL;
import java.util.Arrays;
import org.json.JSONObject;
public class PushIntentService extends FirebaseMessagingService {
class a implements Runnable {
final com.subsplash.thechurchapp.handlers.common.a p;
a(com.subsplash.thechurchapp.handlers.common.a aVar) {
this.p = aVar;
}
@Override
public void run() {
NavigationHandler.navigate((NavigationHandler) this.p, TheChurchApp.n());
}
}
public PushIntentService() {
Log.d("PushIntentService", "Starting push intent service");
}
@Override
public void q(o0 o0Var) {
com.subsplash.thechurchapp.handlers.common.a aVar;
Intent i = o0Var.i();
if (!i.getExtras().isEmpty()) {
String str = (String) o0Var.g().get("sendbird");
if (str == null) {
boolean parseBoolean = Boolean.parseBoolean(i.getStringExtra("silent"));
String stringExtra = i.getStringExtra(com.subsplash.thechurchapp.handlers.common.a.JSON_KEY_ID);
String stringExtra2 = i.getStringExtra(MetricsRequestData.KEY_METRICS_URL);
String stringExtra3 = i.getStringExtra(MetricsRequestData.KEY_SUBTYPE);
try {
aVar = com.subsplash.thechurchapp.handlers.common.a.CreateHandler(i.hasExtra("actions") ? i.getStringExtra("actions") : null);
} catch (Exception unused) {
aVar = null;
}
String str2 = (aVar == null || !parseBoolean) ? null : aVar.command;
if (h0.d(stringExtra)) {
MetricData metricData = new MetricData();
metricData.type = MetricData.TYPE_NOTIFICATION_EVENT;
metricData.subtype = stringExtra3;
metricData.action = "received";
metricData.context = str2;
metricData.f2id = stringExtra;
if (AsyncDataUploader.getInstance().queueMetric(metricData, stringExtra2) && parseBoolean) {
AsyncDataUploader.transmitQueuedItems();
}
}
SharedPreferences t = TheChurchApp.t();
String string = t.getString("prevPushCollapseKey", null);
String stringExtra4 = i.getStringExtra("collapse_key");
if (stringExtra4 != null && str2 != null) {
stringExtra4 = String.format("%s_%s", stringExtra4, str2);
}
if (stringExtra4 == null || !stringExtra4.equals(string) || stringExtra4.equals("do_not_collapse")) {
SharedPreferences.Editor edit = t.edit();
edit.putString("prevPushCollapseKey", stringExtra4);
edit.commit();
if (parseBoolean) {
if (aVar instanceof NavigationHandler) {
new Handler(TheChurchApp.n().getMainLooper()).post(new a(aVar));
return;
}
return;
}
String stringExtra5 = i.getStringExtra("msg");
if (stringExtra5 == null) {
stringExtra5 = i.getStringExtra("message");
}
if (stringExtra5 == null) {
stringExtra5 = i.getStringExtra("default");
}
String stringExtra6 = i.getStringExtra(NoteHandler.JSON_KEY_TITLE);
NotificationHandler notificationHandler = new NotificationHandler();
notificationHandler.identifier = stringExtra;
notificationHandler.metricsUrl = stringExtra2;
notificationHandler.subtype = stringExtra3;
notificationHandler.title = stringExtra6;
notificationHandler.subtitle = i.getStringExtra("subtitle");
notificationHandler.body = stringExtra5;
notificationHandler.actions = aVar != null ? Arrays.asList(aVar) : null;
String stringExtra7 = i.getStringExtra("attachment_image_url");
if (stringExtra7 != null) {
ImageSet imageSet = new ImageSet();
URL f = e0.f(stringExtra7);
if (f != null) {
imageSet.addItem(f, NotificationHandler.IMAGE_SIZE, null);
}
notificationHandler.images = imageSet;
}
NavigationHandler.navigate(notificationHandler, TheChurchApp.n());
return;
}
return;
}
ChatHandler chatHandler = new ChatHandler();
JsonObject jsonObject = new JsonObject();
jsonObject.add("name", new JsonPrimitive("handle_notification"));
jsonObject.add("sendbird", new JsonPrimitive(str));
jsonObject.add("require_login", new JsonPrimitive(Boolean.TRUE));
chatHandler.setModuleCommand(jsonObject);
NotificationHandler notificationHandler2 = new NotificationHandler();
notificationHandler2.body = (String) o0Var.g().get("message");
notificationHandler2.actions = Arrays.asList(chatHandler);
try {
JSONObject jSONObject = new JSONObject(str);
String string2 = jSONObject.getString("push_title");
if (h0.d(string2)) {
notificationHandler2.title = string2;
}
JSONObject jSONObject2 = jSONObject.getJSONObject("channel");
JSONObject jSONObject3 = jSONObject.getJSONObject("sender");
boolean equals = "direct".equals(jSONObject2.getString("custom_type"));
notificationHandler2.conversationId = jSONObject2.getString("channel_url");
notificationHandler2.conversationSenderName = jSONObject3.getString("name");
notificationHandler2.conversationMessage = jSONObject.getString("message");
String string3 = jSONObject2.getString("name");
notificationHandler2.conversationName = string3;
if (string3 == null) {
notificationHandler2.conversationName = "Message";
}
if (equals) {
String str3 = notificationHandler2.conversationSenderName;
notificationHandler2.conversationName = str3;
notificationHandler2.title = str3;
notificationHandler2.body = notificationHandler2.conversationMessage;
}
String string4 = jSONObject3.getString("profile_url");
if (h0.d(string4)) {
String replace = string4.replace("{width}", String.valueOf(NotificationHandler.IMAGE_SIZE)).replace("{height}", String.valueOf(NotificationHandler.IMAGE_SIZE)).replace("{name}", "image").replace("{ext}", "png");
ImageSet imageSet2 = new ImageSet();
URL f2 = e0.f(replace);
if (f2 != null) {
imageSet2.addItem(f2, NotificationHandler.IMAGE_SIZE, null);
}
notificationHandler2.images = imageSet2;
}
com.subsplash.widgets.topBar.g.a(jSONObject.getInt("unread_message_count"));
} catch (Exception unused2) {
Log.d("PushIntentService", "Unable to update badge number");
}
NavigationHandler.navigate(notificationHandler2, TheChurchApp.n());
}
}
@Override
public void s(String str) {
super.s(str);
Log.d("PushIntentService", String.format("%s started", "PushIntentService"));
if (PushUtil.i(ApplicationInstance.getCurrentInstance())) {
PushUtil.n(ApplicationInstance.getCurrentInstance());
}
}
}