discord-jadx/app/src/main/java/com/discord/utilities/fcm/NotificationData.java

1392 lines
65 KiB
Java

package com.discord.utilities.fcm;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.text.Html;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.Person;
import androidx.core.app.RemoteInput;
import androidx.core.graphics.drawable.IconCompat;
import b.a.k.b;
import b.d.b.a.a;
import com.adjust.sdk.Constants;
import com.discord.R;
import com.discord.api.application.Application;
import com.discord.api.channel.Channel;
import com.discord.api.channel.ChannelUtils;
import com.discord.api.guildmember.GuildMember;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
import com.discord.api.message.Message;
import com.discord.api.message.activity.MessageActivity;
import com.discord.api.message.activity.MessageActivityType;
import com.discord.api.sticker.Sticker;
import com.discord.api.user.User;
import com.discord.app.AppActivity;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.nullserializable.NullSerializable;
import com.discord.utilities.SnowflakeUtils;
import com.discord.utilities.extensions.PendingIntentExtensionsKt;
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.intent.IntentUtils;
import com.discord.utilities.media.AppSound;
import com.discord.utilities.message.MessageUtils;
import com.discord.utilities.stickers.StickerUtils;
import com.discord.utilities.time.Clock;
import com.discord.widgets.chat.input.MentionUtilsKt;
import d0.d0.f;
import d0.g0.s;
import d0.g0.t;
import d0.g0.w;
import d0.t.g0;
import d0.t.n;
import d0.t.o;
import d0.t.u;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import kotlin.Pair;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: NotificationData.kt */
/* loaded from: classes2.dex */
public final class NotificationData {
private static final int ACTIVITY_TYPE_PLAYING = 0;
private static final int ACTIVITY_TYPE_STREAMING = 1;
private static final String ANALYTICS_ACTIVITY_NAME = "activity_name";
private static final String ANALYTICS_ACTIVITY_TYPE = "activity_type";
private static final String ANALYTICS_CHANNEL_ID = "channel_id";
private static final String ANALYTICS_CHANNEL_TYPE = "channel_type";
private static final String ANALYTICS_GUILD_ID = "guild_id";
private static final String ANALYTICS_MESSAGE_ID = "message_id";
private static final String ANALYTICS_MESSAGE_TYPE = "message_type";
private static final String ANALYTICS_NOTIF_IN_APP = "notif_in_app";
private static final String ANALYTICS_NOTIF_TYPE = "notif_type";
private static final String ANALYTICS_NOTIF_USER_ID = "notif_user_id";
private static final String ANALYTICS_REL_TYPE = "rel_type";
public static final Companion Companion = new Companion(null);
private static final String GROUP_KEY_PREFIX = "GROUP_";
private static final int MSG_MUTE_MIN_COUNT = 2;
public static final String REPLYING_TO_UNTRANSLATED = "replying to";
public static final String TYPE_ACTIVITY_START = "ACTIVITY_START";
public static final String TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE = "APPLICATION_LIBRARY_INSTALL_COMPLETE";
public static final String TYPE_CALL_RING = "CALL_RING";
public static final String TYPE_GENERIC_PUSH_NOTIFICATION_SENT = "GENERIC_PUSH_NOTIFICATION_SENT";
public static final String TYPE_GUILD_SCHEDULED_EVENT_UPDATE = "GUILD_SCHEDULED_EVENT_UPDATE";
public static final String TYPE_MESSAGE_CREATE = "MESSAGE_CREATE";
public static final String TYPE_RELATIONSHIP_ADD = "RELATIONSHIP_ADD";
public static final String TYPE_STAGE_INSTANCE_CREATE = "STAGE_INSTANCE_CREATE";
public static final int UNSET_INT = -1;
public static final long UNSET_LONG = -1;
private final List<Long> ackChannelIds;
private final String activityName;
private final int activityType;
private final String applicationIcon;
private final long applicationId;
private final String applicationName;
private final Channel channel;
private final String deeplink;
private final String guildIcon;
private final long guildId;
private final String guildMemberAvatar;
private final String guildName;
private final GuildScheduledEventEntityType guildScheduledEventEntityType;
private final Long guildScheduledEventId;
private final boolean isGroupConversation;
private final MessageActivityType messageActivityType;
private final String messageApplicationName;
private final String messageContent;
private final long messageId;
private final int messageType;
private final String notificationChannel;
private final NotificationType notificationType;
private final int relationshipType;
private final String stageInstanceTopic;
private final Sticker sticker;
private final String subtitle;
private final String subtitleResName;
private final String title;
private final String titleResName;
private final String trackingType;
private final String type;
private final String userAvatar;
private final Integer userDiscriminator;
private final long userId;
private final String userUsername;
/* compiled from: NotificationData.kt */
/* loaded from: classes2.dex */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ List access$parseAckChannelIds(Companion companion, String str) {
return companion.parseAckChannelIds(str);
}
private final void copyIntIntoMap(Intent intent, Map<String, Object> map, String str) {
int i = -1;
if (intent != null) {
i = intent.getIntExtra(str, -1);
}
if (i >= 0) {
map.put(str, Integer.valueOf(i));
}
}
private final void copyLongIntoMap(Intent intent, Map<String, Object> map, String str) {
long j = -1;
if (intent != null) {
j = intent.getLongExtra(str, -1L);
}
if (j >= 0) {
map.put(str, Long.valueOf(j));
}
}
private final void copyStringIntoMap(Intent intent, Map<String, Object> map, String str) {
String stringExtra;
if (intent != null && (stringExtra = intent.getStringExtra(str)) != null) {
m.checkNotNullExpressionValue(stringExtra, "this?.getStringExtra(key) ?: return");
if (!(stringExtra.length() == 0)) {
map.put(str, stringExtra);
}
}
}
private final List<Long> parseAckChannelIds(String str) {
if (str == null) {
str = "";
}
List split$default = w.split$default((CharSequence) str, new String[]{","}, false, 0, 6, (Object) null);
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(split$default, 10));
Iterator it = split$default.iterator();
while (true) {
long j = -1;
if (!it.hasNext()) {
break;
}
Long longOrNull = s.toLongOrNull((String) it.next());
if (longOrNull != null) {
j = longOrNull.longValue();
}
arrayList.add(Long.valueOf(j));
}
ArrayList arrayList2 = new ArrayList();
for (Object obj : arrayList) {
if (((Number) obj).longValue() != -1) {
arrayList2.add(obj);
}
}
return arrayList2;
}
public final Map<String, Object> buildTrackingData(Intent intent) {
String stringExtra;
HashMap hashMap = new HashMap();
copyStringIntoMap(intent, hashMap, NotificationData.ANALYTICS_NOTIF_TYPE);
copyLongIntoMap(intent, hashMap, NotificationData.ANALYTICS_NOTIF_USER_ID);
copyLongIntoMap(intent, hashMap, NotificationData.ANALYTICS_MESSAGE_ID);
copyLongIntoMap(intent, hashMap, "guild_id");
copyLongIntoMap(intent, hashMap, "channel_id");
copyIntIntoMap(intent, hashMap, NotificationData.ANALYTICS_MESSAGE_TYPE);
copyIntIntoMap(intent, hashMap, NotificationData.ANALYTICS_CHANNEL_TYPE);
copyIntIntoMap(intent, hashMap, NotificationData.ANALYTICS_REL_TYPE);
copyIntIntoMap(intent, hashMap, NotificationData.ANALYTICS_ACTIVITY_TYPE);
copyStringIntoMap(intent, hashMap, NotificationData.ANALYTICS_ACTIVITY_NAME);
if (!(intent == null || (stringExtra = intent.getStringExtra("com.discord.intent.ORIGIN_SOURCE")) == null)) {
hashMap.put(NotificationData.ANALYTICS_NOTIF_IN_APP, Boolean.valueOf(t.equals(stringExtra, "com.discord.intent.ORIGIN_NOTIF_INAPP", true)));
}
return hashMap;
}
}
/* compiled from: NotificationData.kt */
/* loaded from: classes2.dex */
public static final class DisplayPayload {
private NotificationData data;
private final LinkedHashMap<Long, NotificationData> extras;
/* renamed from: id reason: collision with root package name */
private final int f2791id;
private boolean ignoreNextClearForAck;
public DisplayPayload() {
this(new NotificationData());
}
public DisplayPayload(NotificationData notificationData) {
m.checkNotNullParameter(notificationData, "data");
this.data = notificationData;
this.f2791id = new Random().nextInt(Integer.MAX_VALUE);
this.extras = new LinkedHashMap<>();
}
private final void trimExtrasWhenOversized(int i) {
if (this.extras.size() >= i) {
Set<Map.Entry<Long, NotificationData>> entrySet = this.extras.entrySet();
m.checkNotNullExpressionValue(entrySet, "extras\n .entries");
List<Map.Entry> drop = u.drop(entrySet, this.extras.size() - (i / 2));
LinkedHashMap linkedHashMap = new LinkedHashMap(f.coerceAtLeast(g0.mapCapacity(o.collectionSizeOrDefault(drop, 10)), 16));
for (Map.Entry entry : drop) {
linkedHashMap.put((Long) entry.getKey(), (NotificationData) entry.getValue());
}
this.extras.clear();
this.extras.putAll(linkedHashMap);
}
}
public static /* synthetic */ void update$default(DisplayPayload displayPayload, NotificationData notificationData, int i, int i2, Object obj) {
if ((i2 & 2) != 0) {
i = 20;
}
displayPayload.update(notificationData, i);
}
public final NotificationData getData() {
return this.data;
}
public final synchronized List<NotificationData> getExtras() {
Collection<NotificationData> values;
values = this.extras.values();
m.checkNotNullExpressionValue(values, "extras.values");
return u.toList(values);
}
public final int getId() {
return this.f2791id;
}
public final boolean getIgnoreNextClearForAck() {
return this.ignoreNextClearForAck;
}
public final void setData(NotificationData notificationData) {
m.checkNotNullParameter(notificationData, "<set-?>");
this.data = notificationData;
}
public final void setIgnoreNextClearForAck(boolean z2) {
this.ignoreNextClearForAck = z2;
}
public final synchronized void update(NotificationData notificationData, int i) {
m.checkNotNullParameter(notificationData, "data");
this.data = notificationData;
trimExtrasWhenOversized(i);
if (notificationData.getShouldGroup()) {
this.extras.put(Long.valueOf(notificationData.getMessageId()), notificationData);
} else {
this.extras.clear();
}
}
}
/* loaded from: classes2.dex */
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
public static final /* synthetic */ int[] $EnumSwitchMapping$2;
public static final /* synthetic */ int[] $EnumSwitchMapping$3;
public static final /* synthetic */ int[] $EnumSwitchMapping$4;
public static final /* synthetic */ int[] $EnumSwitchMapping$5;
public static final /* synthetic */ int[] $EnumSwitchMapping$6;
static {
GuildScheduledEventEntityType.values();
int[] iArr = new int[5];
$EnumSwitchMapping$0 = iArr;
GuildScheduledEventEntityType guildScheduledEventEntityType = GuildScheduledEventEntityType.STAGE_INSTANCE;
iArr[guildScheduledEventEntityType.ordinal()] = 1;
GuildScheduledEventEntityType guildScheduledEventEntityType2 = GuildScheduledEventEntityType.VOICE;
iArr[guildScheduledEventEntityType2.ordinal()] = 2;
GuildScheduledEventEntityType guildScheduledEventEntityType3 = GuildScheduledEventEntityType.EXTERNAL;
iArr[guildScheduledEventEntityType3.ordinal()] = 3;
GuildScheduledEventEntityType.values();
int[] iArr2 = new int[5];
$EnumSwitchMapping$1 = iArr2;
iArr2[guildScheduledEventEntityType.ordinal()] = 1;
iArr2[guildScheduledEventEntityType2.ordinal()] = 2;
iArr2[guildScheduledEventEntityType3.ordinal()] = 3;
GuildScheduledEventEntityType.values();
int[] iArr3 = new int[5];
$EnumSwitchMapping$2 = iArr3;
iArr3[guildScheduledEventEntityType.ordinal()] = 1;
iArr3[guildScheduledEventEntityType2.ordinal()] = 2;
iArr3[guildScheduledEventEntityType3.ordinal()] = 3;
GuildScheduledEventEntityType.values();
int[] iArr4 = new int[5];
$EnumSwitchMapping$3 = iArr4;
iArr4[guildScheduledEventEntityType.ordinal()] = 1;
iArr4[guildScheduledEventEntityType2.ordinal()] = 2;
iArr4[guildScheduledEventEntityType3.ordinal()] = 3;
NotificationType.values();
int[] iArr5 = new int[1];
$EnumSwitchMapping$4 = iArr5;
iArr5[NotificationType.Reminder.ordinal()] = 1;
GuildScheduledEventEntityType.values();
int[] iArr6 = new int[5];
$EnumSwitchMapping$5 = iArr6;
iArr6[guildScheduledEventEntityType.ordinal()] = 1;
iArr6[guildScheduledEventEntityType2.ordinal()] = 2;
iArr6[guildScheduledEventEntityType3.ordinal()] = 3;
GuildScheduledEventEntityType.values();
int[] iArr7 = new int[5];
$EnumSwitchMapping$6 = iArr7;
iArr7[guildScheduledEventEntityType.ordinal()] = 1;
iArr7[guildScheduledEventEntityType2.ordinal()] = 2;
iArr7[guildScheduledEventEntityType3.ordinal()] = 3;
}
}
public NotificationData() {
this(new HashMap());
}
public NotificationData(String str, long j, MessageActivityType messageActivityType, String str2, int i, String str3, Channel channel, List<Long> list, long j2, String str4, Integer num, String str5, String str6, int i2, String str7, long j3, String str8, String str9, int i3, String str10, long j4, String str11, String str12, Sticker sticker, String str13, String str14, String str15, String str16, String str17, GuildScheduledEventEntityType guildScheduledEventEntityType, Long l, NotificationType notificationType, String str18, String str19) {
m.checkNotNullParameter(str, "type");
m.checkNotNullParameter(channel, "channel");
m.checkNotNullParameter(list, "ackChannelIds");
this.type = str;
this.messageId = j;
this.messageActivityType = messageActivityType;
this.messageApplicationName = str2;
this.messageType = i;
this.messageContent = str3;
this.channel = channel;
this.ackChannelIds = list;
this.userId = j2;
this.userUsername = str4;
this.userDiscriminator = num;
this.userAvatar = str5;
this.guildMemberAvatar = str6;
this.relationshipType = i2;
this.deeplink = str7;
this.guildName = str8;
this.guildIcon = str9;
this.activityType = i3;
this.activityName = str10;
this.applicationId = j4;
this.applicationName = str11;
this.applicationIcon = str12;
this.sticker = sticker;
this.title = str13;
this.subtitle = str14;
this.titleResName = str15;
this.subtitleResName = str16;
this.stageInstanceTopic = str17;
this.guildScheduledEventEntityType = guildScheduledEventEntityType;
this.guildScheduledEventId = l;
this.notificationType = notificationType;
this.trackingType = str18;
this.notificationChannel = str19;
Long valueOf = Long.valueOf(j3);
boolean z2 = false;
long j5 = -1;
valueOf = (valueOf.longValue() > (-1L) ? 1 : (valueOf.longValue() == (-1L) ? 0 : -1)) == 0 ? null : valueOf;
if (valueOf != null) {
j5 = valueOf.longValue();
} else {
int A = channel.A();
if (A == 1 || A == 3) {
j5 = 0;
}
}
this.guildId = j5;
if (m.areEqual(str, TYPE_MESSAGE_CREATE) && (channel.A() == 0 || channel.A() == 2 || channel.A() == 3 || channel.A() == 10 || channel.A() == 11 || channel.A() == 12)) {
z2 = true;
}
this.isGroupConversation = z2;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public NotificationData(Map<String, String> map) {
this(r1, r1, r6, r7, r8, r9, r49, r11, r12, r14, r15, r16, r17, r18, r19, r20, r22, r23, r24, r25, r26, r28, r29, r30, r31, r32, r33, r34, r35, r36, r37, r1 != null ? NotificationType.Companion.parse(r1) : null, map.get("tracking_type"), map.get("notification_channel"));
Integer intOrNull;
Long longOrNull;
Integer intOrNull2;
Long longOrNull2;
Integer intOrNull3;
Long longOrNull3;
Long longOrNull4;
Long longOrNull5;
Integer intOrNull4;
Integer intOrNull5;
Integer intOrNull6;
Long longOrNull6;
m.checkNotNullParameter(map, "data");
String str = map.get("type");
str = str == null ? "" : str;
String str2 = map.get(ANALYTICS_MESSAGE_ID);
long longValue = (str2 == null || (longOrNull6 = s.toLongOrNull(str2)) == null) ? -1L : longOrNull6.longValue();
String str3 = map.get("message_activity_type");
MessageActivityType a = (str3 == null || (intOrNull6 = s.toIntOrNull(str3)) == null) ? null : MessageActivityType.Companion.a(intOrNull6);
String str4 = map.get("message_application_name");
String str5 = map.get("message_type_");
int intValue = (str5 == null || (intOrNull5 = s.toIntOrNull(str5)) == null) ? -1 : intOrNull5.intValue();
String str6 = map.get("message_content");
String str7 = map.get(ANALYTICS_CHANNEL_TYPE);
int intValue2 = (str7 == null || (intOrNull4 = s.toIntOrNull(str7)) == null) ? -1 : intOrNull4.intValue();
String str8 = map.get("guild_id");
long longValue2 = (str8 == null || (longOrNull5 = s.toLongOrNull(str8)) == null) ? -1L : longOrNull5.longValue();
String str9 = map.get("channel_name");
String obj = str9 != null ? b.l(a.w("!!", str9, "!!"), new Object[0], null, 2).toString() : null;
String str10 = map.get("channel_id");
Channel channel = new Channel(null, intValue2, longValue2, obj, 0L, (str10 == null || (longOrNull4 = s.toLongOrNull(str10)) == null) ? -1L : longOrNull4.longValue(), 0L, null, null, 0, null, 0, 0, map.get("channel_icon"), 0L, 0L, null, false, 0L, null, 0, null, map.get(ModelAuditLogEntry.CHANGE_KEY_REGION_OVERRIDE), null, null, null, null, null, null);
List access$parseAckChannelIds = Companion.access$parseAckChannelIds(Companion, map.get("channel_ids"));
String str11 = map.get("user_id");
long longValue3 = (str11 == null || (longOrNull3 = s.toLongOrNull(str11)) == null) ? -1L : longOrNull3.longValue();
String str12 = map.get("user_username");
String str13 = map.get("user_discriminator");
Integer intOrNull7 = str13 != null ? s.toIntOrNull(str13) : null;
String str14 = map.get("user_avatar");
String str15 = map.get("user_guild_avatar");
String str16 = map.get(ANALYTICS_REL_TYPE);
int intValue3 = (str16 == null || (intOrNull3 = s.toIntOrNull(str16)) == null) ? -1 : intOrNull3.intValue();
String str17 = map.get(Constants.DEEPLINK);
String str18 = map.get("guild_id");
long longValue4 = (str18 == null || (longOrNull2 = s.toLongOrNull(str18)) == null) ? -1L : longOrNull2.longValue();
String str19 = map.get("guild_name");
String str20 = map.get("guild_icon");
String str21 = map.get(ANALYTICS_ACTIVITY_TYPE);
int intValue4 = (str21 == null || (intOrNull2 = s.toIntOrNull(str21)) == null) ? -1 : intOrNull2.intValue();
String str22 = map.get(ANALYTICS_ACTIVITY_NAME);
String str23 = map.get(ModelAuditLogEntry.CHANGE_KEY_APPLICATION_ID);
long longValue5 = (str23 == null || (longOrNull = s.toLongOrNull(str23)) == null) ? -1L : longOrNull.longValue();
String str24 = map.get("application_name");
String str25 = map.get("application_icon");
Sticker parseFromMessageNotificationJson = StickerUtils.INSTANCE.parseFromMessageNotificationJson(map.get("message"));
String str26 = map.get("title");
String str27 = map.get("subtitle");
String str28 = map.get("title_resource_name");
String str29 = map.get("subtitle_resource_name");
String str30 = map.get("stage_instance_topic");
String str31 = map.get("guild_scheduled_event_entity_type");
GuildScheduledEventEntityType a2 = (str31 == null || (intOrNull = s.toIntOrNull(str31)) == null) ? null : GuildScheduledEventEntityType.Companion.a(intOrNull.intValue());
String str32 = map.get("guild_scheduled_event_id");
Long longOrNull7 = str32 != null ? s.toLongOrNull(str32) : null;
String str33 = map.get("notification_type");
}
private final Intent addTrackingData(Intent intent) {
String str = this.trackingType;
if (str == null) {
str = this.type;
}
Intent putExtra = intent.putExtra(ANALYTICS_NOTIF_TYPE, str).putExtra(ANALYTICS_NOTIF_USER_ID, this.userId).putExtra(ANALYTICS_MESSAGE_ID, this.messageId).putExtra(ANALYTICS_MESSAGE_TYPE, this.messageType).putExtra("guild_id", this.guildId).putExtra("channel_id", this.channel.h()).putExtra(ANALYTICS_CHANNEL_TYPE, this.channel.A()).putExtra(ANALYTICS_REL_TYPE, this.relationshipType).putExtra(ANALYTICS_ACTIVITY_TYPE, this.activityType).putExtra(ANALYTICS_ACTIVITY_NAME, this.activityName);
m.checkNotNullExpressionValue(putExtra, "intent\n .putExtra…IVITY_NAME, activityName)");
return putExtra;
}
/* JADX WARN: Code restructure failed: missing block: B:13:0x0045, code lost:
if (r0.equals(com.discord.utilities.fcm.NotificationData.TYPE_RELATIONSHIP_ADD) != false) goto L_0x0047;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x004d, code lost:
if (r8.channel.A() == 1) goto L_0x0060;
*/
/* JADX WARN: Code restructure failed: missing block: B:41:?, code lost:
return com.discord.utilities.intent.IntentUtils.RouteBuilders.selectChannel$default(r8.channel.h(), r8.guildId, null, 4, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:42:?, code lost:
return com.discord.utilities.intent.IntentUtils.RouteBuilders.selectChannel$default(r8.channel.h(), 0, null, 4, null);
*/
/* JADX WARN: Code restructure failed: missing block: B:5:0x0014, code lost:
if (r0.equals(com.discord.utilities.fcm.NotificationData.TYPE_MESSAGE_CREATE) != false) goto L_0x0047;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
private final Intent getContentIntentInternal() {
String str = this.type;
switch (str.hashCode()) {
case -1502317553:
if (str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
String str2 = this.deeplink;
if (str2 == null) {
str2 = "";
}
return new Intent("android.intent.action.VIEW", Uri.parse(str2));
}
return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null);
case -1489275252:
if (str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
GuildScheduledEventEntityType guildScheduledEventEntityType = this.guildScheduledEventEntityType;
if (guildScheduledEventEntityType != null) {
int ordinal = guildScheduledEventEntityType.ordinal();
if (ordinal == 1 || ordinal == 2) {
return IntentUtils.RouteBuilders.INSTANCE.connectVoice(this.channel.h());
}
if (ordinal == 3) {
return IntentUtils.RouteBuilders.selectExternalEvent(this.guildId, this.guildScheduledEventId);
}
}
return new Intent("android.intent.action.VIEW", IntentUtils.RouteBuilders.Uris.INSTANCE.getApp());
}
return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null);
case -1327124998:
break;
case -1263316859:
if (str.equals(TYPE_STAGE_INSTANCE_CREATE)) {
return IntentUtils.RouteBuilders.INSTANCE.connectVoice(this.channel.h());
}
return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null);
case 974015250:
if (str.equals(TYPE_ACTIVITY_START)) {
return IntentUtils.RouteBuilders.INSTANCE.selectDirectMessage(this.userId);
}
return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null);
case 998188116:
break;
default:
return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null);
}
}
private final String getIconUrlForChannel() {
int A = this.channel.A();
if (A != 0) {
if (A == 1) {
return getIconUrlForUser();
}
if (!(A == 2 || A == 5)) {
switch (A) {
case 10:
case 11:
case 12:
break;
default:
return IconUtils.getForChannel$default(this.channel.h(), this.channel.g(), this.channel.A(), true, null, 16, null);
}
}
}
return IconUtils.getForGuild$default(Long.valueOf(this.guildId), this.guildIcon, "", false, null, 24, null);
}
private final String getIconUrlForGuildMember() {
return IconUtils.getForGuildMember$default(IconUtils.INSTANCE, this.guildMemberAvatar, this.guildId, this.userId, null, false, 24, null);
}
private final CharSequence resNameToString(Context context, String str, String str2) {
Resources resources = context.getResources();
int identifier = resources != null ? resources.getIdentifier(str, "string", context.getPackageName()) : 0;
return identifier == 0 ? str2 : b.h(context, identifier, new Object[0], null, 4);
}
public static /* synthetic */ CharSequence resNameToString$default(NotificationData notificationData, Context context, String str, String str2, int i, Object obj) {
if ((i & 4) != 0) {
str2 = "";
}
return notificationData.resNameToString(context, str, str2);
}
public final boolean canDisplayInApp() {
int ordinal;
if (m.areEqual(this.type, TYPE_STAGE_INSTANCE_CREATE)) {
return true;
}
if (!m.areEqual(this.type, TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
return this.channel.h() == -1;
}
GuildScheduledEventEntityType guildScheduledEventEntityType = this.guildScheduledEventEntityType;
return guildScheduledEventEntityType != null && ((ordinal = guildScheduledEventEntityType.ordinal()) == 1 || ordinal == 2 || ordinal == 3);
}
public final NotificationData copyForDirectReply(Message message) {
NullSerializable<String> a;
String a2;
String f;
String username;
m.checkNotNullParameter(message, "message");
long o = message.o();
MessageActivity a3 = message.a();
MessageActivityType b2 = a3 != null ? a3.b() : null;
Application b3 = message.b();
String h = b3 != null ? b3.h() : null;
Integer E = message.E();
m.checkNotNull(E);
int intValue = E.intValue();
String i = message.i();
Channel a4 = Channel.a(this.channel, null, 0, 0L, null, 0L, message.g(), 0L, null, null, 0, null, 0, 0, null, 0L, 0L, null, false, 0L, null, 0, null, null, null, null, null, null, null, null, 536870879);
List emptyList = n.emptyList();
User e = message.e();
long id2 = e != null ? e.getId() : 0L;
User e2 = message.e();
String str = (e2 == null || (username = e2.getUsername()) == null) ? "" : username;
User e3 = message.e();
Integer intOrNull = (e3 == null || (f = e3.f()) == null) ? null : s.toIntOrNull(f);
User e4 = message.e();
String str2 = (e4 == null || (a = e4.a()) == null || (a2 = a.a()) == null) ? "" : a2;
GuildMember q = message.q();
String b4 = q != null ? q.b() : null;
long j = this.guildId;
String str3 = this.guildName;
String str4 = this.guildIcon;
List<Sticker> A = message.A();
return new NotificationData(TYPE_MESSAGE_CREATE, o, b2, h, intValue, i, a4, emptyList, id2, str, intOrNull, str2, b4, -1, null, j, str3, str4, -1, null, -1L, null, null, A != null ? (Sticker) u.firstOrNull((List<? extends Object>) A) : null, null, null, null, null, null, null, null, null, null, null);
}
public final List<Long> getAckChannelIds() {
return this.ackChannelIds;
}
@RequiresApi(24)
@SuppressLint({"UnspecifiedImmutableFlag"})
public final NotificationCompat.Action getCallAction(Context context, boolean z2) {
m.checkNotNullParameter(context, "ctx");
if (!m.areEqual(this.type, TYPE_CALL_RING)) {
return null;
}
PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, addTrackingData(NotificationActions.Companion.callAction(context, this.channel.h(), this.messageId, z2)), PendingIntentExtensionsKt.immutablePendingIntentFlag$default(0, 1, null));
Pair pair = z2 ? d0.o.to(Integer.valueOf((int) R.string.join_call), Integer.valueOf((int) R.color.status_green_600)) : d0.o.to(Integer.valueOf((int) R.string.decline), Integer.valueOf((int) R.color.status_red_500));
int intValue = ((Number) pair.component1()).intValue();
int intValue2 = ((Number) pair.component2()).intValue();
StringBuilder R = a.R("**");
R.append(b.h(context, intValue, new Object[0], null, 4));
R.append("**");
return new NotificationCompat.Action.Builder(z2 ? R.drawable.ic_call_24dp : R.drawable.ic_call_disconnect_24dp, b.g(R.toString(), new Object[0], new NotificationData$getCallAction$coloredString$1(context, intValue2)), broadcast).build();
}
public final long getChannelId() {
return this.channel.h();
}
public final CharSequence getContent(Context context) {
CharSequence charSequence;
GuildScheduledEventEntityType guildScheduledEventEntityType;
m.checkNotNullParameter(context, "context");
String str = this.type;
String str2 = "";
switch (str.hashCode()) {
case -1502317553:
if (!str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
return str2;
}
String str3 = this.subtitleResName;
if (str3 != null) {
String str4 = this.subtitle;
if (str4 != null) {
str2 = str4;
}
return resNameToString(context, str3, str2);
}
charSequence = this.subtitle;
if (charSequence == null) {
return str2;
}
break;
case -1489275252:
if (!str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE) || (guildScheduledEventEntityType = this.guildScheduledEventEntityType) == null) {
return str2;
}
int ordinal = guildScheduledEventEntityType.ordinal();
return (ordinal == 1 || ordinal == 2) ? b.h(context, R.string.guild_scheduled_event_stage_start_body, new Object[]{this.stageInstanceTopic, this.userUsername}, null, 4) : ordinal != 3 ? str2 : b.h(context, R.string.guild_scheduled_event_external_start_body, new Object[]{this.stageInstanceTopic}, null, 4);
case -1327124998:
if (!str.equals(TYPE_RELATIONSHIP_ADD)) {
return str2;
}
int i = this.relationshipType;
return i != 1 ? i != 3 ? str2 : b.h(context, R.string.notification_pending_friend_request, new Object[0], null, 4) : b.h(context, R.string.notification_accepted_friend_request, new Object[0], null, 4);
case -1263316859:
return str.equals(TYPE_STAGE_INSTANCE_CREATE) ? b.h(context, R.string.stage_start_push_notification_body, new Object[]{this.userUsername, this.stageInstanceTopic}, null, 4) : str2;
case -1237752112:
return str.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE) ? b.h(context, R.string.game_library_notification_game_installed_body, new Object[]{this.applicationName}, null, 4) : str2;
case 974015250:
return (!str.equals(TYPE_ACTIVITY_START) || this.activityType != 0) ? str2 : b.h(context, R.string.notification_body_start_game, new Object[]{this.userUsername, this.activityName}, null, 4);
case 998188116:
if (!str.equals(TYPE_MESSAGE_CREATE)) {
return str2;
}
int A = this.channel.A();
if (A != 0) {
if (A != 1) {
if (A != 2) {
if (A != 3) {
if (A != 5) {
switch (A) {
case 10:
case 11:
case 12:
break;
default:
return str2;
}
}
}
}
}
if (this.messageActivityType == MessageActivityType.JOIN) {
return b.h(context, R.string.notification_message_create_dm_activity_join, new Object[]{this.userUsername, this.messageApplicationName}, null, 4);
}
Sticker sticker = this.sticker;
if (sticker != null) {
return b.h(context, R.string.sticker_notification_body, new Object[]{sticker.h()}, null, 4);
}
String str5 = this.messageContent;
if (str5 != null) {
charSequence = b.l(str5, new Object[0], null, 2);
break;
}
return null;
}
if (this.messageType == 7) {
return b.h(context, MessageUtils.INSTANCE.getSystemMessageUserJoin(context, this.messageId), new Object[]{this.userUsername}, null, 4);
}
if (this.messageActivityType == MessageActivityType.JOIN) {
return b.h(context, R.string.notification_message_create_guild_activity_join, new Object[]{this.userUsername, this.messageApplicationName}, null, 4);
}
Sticker sticker2 = this.sticker;
if (sticker2 != null) {
return b.h(context, R.string.sticker_notification_body, new Object[]{sticker2.h()}, null, 4);
}
String str6 = this.messageContent;
if (str6 != null) {
charSequence = b.l(str6, new Object[0], null, 2);
break;
}
return null;
case 1770025841:
return str.equals(TYPE_CALL_RING) ? b.l(b.h(context, R.string.overlay_friend_calling, new Object[]{a.H(a.R("**"), this.userUsername, "**")}, null, 4), new Object[0], null, 2) : str2;
default:
return str2;
}
return charSequence;
}
@SuppressLint({"UnspecifiedImmutableFlag"})
public final PendingIntent getContentIntent(Context context) {
m.checkNotNullParameter(context, "context");
Intent contentIntentInternal = getContentIntentInternal();
contentIntentInternal.putExtra("com.discord.intent.ORIGIN_SOURCE", "com.discord.intent.ORIGIN_NOTIF");
contentIntentInternal.setClass(context, AppActivity.Main.class);
PendingIntent activity = PendingIntent.getActivity(context, 0, addTrackingData(contentIntentInternal), PendingIntentExtensionsKt.immutablePendingIntentFlag(134217728));
m.checkNotNullExpressionValue(activity, "PendingIntent.getActivit…LAG_UPDATE_CURRENT)\n )");
return activity;
}
@SuppressLint({"UnspecifiedImmutableFlag"})
public final PendingIntent getContentIntentInApp(Context context) {
m.checkNotNullParameter(context, "context");
Intent contentIntentInternal = getContentIntentInternal();
contentIntentInternal.putExtra("com.discord.intent.ORIGIN_SOURCE", "com.discord.intent.ORIGIN_NOTIF_INAPP");
contentIntentInternal.setClass(context, AppActivity.Main.class);
PendingIntent activity = PendingIntent.getActivity(context, 0, addTrackingData(contentIntentInternal), PendingIntentExtensionsKt.immutablePendingIntentFlag(134217728));
m.checkNotNullExpressionValue(activity, "PendingIntent.getActivit…LAG_UPDATE_CURRENT)\n )");
return activity;
}
public final CharSequence getConversationTitle(Context context) {
m.checkNotNullParameter(context, "context");
String str = this.type;
if (str.hashCode() != 998188116 || !str.equals(TYPE_MESSAGE_CREATE)) {
return null;
}
int A = this.channel.A();
if (!(A == 0 || A == 5 || A == 2)) {
if (A == 3) {
return ChannelUtils.e(this.channel, context, false, 2);
}
switch (A) {
case 10:
case 11:
case 12:
break;
default:
return null;
}
}
return b.l(this.guildName + " _" + ChannelUtils.e(this.channel, context, false, 2) + '_', new Object[0], null, 2);
}
@SuppressLint({"UnspecifiedImmutableFlag"})
public final PendingIntent getDeleteIntent(Context context) {
m.checkNotNullParameter(context, "context");
PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, NotificationActions.Companion.delete(context, this.channel.h()), PendingIntentExtensionsKt.immutablePendingIntentFlag(134217728));
m.checkNotNullExpressionValue(broadcast, "PendingIntent.getBroadca…LAG_UPDATE_CURRENT)\n )");
return broadcast;
}
@RequiresApi(24)
@SuppressLint({"UnspecifiedImmutableFlag"})
public final NotificationCompat.Action getDirectReplyAction(Context context, Set<Long> set) {
m.checkNotNullParameter(context, "ctx");
m.checkNotNullParameter(set, "deniedChannels");
if ((!m.areEqual(this.type, TYPE_MESSAGE_CREATE)) || set.contains(Long.valueOf(this.channel.h()))) {
return null;
}
RemoteInput build = new RemoteInput.Builder("discord_notif_text_input").setLabel(b.h(context, R.string.send_message, new Object[0], null, 4)).build();
m.checkNotNullExpressionValue(build, "RemoteInput.Builder(Inte…essage))\n .build()");
return new NotificationCompat.Action.Builder((int) R.drawable.ic_send_white_24dp, b.h(context, R.string.notification_reply, new Object[0], null, 4), PendingIntent.getBroadcast(context, (int) this.channel.h(), addTrackingData(NotificationActions.Companion.directReply(context, this.channel.h(), getTitle(context))), PendingIntentExtensionsKt.mutablePendingIntentFlag(134217728))).addRemoteInput(build).setAllowGeneratedReplies(true).build();
}
@SuppressLint({"UnspecifiedImmutableFlag"})
public final PendingIntent getFullScreenIntent(Context context) {
m.checkNotNullParameter(context, "context");
if (!m.areEqual(getNotificationCategory(), NotificationCompat.CATEGORY_CALL)) {
return null;
}
Intent intent = new Intent(context, AppActivity.IncomingCall.class);
intent.addFlags(268435456);
return PendingIntent.getActivity(context, 0, addTrackingData(intent), PendingIntentExtensionsKt.immutablePendingIntentFlag(134217728));
}
public final String getGroupKey() {
StringBuilder R = a.R(GROUP_KEY_PREFIX);
R.append(this.type);
return R.toString();
}
public final long getGuildId() {
return this.guildId;
}
/* JADX WARN: Removed duplicated region for block: B:20:0x004c */
/* JADX WARN: Removed duplicated region for block: B:29:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:34:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:37:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final String getIconUrl() {
String str;
String str2 = this.type;
switch (str2.hashCode()) {
case -1489275252:
if (!str2.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
return "";
}
str = IconUtils.getForGuild$default(Long.valueOf(this.guildId), this.guildIcon, "", false, null, 24, null);
if (str == null) {
return "";
}
return str;
case -1327124998:
if (!str2.equals(TYPE_RELATIONSHIP_ADD)) {
return "";
}
String str3 = this.applicationIcon;
return str3 != null ? IconUtils.getApplicationIcon$default(this.applicationId, str3, 0, 4, (Object) null) : "";
case -1263316859:
if (!str2.equals(TYPE_STAGE_INSTANCE_CREATE)) {
return "";
}
str = IconUtils.getForGuild$default(Long.valueOf(this.guildId), this.guildIcon, "", false, null, 24, null);
if (str == null) {
}
return str;
case -1237752112:
if (!str2.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE)) {
return "";
}
String str32 = this.applicationIcon;
if (str32 != null) {
}
break;
case 974015250:
if (!str2.equals(TYPE_ACTIVITY_START)) {
return "";
}
String str322 = this.applicationIcon;
if (str322 != null) {
}
break;
case 998188116:
if (!str2.equals(TYPE_MESSAGE_CREATE)) {
return "";
}
str = getIconUrlForChannel();
if (str == null) {
return "";
}
return str;
case 1770025841:
if (!str2.equals(TYPE_CALL_RING)) {
return "";
}
str = getIconUrlForChannel();
if (str == null) {
}
return str;
default:
return "";
}
}
public final String getIconUrlForAvatar() {
String iconUrlForGuildMember = getIconUrlForGuildMember();
return iconUrlForGuildMember != null ? iconUrlForGuildMember : getIconUrlForUser();
}
public final String getIconUrlForUser() {
return IconUtils.getForUser$default(Long.valueOf(this.userId), this.userAvatar, this.userDiscriminator, false, null, 24, null);
}
public final String getKey() {
GuildScheduledEventEntityType guildScheduledEventEntityType;
String str = this.type;
switch (str.hashCode()) {
case -1502317553:
if (!str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
return "";
}
return this.type + this.deeplink;
case -1489275252:
if (!str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE) || (guildScheduledEventEntityType = this.guildScheduledEventEntityType) == null) {
return "";
}
int ordinal = guildScheduledEventEntityType.ordinal();
if (ordinal == 1 || ordinal == 2) {
return this.type + this.channel.h();
} else if (ordinal != 3) {
return "";
} else {
return this.type + this.guildId;
}
case -1327124998:
if (!str.equals(TYPE_RELATIONSHIP_ADD)) {
return "";
}
NotificationType notificationType = this.notificationType;
if (notificationType != null && notificationType.ordinal() == 0) {
return this.type + this.notificationType;
}
return this.type + this.userId;
case -1263316859:
if (!str.equals(TYPE_STAGE_INSTANCE_CREATE)) {
return "";
}
break;
case -1237752112:
if (!str.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE)) {
return "";
}
return this.type + this.applicationId;
case 974015250:
if (!str.equals(TYPE_ACTIVITY_START)) {
return "";
}
return this.type + this.activityType + this.activityName;
case 998188116:
if (!str.equals(TYPE_MESSAGE_CREATE)) {
return "";
}
break;
case 1770025841:
if (!str.equals(TYPE_CALL_RING)) {
return "";
}
break;
default:
return "";
}
return this.type + this.channel.h();
}
@RequiresApi(24)
@SuppressLint({"UnspecifiedImmutableFlag"})
public final NotificationCompat.Action getMarkAsReadAction(Context context) {
m.checkNotNullParameter(context, "ctx");
if (!m.areEqual(this.type, TYPE_MESSAGE_CREATE)) {
return null;
}
return new NotificationCompat.Action.Builder((int) R.drawable.ic_check_grey_24dp, b.h(context, R.string.mark_as_read, new Object[0], null, 4), PendingIntent.getBroadcast(context, 0, addTrackingData(NotificationActions.Companion.markAsRead(context, this.channel.h(), this.messageId)), PendingIntentExtensionsKt.immutablePendingIntentFlag$default(0, 1, null))).build();
}
public final long getMessageId() {
return this.messageId;
}
public final long getMessageIdTimestamp() {
return (this.messageId >>> 22) + SnowflakeUtils.DISCORD_EPOCH;
}
/* JADX WARN: Removed duplicated region for block: B:20:0x004c A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:21:0x004f A[ORIG_RETURN, RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final String getNotificationCategory() {
String str = this.type;
switch (str.hashCode()) {
case -1502317553:
return str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT) ? NotificationCompat.CATEGORY_SOCIAL : NotificationCompat.CATEGORY_MESSAGE;
case -1489275252:
if (str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
}
break;
case -1327124998:
if (str.equals(TYPE_RELATIONSHIP_ADD)) {
}
break;
case -1263316859:
if (str.equals(TYPE_STAGE_INSTANCE_CREATE)) {
}
break;
case -1237752112:
if (str.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE)) {
return "progress";
}
break;
case 974015250:
if (str.equals(TYPE_ACTIVITY_START)) {
}
break;
case 1770025841:
if (str.equals(TYPE_CALL_RING)) {
return NotificationCompat.CATEGORY_CALL;
}
break;
}
}
public final String getNotificationChannelId() {
String str = this.type;
switch (str.hashCode()) {
case -1502317553:
if (str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
String str2 = this.notificationChannel;
return str2 != null ? str2 : NotificationClient.NOTIF_GENERAL;
}
break;
case -1489275252:
if (str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
return NotificationClient.NOTIF_GUILD_SCHEDULED_EVENT_START;
}
break;
case -1263316859:
if (str.equals(TYPE_STAGE_INSTANCE_CREATE)) {
return NotificationClient.NOTIF_CHANNEL_STAGE_START;
}
break;
case 998188116:
if (str.equals(TYPE_MESSAGE_CREATE)) {
int A = this.channel.A();
return (A == 1 || A == 3) ? NotificationClient.NOTIF_CHANNEL_MESSAGES_DIRECT : NotificationClient.NOTIF_CHANNEL_MESSAGES;
}
break;
case 1770025841:
if (str.equals(TYPE_CALL_RING)) {
return NotificationClient.NOTIF_CHANNEL_CALLS;
}
break;
}
return NotificationClient.NOTIF_CHANNEL_SOCIAL;
}
/* JADX WARN: Removed duplicated region for block: B:15:0x0042 A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:20:0x0055 A[ORIG_RETURN, RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final int getNotificationPriority() {
String notificationChannelId = getNotificationChannelId();
switch (notificationChannelId.hashCode()) {
case -1917463435:
return notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_MESSAGES_DIRECT) ? 1 : -1;
case -1813183603:
notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_SOCIAL);
case -1241096946:
if (notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_STAGE_START)) {
return 0;
}
break;
case -397449876:
if (notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_MESSAGES)) {
}
break;
case 64872885:
if (notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_CALLS)) {
return 2;
}
break;
case 526428889:
if (notificationChannelId.equals(NotificationClient.NOTIF_CHANNEL_MEDIA_CONNECTIONS)) {
return 2;
}
break;
case 803834207:
if (notificationChannelId.equals(NotificationClient.NOTIF_GUILD_SCHEDULED_EVENT_START)) {
}
break;
case 1584505032:
notificationChannelId.equals(NotificationClient.NOTIF_GENERAL);
}
}
public final Uri getNotificationSound(Context context) {
m.checkNotNullParameter(context, "context");
String str = this.type;
if (str.hashCode() != 1770025841 || !str.equals(TYPE_CALL_RING)) {
return null;
}
StringBuilder R = a.R("android.resource://");
R.append(context.getPackageName() + MentionUtilsKt.SLASH_CHAR + AppSound.Companion.getSOUND_CALL_RINGING().getResId());
String sb = R.toString();
m.checkNotNullExpressionValue(sb, "StringBuilder()\n …)\n .toString()");
return Uri.parse(sb);
}
public final Person getSender(Context context) {
String replaceAfterLast$default;
MessageActivityType messageActivityType;
m.checkNotNullParameter(context, "context");
IconCompat iconCompat = null;
boolean z2 = false;
CharSequence h = (!m.areEqual(this.type, TYPE_MESSAGE_CREATE) || this.messageType == 7 || (messageActivityType = this.messageActivityType) == MessageActivityType.SPECTATE || messageActivityType == MessageActivityType.JOIN) ? b.h(context, R.string.discord, new Object[0], null, 4) : this.userUsername;
String valueOf = String.valueOf(this.userId);
String str = this.subtitle;
if (!(str == null || h == null)) {
if (this.messageType == 19 && str.length() > 11) {
String str2 = this.subtitle;
Objects.requireNonNull(str2, "null cannot be cast to non-null type java.lang.String");
String substring = str2.substring(0, 11);
m.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
if (m.areEqual(substring, REPLYING_TO_UNTRANSLATED)) {
StringBuilder R = a.R("<b>");
R.append(Html.escapeHtml(h));
R.append("</b> ");
String str3 = this.subtitle;
Objects.requireNonNull(str3, "null cannot be cast to non-null type java.lang.String");
String substring2 = str3.substring(0, 11);
m.checkNotNullExpressionValue(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
R.append(Html.escapeHtml(substring2));
R.append("<b>");
String str4 = this.subtitle;
Objects.requireNonNull(str4, "null cannot be cast to non-null type java.lang.String");
String substring3 = str4.substring(11);
m.checkNotNullExpressionValue(substring3, "(this as java.lang.String).substring(startIndex)");
R.append(Html.escapeHtml(substring3));
R.append("</b>");
h = Html.fromHtml(R.toString());
StringBuilder R2 = a.R(valueOf);
R2.append(this.subtitle);
valueOf = R2.toString();
}
}
StringBuilder R3 = a.R("<b>");
R3.append(Html.escapeHtml(h));
R3.append("</b> ");
R3.append(Html.escapeHtml(this.subtitle));
h = Html.fromHtml(R3.toString());
StringBuilder R22 = a.R(valueOf);
R22.append(this.subtitle);
valueOf = R22.toString();
}
String forUser$default = IconUtils.getForUser$default(Long.valueOf(this.userId), this.userAvatar, null, false, null, 28, null);
if (!(forUser$default == null || (replaceAfterLast$default = w.replaceAfterLast$default(forUser$default, '.', "jpg", null, 4, null)) == null)) {
iconCompat = IconCompat.createWithContentUri(replaceAfterLast$default);
}
Person.Builder icon = new Person.Builder().setName(h).setKey(valueOf).setIcon(iconCompat);
if (this.relationshipType == 1) {
z2 = true;
}
Person build = icon.setImportant(z2).build();
m.checkNotNullExpressionValue(build, "Person.Builder()\n …_FRIEND)\n .build()");
return build;
}
public final boolean getShouldGroup() {
String str = this.type;
int hashCode = str.hashCode();
return hashCode == 974015250 ? str.equals(TYPE_ACTIVITY_START) : !(hashCode != 998188116 || !str.equals(TYPE_MESSAGE_CREATE));
}
public final boolean getShouldUseBigText() {
String str = this.type;
int hashCode = str.hashCode();
return hashCode == -1489275252 ? str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE) : !(hashCode != -1263316859 || !str.equals(TYPE_STAGE_INSTANCE_CREATE));
}
public final int getSmallIcon() {
String str = this.type;
int hashCode = str.hashCode();
if (hashCode != -1327124998) {
if (hashCode != 998188116) {
if (hashCode == 1770025841 && str.equals(TYPE_CALL_RING)) {
return R.drawable.ic_notification_call_24dp;
}
} else if (str.equals(TYPE_MESSAGE_CREATE)) {
return R.drawable.ic_notification_message_24dp;
}
} else if (str.equals(TYPE_RELATIONSHIP_ADD)) {
return R.drawable.ic_notification_friends_24dp;
}
return R.drawable.ic_notification_24dp;
}
public final Sticker getSticker() {
return this.sticker;
}
@RequiresApi(24)
@SuppressLint({"UnspecifiedImmutableFlag"})
public final NotificationCompat.Action getTimedMute(Context context, Clock clock, int i) {
m.checkNotNullParameter(context, "ctx");
m.checkNotNullParameter(clock, "clock");
if ((!m.areEqual(this.type, TYPE_MESSAGE_CREATE)) || i < 2) {
return null;
}
return new NotificationCompat.Action.Builder((int) R.drawable.ic_notifications_off_grey_24dp, b.h(context, R.string.notification_mute_1_hour, new Object[0], null, 4), PendingIntent.getBroadcast(context, 0, addTrackingData(NotificationActions.Companion.timedMute(context, this.guildId, this.channel.h(), clock.currentTimeMillis() + 3600000)), PendingIntentExtensionsKt.immutablePendingIntentFlag$default(0, 1, null))).build();
}
public final CharSequence getTitle(Context context) {
String str;
GuildScheduledEventEntityType guildScheduledEventEntityType;
m.checkNotNullParameter(context, "context");
String str2 = this.type;
String str3 = "";
switch (str2.hashCode()) {
case -1502317553:
if (!str2.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
return str3;
}
String str4 = this.titleResName;
if (str4 != null) {
String str5 = this.title;
if (str5 != null) {
str3 = str5;
}
return resNameToString(context, str4, str3);
}
str = this.title;
if (str == null) {
return str3;
}
break;
case -1489275252:
if (!str2.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE) || (guildScheduledEventEntityType = this.guildScheduledEventEntityType) == null) {
return str3;
}
int ordinal = guildScheduledEventEntityType.ordinal();
return (ordinal == 1 || ordinal == 2 || ordinal == 3) ? b.h(context, R.string.guild_scheduled_event_stage_start_title, new Object[]{this.guildName}, null, 4) : str3;
case -1327124998:
if (!str2.equals(TYPE_RELATIONSHIP_ADD)) {
return str3;
}
if ((this.notificationType != NotificationType.Reminder || (str = this.title) == null) && (str = this.userUsername) == null) {
return str3;
}
break;
case -1263316859:
return str2.equals(TYPE_STAGE_INSTANCE_CREATE) ? b.h(context, R.string.stage_start_push_notification_title, new Object[]{this.guildName}, null, 4) : str3;
case -1237752112:
return str2.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE) ? b.h(context, R.string.game_library_notification_game_installed_title, new Object[0], null, 4) : str3;
case 974015250:
return (!str2.equals(TYPE_ACTIVITY_START) || this.activityType != 0) ? str3 : b.h(context, R.string.notification_title_start_game, new Object[0], null, 4);
case 998188116:
if (!str2.equals(TYPE_MESSAGE_CREATE)) {
return str3;
}
int A = this.channel.A();
if (A != 0) {
if (A == 1) {
str = this.userUsername;
if (str == null) {
return str3;
}
} else if (A != 2) {
if (A == 3) {
return ChannelUtils.e(this.channel, context, false, 2);
}
if (A != 5) {
switch (A) {
case 10:
case 11:
case 12:
break;
default:
return str3;
}
}
}
}
return b.l(this.guildName + " _" + ChannelUtils.e(this.channel, context, false, 2) + '_', new Object[0], null, 2);
case 1770025841:
return str2.equals(TYPE_CALL_RING) ? this.channel.A() != 1 ? ChannelUtils.c(this.channel) : b.h(context, R.string.incoming_call, new Object[0], null, 4) : str3;
default:
return str3;
}
return str;
}
public final String getType() {
return this.type;
}
public final boolean isGroupConversation() {
return this.isGroupConversation;
}
public final boolean isValid() {
GuildScheduledEventEntityType guildScheduledEventEntityType;
String str = this.type;
switch (str.hashCode()) {
case -1502317553:
if (!str.equals(TYPE_GENERIC_PUSH_NOTIFICATION_SENT)) {
return false;
}
break;
case -1489275252:
if (!str.equals(TYPE_GUILD_SCHEDULED_EVENT_UPDATE) || (guildScheduledEventEntityType = this.guildScheduledEventEntityType) == null) {
return false;
}
int ordinal = guildScheduledEventEntityType.ordinal();
if (ordinal != 1 && ordinal != 2 && ordinal != 3) {
return false;
}
break;
case -1327124998:
if (!str.equals(TYPE_RELATIONSHIP_ADD)) {
return false;
}
break;
case -1263316859:
if (!str.equals(TYPE_STAGE_INSTANCE_CREATE)) {
return false;
}
break;
case -1237752112:
if (!str.equals(TYPE_APPLICATION_LIBRARY_INSTALL_COMPLETE)) {
return false;
}
break;
case 974015250:
if (!str.equals(TYPE_ACTIVITY_START) || this.activityType == 1) {
return false;
}
break;
case 998188116:
if (!str.equals(TYPE_MESSAGE_CREATE)) {
return false;
}
break;
case 1770025841:
if (!str.equals(TYPE_CALL_RING)) {
return false;
}
break;
default:
return false;
}
return true;
}
}