package com.discord.utilities.fcm; import android.annotation.SuppressLint; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; 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 c.a.l.b; import c.d.b.a.a; import com.airbnb.lottie.parser.AnimatableValueParser; import com.discord.api.application.Application; import com.discord.api.channel.Channel; 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.nullserializable.NullSerializable; import com.discord.utilities.dsti.StickerUtils; 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.time.Clock; import d0.g0.s; import d0.g0.t; import d0.g0.w; 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 */ 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_MESSAGE_CREATE = "MESSAGE_CREATE"; public static final String TYPE_RELATIONSHIP_ADD = "RELATIONSHIP_ADD"; public static final int UNSET_INT = -1; public static final long UNSET_LONG = -1; private final List 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 guildIcon; private final long guildId; private final String guildName; 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 int relationshipType; private final Sticker sticker; private final String subtitle; private final String type; private final String userAvatar; private final long userId; private final String userUsername; /* compiled from: NotificationData.kt */ 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 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 map, String str) { long j = -1; if (intent != null) { j = intent.getLongExtra(str, -1); } if (j >= 0) { map.put(str, Long.valueOf(j)); } } private final void copyStringIntoMap(Intent intent, Map 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 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 buildTrackingData(Intent intent) { String stringExtra; HashMap hashMap = new HashMap(); copyStringIntoMap(intent, hashMap, "notif_type"); copyLongIntoMap(intent, hashMap, "notif_user_id"); copyLongIntoMap(intent, hashMap, "message_id"); copyLongIntoMap(intent, hashMap, "guild_id"); copyLongIntoMap(intent, hashMap, "channel_id"); copyIntIntoMap(intent, hashMap, "message_type"); copyIntIntoMap(intent, hashMap, "channel_type"); copyIntIntoMap(intent, hashMap, "rel_type"); copyIntIntoMap(intent, hashMap, "activity_type"); copyStringIntoMap(intent, hashMap, "activity_name"); if (!(intent == null || (stringExtra = intent.getStringExtra("com.discord.intent.ORIGIN_SOURCE")) == null)) { hashMap.put("notif_in_app", Boolean.valueOf(t.equals(stringExtra, "com.discord.intent.ORIGIN_NOTIF_INAPP", true))); } return hashMap; } } /* compiled from: NotificationData.kt */ public static final class DisplayPayload { private NotificationData data; private final LinkedHashMap extras; /* renamed from: id reason: collision with root package name */ private final int f2123id; private boolean ignoreNextClearForAck; public DisplayPayload() { this(new NotificationData()); } public DisplayPayload(NotificationData notificationData) { m.checkNotNullParameter(notificationData, "data"); this.data = notificationData; this.f2123id = new Random().nextInt(Integer.MAX_VALUE); this.extras = new LinkedHashMap<>(); } private final void trimExtrasWhenOversized(int i) { if (this.extras.size() >= i) { Set> entrySet = this.extras.entrySet(); m.checkNotNullExpressionValue(entrySet, "extras\n .entries"); List drop = u.drop(entrySet, this.extras.size() - (i / 2)); LinkedHashMap linkedHashMap = new LinkedHashMap(a.x(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 getExtras() { Collection values; values = this.extras.values(); m.checkNotNullExpressionValue(values, "extras.values"); return u.toList(values); } public final int getId() { return this.f2123id; } public final boolean getIgnoreNextClearForAck() { return this.ignoreNextClearForAck; } public final void setData(NotificationData notificationData) { m.checkNotNullParameter(notificationData, ""); 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(); } } } public NotificationData() { this(new HashMap()); } public NotificationData(String str, long j, MessageActivityType messageActivityType, String str2, int i, String str3, Channel channel, List list, long j2, String str4, String str5, int i2, long j3, String str6, String str7, int i3, String str8, long j4, String str9, String str10, Sticker sticker, String str11) { 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.userAvatar = str5; this.relationshipType = i2; this.guildName = str6; this.guildIcon = str7; this.activityType = i3; this.activityName = str8; this.applicationId = j4; this.applicationName = str9; this.applicationIcon = str10; this.sticker = sticker; this.subtitle = str11; Long valueOf = Long.valueOf(j3); boolean z2 = false; long j5 = -1; valueOf = (valueOf.longValue() > -1 ? 1 : (valueOf.longValue() == -1 ? 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, "MESSAGE_CREATE") && (channel.A() == 0 || channel.A() == 3 || channel.A() == 10 || channel.A() == 11 || channel.A() == 12)) { z2 = true; } this.isGroupConversation = z2; } /* JADX WARNING: Illegal instructions before constructor call */ public NotificationData(Map map) { this(r1, r1, r6, r7, r8, r9, r49, r11, r12, r14, r15, r16, r1, r19, r20, r21, r22, (r1 == null || (r1 = s.toLongOrNull(r1)) == null) ? -1 : r1.longValue(), map.get("application_name"), map.get("application_icon"), StickerUtils.INSTANCE.parseFromMessageNotificationJson(map.get("message")), map.get("subtitle")); Long longOrNull; Integer intOrNull; Long longOrNull2; Integer intOrNull2; Long longOrNull3; Long longOrNull4; Long longOrNull5; Integer intOrNull3; Integer intOrNull4; Integer intOrNull5; Long longOrNull6; m.checkNotNullParameter(map, "data"); String str = map.get("type"); str = str == null ? "" : str; String str2 = map.get("message_id"); long longValue = (str2 == null || (longOrNull6 = s.toLongOrNull(str2)) == null) ? -1 : longOrNull6.longValue(); String str3 = map.get("message_activity_type"); String str4 = null; MessageActivityType a = (str3 == null || (intOrNull5 = s.toIntOrNull(str3)) == null) ? null : MessageActivityType.Companion.a(intOrNull5); String str5 = map.get("message_application_name"); String str6 = map.get("message_type_"); int intValue = (str6 == null || (intOrNull4 = s.toIntOrNull(str6)) == null) ? -1 : intOrNull4.intValue(); String str7 = map.get("message_content"); String str8 = map.get("channel_type"); int intValue2 = (str8 == null || (intOrNull3 = s.toIntOrNull(str8)) == null) ? -1 : intOrNull3.intValue(); String str9 = map.get("guild_id"); long longValue2 = (str9 == null || (longOrNull5 = s.toLongOrNull(str9)) == null) ? -1 : longOrNull5.longValue(); String str10 = map.get("channel_name"); str4 = str10 != null ? b.k(a.u("!!", str10, "!!"), new Object[0], null, 2).toString() : str4; String str11 = map.get("channel_id"); Channel channel = new Channel(null, intValue2, longValue2, str4, 0, (str11 == null || (longOrNull4 = s.toLongOrNull(str11)) == null) ? -1 : longOrNull4.longValue(), 0, null, null, 0, null, 0, 0, map.get("channel_icon"), 0, 0, null, false, 0, null, 0, null, map.get("rtc_region"), null, null, null, null, null, null); List access$parseAckChannelIds = Companion.access$parseAckChannelIds(Companion, map.get("channel_ids")); String str12 = map.get("user_id"); long longValue3 = (str12 == null || (longOrNull3 = s.toLongOrNull(str12)) == null) ? -1 : longOrNull3.longValue(); String str13 = map.get("user_username"); String str14 = map.get("user_avatar"); String str15 = map.get("rel_type"); int intValue3 = (str15 == null || (intOrNull2 = s.toIntOrNull(str15)) == null) ? -1 : intOrNull2.intValue(); String str16 = map.get("guild_id"); long longValue4 = (str16 == null || (longOrNull2 = s.toLongOrNull(str16)) == null) ? -1 : longOrNull2.longValue(); String str17 = map.get("guild_name"); String str18 = map.get("guild_icon"); String str19 = map.get("activity_type"); int intValue4 = (str19 == null || (intOrNull = s.toIntOrNull(str19)) == null) ? -1 : intOrNull.intValue(); String str20 = map.get("activity_name"); String str21 = map.get("application_id"); } private final Intent addTrackingData(Intent intent) { Intent putExtra = intent.putExtra("notif_type", this.type).putExtra("notif_user_id", this.userId).putExtra("message_id", this.messageId).putExtra("message_type", this.messageType).putExtra("guild_id", this.guildId).putExtra("channel_id", this.channel.h()).putExtra("channel_type", this.channel.A()).putExtra("rel_type", this.relationshipType).putExtra("activity_type", this.activityType).putExtra("activity_name", this.activityName); m.checkNotNullExpressionValue(putExtra, "intent\n .putExtra…IVITY_NAME, activityName)"); return putExtra; } /* JADX WARNING: Code restructure failed: missing block: B:12:0x0036, code lost: if (r0.equals("RELATIONSHIP_ADD") != false) goto L_0x0038; */ /* JADX WARNING: Code restructure failed: missing block: B:7:0x001c, code lost: if (r0.equals("MESSAGE_CREATE") == false) goto L_0x0061; */ private final Intent getContentIntentInternal() { String str = this.type; int hashCode = str.hashCode(); if (hashCode != -1327124998) { if (hashCode != 974015250) { if (hashCode == 998188116) { } } else if (str.equals("ACTIVITY_START")) { return IntentUtils.RouteBuilders.INSTANCE.selectDirectMessage(this.userId); } return IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null); } return this.channel.A() != 1 ? IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), this.guildId, null, 4, null) : IntentUtils.RouteBuilders.selectChannel$default(this.channel.h(), 0, null, 4, null); } private final String getIconUrlForChannel() { int A = this.channel.A(); if (A != 0) { if (A == 1) { return getIconUrlForUser(); } if (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); } public final NotificationData copyForDirectReply(Message message) { NullSerializable a; String a2; String r; m.checkNotNullParameter(message, "message"); long o = message.o(); MessageActivity a3 = message.a(); MessageActivityType b = a3 != null ? a3.b() : null; Application b2 = message.b(); String g = b2 != null ? b2.g() : null; Integer E = message.E(); m.checkNotNull(E); int intValue = E.intValue(); String i = message.i(); Channel a4 = Channel.a(this.channel, null, 0, 0, null, 0, message.g(), 0, null, null, 0, null, 0, 0, null, 0, 0, null, false, 0, null, 0, null, null, null, null, null, null, null, null, 536870879); List emptyList = n.emptyList(); User e = message.e(); long i2 = e != null ? e.i() : 0; User e2 = message.e(); String str = ""; String str2 = (e2 == null || (r = e2.r()) == null) ? str : r; User e3 = message.e(); if (!(e3 == null || (a = e3.a()) == null || (a2 = a.a()) == null)) { str = a2; } long j = this.guildId; String str3 = this.guildName; String str4 = this.guildIcon; List A = message.A(); return new NotificationData("MESSAGE_CREATE", o, b, g, intValue, i, a4, emptyList, i2, str2, str, -1, j, str3, str4, -1, null, -1, null, null, A != null ? (Sticker) u.firstOrNull((List) A) : null, null); } public final List 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, "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(2131890781, 2131100249) : d0.o.to(2131888047, 2131100324); int intValue = ((Number) pair.component1()).intValue(); int intValue2 = ((Number) pair.component2()).intValue(); StringBuilder L = a.L("**"); L.append(b.g(context, intValue, new Object[0], null, 4)); L.append("**"); return new NotificationCompat.Action.Builder(z2 ? 2131231464 : 2131231465, b.f(L.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; m.checkNotNullParameter(context, "context"); String str = this.type; switch (str.hashCode()) { case -1327124998: if (!str.equals("RELATIONSHIP_ADD")) { return ""; } int i = this.relationshipType; return i != 1 ? i != 3 ? "" : b.g(context, 2131891671, new Object[0], null, 4) : b.g(context, 2131891658, new Object[0], null, 4); case -1237752112: return str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE") ? b.g(context, 2131888919, new Object[]{this.applicationName}, null, 4) : ""; case 974015250: return (!str.equals("ACTIVITY_START") || this.activityType != 0) ? "" : b.g(context, 2131891660, new Object[]{this.userUsername, this.activityName}, null, 4); case 998188116: if (!str.equals("MESSAGE_CREATE")) { return ""; } int A = this.channel.A(); if (A != 0) { if (A == 1 || A == 3) { if (this.messageActivityType == MessageActivityType.JOIN) { return b.g(context, 2131891662, new Object[]{this.userUsername, this.messageApplicationName}, null, 4); } Sticker sticker = this.sticker; if (sticker != null) { return b.g(context, 2131893700, new Object[]{sticker.h()}, null, 4); } String str2 = this.messageContent; if (str2 != null) { charSequence = b.k(str2, new Object[0], null, 2); return charSequence; } return null; } else if (A != 5) { switch (A) { case 10: case 11: case 12: break; default: return ""; } } } if (this.messageType == 7) { return b.g(context, MessageUtils.INSTANCE.getSystemMessageUserJoin(context, this.messageId), new Object[]{this.userUsername}, null, 4); } if (this.messageActivityType == MessageActivityType.JOIN) { return b.g(context, 2131891667, new Object[]{this.userUsername, this.messageApplicationName}, null, 4); } Sticker sticker2 = this.sticker; if (sticker2 != null) { return b.g(context, 2131893700, new Object[]{sticker2.h()}, null, 4); } String str3 = this.messageContent; if (str3 != null) { charSequence = b.k(str3, new Object[0], null, 2); return charSequence; } return null; case 1770025841: return str.equals("CALL_RING") ? b.k(b.g(context, 2131891861, new Object[]{a.D(a.L("**"), this.userUsername, "**")}, null, 4), new Object[0], null, 2) : ""; default: return ""; } } @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("MESSAGE_CREATE")) { return null; } int A = this.channel.A(); if (A != 0) { if (A == 3) { return AnimatableValueParser.A0(this.channel, context, false, 2); } if (A != 5) { switch (A) { case 10: case 11: case 12: break; default: return null; } } } return b.k(this.guildName + " _" + AnimatableValueParser.A0(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 set) { m.checkNotNullParameter(context, "ctx"); m.checkNotNullParameter(set, "deniedChannels"); if ((!m.areEqual(this.type, "MESSAGE_CREATE")) || set.contains(Long.valueOf(this.channel.h()))) { return null; } RemoteInput build = new RemoteInput.Builder("discord_notif_text_input").setLabel(b.g(context, 2131893319, new Object[0], null, 4)).build(); m.checkNotNullExpressionValue(build, "RemoteInput.Builder(Inte…essage))\n .build()"); return new NotificationCompat.Action.Builder(2131231931, b.g(context, 2131891672, 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(), "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 L = a.L("GROUP_"); L.append(this.type); return L.toString(); } public final long getGuildId() { return this.guildId; } /* JADX WARNING: Removed duplicated region for block: B:17:0x0043 */ /* JADX WARNING: Removed duplicated region for block: B:21:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:26:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:8:0x0023 */ public final String getIconUrl() { String str = this.type; switch (str.hashCode()) { case -1327124998: if (!str.equals("RELATIONSHIP_ADD")) { return ""; } String str2 = this.applicationIcon; return str2 != null ? IconUtils.getApplicationIcon$default(this.applicationId, str2, 0, 4, null) : ""; case -1237752112: if (!str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE")) { return ""; } String str2 = this.applicationIcon; if (str2 != null) { } break; case 974015250: if (!str.equals("ACTIVITY_START")) { return ""; } String str2 = this.applicationIcon; if (str2 != null) { } break; case 998188116: if (!str.equals("MESSAGE_CREATE")) { return ""; } String iconUrlForChannel = getIconUrlForChannel(); return iconUrlForChannel == null ? iconUrlForChannel : ""; case 1770025841: if (!str.equals("CALL_RING")) { return ""; } String iconUrlForChannel = getIconUrlForChannel(); if (iconUrlForChannel == null) { } break; default: return ""; } } public final String getIconUrlForUser() { return IconUtils.getForUser$default(Long.valueOf(this.userId), this.userAvatar, null, false, null, 28, null); } /* JADX WARNING: Code restructure failed: missing block: B:17:?, code lost: return r3.type + r3.channel.h(); */ /* JADX WARNING: Code restructure failed: missing block: B:3:0x0011, code lost: if (r0.equals("CALL_RING") != false) goto L_0x001c; */ /* JADX WARNING: Code restructure failed: missing block: B:5:0x001a, code lost: if (r0.equals("MESSAGE_CREATE") != false) goto L_0x001c; */ public final String getKey() { String str = this.type; switch (str.hashCode()) { case -1327124998: if (str.equals("RELATIONSHIP_ADD")) { return this.type + this.userId; } return ""; case -1237752112: if (str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE")) { return this.type + this.applicationId; } return ""; case 974015250: if (str.equals("ACTIVITY_START")) { return this.type + this.activityType + this.activityName; } return ""; case 998188116: break; case 1770025841: break; default: return ""; } } @RequiresApi(24) @SuppressLint({"UnspecifiedImmutableFlag"}) public final NotificationCompat.Action getMarkAsReadAction(Context context) { m.checkNotNullParameter(context, "ctx"); if (!m.areEqual(this.type, "MESSAGE_CREATE")) { return null; } return new NotificationCompat.Action.Builder(2131231521, b.g(context, 2131891073, 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) + 1420070400000L; } /* JADX WARNING: Removed duplicated region for block: B:12:0x0032 A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:13:0x0036 A[ORIG_RETURN, RETURN, SYNTHETIC] */ public final String getNotificationCategory() { String str = this.type; switch (str.hashCode()) { case -1327124998: return str.equals("RELATIONSHIP_ADD") ? "social" : "msg"; case -1237752112: if (str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE")) { return "progress"; } break; case 974015250: if (str.equals("ACTIVITY_START")) { } break; case 1770025841: if (str.equals("CALL_RING")) { return "call"; } break; } } public final String getNotificationChannelId() { String str = this.type; int hashCode = str.hashCode(); if (hashCode != 998188116) { if (hashCode == 1770025841 && str.equals("CALL_RING")) { return "Calls"; } } else if (str.equals("MESSAGE_CREATE")) { int A = this.channel.A(); return (A == 1 || A == 3) ? "DirectMessages" : "Messages"; } return "Social"; } public final int getNotificationPriority() { String notificationChannelId = getNotificationChannelId(); switch (notificationChannelId.hashCode()) { case -1917463435: if (notificationChannelId.equals("DirectMessages")) { return 1; } break; case -1813183603: notificationChannelId.equals("Social"); break; case -397449876: if (notificationChannelId.equals("Messages")) { return 0; } break; case 64872885: if (notificationChannelId.equals("Calls")) { return 2; } break; case 526428889: if (notificationChannelId.equals("Media Connections")) { return 2; } break; } return -1; } public final Uri getNotificationSound(Context context) { m.checkNotNullParameter(context, "context"); String str = this.type; if (str.hashCode() != 1770025841 || !str.equals("CALL_RING")) { return null; } StringBuilder L = a.L("android.resource://"); L.append(context.getPackageName() + '/' + AppSound.Companion.getSOUND_CALL_RINGING().getResId()); String sb = L.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 g = (!m.areEqual(this.type, "MESSAGE_CREATE") || this.messageType == 7 || (messageActivityType = this.messageActivityType) == MessageActivityType.SPECTATE || messageActivityType == MessageActivityType.JOIN) ? b.g(context, 2131888148, new Object[0], null, 4) : this.userUsername; String valueOf = String.valueOf(this.userId); String str = this.subtitle; if (!(str == null || g == 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")) { StringBuilder L = a.L(""); L.append(Html.escapeHtml(g)); L.append(" "); 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)"); L.append(Html.escapeHtml(substring2)); L.append(""); 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)"); L.append(Html.escapeHtml(substring3)); L.append(""); g = Html.fromHtml(L.toString()); StringBuilder L2 = a.L(valueOf); L2.append(this.subtitle); valueOf = L2.toString(); } } StringBuilder L3 = a.L(""); L3.append(Html.escapeHtml(g)); L3.append(" "); L3.append(Html.escapeHtml(this.subtitle)); g = Html.fromHtml(L3.toString()); StringBuilder L2 = a.L(valueOf); L2.append(this.subtitle); valueOf = L2.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(g).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("ACTIVITY_START") : !(hashCode != 998188116 || !str.equals("MESSAGE_CREATE")); } public final int getSmallIcon() { String str = this.type; int hashCode = str.hashCode(); if (hashCode != -1327124998) { if (hashCode != 998188116) { if (hashCode == 1770025841 && str.equals("CALL_RING")) { return 2131231815; } } else if (str.equals("MESSAGE_CREATE")) { return 2131231817; } } else if (str.equals("RELATIONSHIP_ADD")) { return 2131231816; } return 2131231814; } 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, "MESSAGE_CREATE")) || i < 2) { return null; } return new NotificationCompat.Action.Builder(2131231820, b.g(context, 2131891669, 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) { m.checkNotNullParameter(context, "context"); String str = this.type; switch (str.hashCode()) { case -1327124998: return str.equals("RELATIONSHIP_ADD") ? this.userUsername : ""; case -1237752112: return str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE") ? b.g(context, 2131888920, new Object[0], null, 4) : ""; case 974015250: return (!str.equals("ACTIVITY_START") || this.activityType != 0) ? "" : b.g(context, 2131891677, new Object[0], null, 4); case 998188116: if (!str.equals("MESSAGE_CREATE")) { return ""; } int A = this.channel.A(); if (A != 0) { if (A == 1) { return this.userUsername; } if (A == 3) { return AnimatableValueParser.A0(this.channel, context, false, 2); } if (A != 5) { switch (A) { case 10: case 11: case 12: break; default: return ""; } } } return b.k(this.guildName + " _" + AnimatableValueParser.A0(this.channel, context, false, 2) + '_', new Object[0], null, 2); case 1770025841: return str.equals("CALL_RING") ? this.channel.A() != 1 ? AnimatableValueParser.y0(this.channel) : b.g(context, 2131890467, new Object[0], null, 4) : ""; default: return ""; } } public final String getType() { return this.type; } public final boolean isGroupConversation() { return this.isGroupConversation; } public final boolean isValid() { String str = this.type; switch (str.hashCode()) { case -1327124998: if (!str.equals("RELATIONSHIP_ADD")) { return false; } break; case -1237752112: if (!str.equals("APPLICATION_LIBRARY_INSTALL_COMPLETE")) { return false; } break; case 974015250: if (!str.equals("ACTIVITY_START") || this.activityType == 1) { return false; } break; case 998188116: if (!str.equals("MESSAGE_CREATE")) { return false; } break; case 1770025841: if (!str.equals("CALL_RING")) { return false; } break; default: return false; } return true; } }