discord-jadx/app/src/main/java/com/discord/widgets/chat/list/model/WidgetChatListModelMessages...

797 lines
41 KiB
Java

package com.discord.widgets.chat.list.model;
import a0.a.a.b;
import b.d.b.a.a;
import com.discord.api.channel.Channel;
import com.discord.api.channel.ChannelUtils;
import com.discord.api.interaction.Interaction;
import com.discord.api.message.MessageReference;
import com.discord.api.permission.Permission;
import com.discord.api.role.GuildRole;
import com.discord.api.thread.ThreadMetadata;
import com.discord.api.user.User;
import com.discord.api.utcdatetime.UtcDateTime;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.message.Message;
import com.discord.stores.StoreMessageReplies;
import com.discord.stores.StoreMessageState;
import com.discord.stores.StorePermissions;
import com.discord.stores.StoreReadStates;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreThreadMessages;
import com.discord.stores.StoreUserSettings;
import com.discord.utilities.embed.InviteEmbedModel;
import com.discord.utilities.guilds.RoleUtils;
import com.discord.utilities.message.LocalMessageCreatorsKt;
import com.discord.utilities.message.MessageUtils;
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
import com.discord.utilities.permissions.PermissionUtils;
import com.discord.utilities.rx.ObservableCombineLatestOverloadsKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.time.ClockFactory;
import com.discord.utilities.time.TimeUtils;
import com.discord.widgets.botuikit.ComponentChatListState;
import com.discord.widgets.chat.list.ViewThreadsFeatureFlag;
import com.discord.widgets.chat.list.entries.BlockedMessagesEntry;
import com.discord.widgets.chat.list.entries.ChatListEntry;
import com.discord.widgets.chat.list.entries.EphemeralMessageEntry;
import com.discord.widgets.chat.list.entries.MessageEntry;
import com.discord.widgets.chat.list.entries.NewMessagesEntry;
import com.discord.widgets.chat.list.entries.ReactionsEntry;
import com.discord.widgets.chat.list.entries.ThreadStarterDividerEntry;
import com.discord.widgets.chat.list.entries.TimestampEntry;
import com.discord.widgets.chat.list.entries.UploadProgressEntry;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import j0.l.e.k;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import kotlin.Pair;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
/* compiled from: WidgetChatListModelMessages.kt */
public final class WidgetChatListModelMessages {
public static final Companion Companion = new Companion(null);
private static final int MAX_CONCAT_COUNT = 5;
private static final long MESSAGE_CONCAT_TIMESTAMP_DELTA_THRESHOLD = 420000;
private final Map<Long, GuildMember> guildMembers;
private final List<ChatListEntry> items;
private final long newMessagesMarkerMessageId;
private final long newestKnownMessageId;
private final Long newestSentByUserMessageId;
private final long oldestMessageId;
/* compiled from: WidgetChatListModelMessages.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ int access$addBlockedMessage(Companion companion, Items items, Message message, int i, boolean z2) {
return companion.addBlockedMessage(items, message, i, z2);
}
public static final /* synthetic */ Pair access$getThreadStarterMessageAndChannel(Companion companion, Channel channel, Channel channel2, Message message, MessagesWithMetadata messagesWithMetadata) {
return companion.getThreadStarterMessageAndChannel(channel, channel2, message, messagesWithMetadata);
}
public static final /* synthetic */ boolean access$shouldConcatMessage(Companion companion, Items items, Message message, Message message2) {
return companion.shouldConcatMessage(items, message, message2);
}
public static final /* synthetic */ boolean access$tryAddNewMessagesSeparator(Companion companion, Items items, long j, boolean z2, long j2, Channel channel) {
return companion.tryAddNewMessagesSeparator(items, j, z2, j2, channel);
}
public static final /* synthetic */ long access$tryAddTimestamp(Companion companion, Items items, long j, long j2, long j3) {
return companion.tryAddTimestamp(items, j, j2, j3);
}
public static final /* synthetic */ boolean access$willAddTimestamp(Companion companion, long j, long j2) {
return companion.willAddTimestamp(j, j2);
}
private final int addBlockedMessage(Items items, Message message, int i, boolean z2) {
if (i <= 0) {
return i;
}
m.checkNotNull(message);
items.addItem(new BlockedMessagesEntry(message, i, z2));
return 0;
}
private final void enableThreadSpine(List<ChatListEntry> list, int i) {
int size = list.size();
while (i < size) {
list.get(i).setShouldShowThreadSpine(true);
i++;
}
}
public static /* synthetic */ List getMessageItems$default(Companion companion, Channel channel, Map map, Map map2, Map map3, Channel channel2, StoreThreadMessages.ThreadState threadState, Message message, StoreMessageState.State state, Map map4, boolean z2, boolean z3, Long l, boolean z4, boolean z5, boolean z6, long j, boolean z7, Map map5, InviteEmbedModel inviteEmbedModel, boolean z8, int i, Object obj) {
return companion.getMessageItems(channel, map, map2, map3, channel2, threadState, message, state, map4, z2, z3, l, z4, z5, z6, j, z7, map5, inviteEmbedModel, (i & 524288) != 0 ? false : z8);
}
private final Pair<Message, Channel> getThreadStarterMessageAndChannel(Channel channel, Channel channel2, Message message, MessagesWithMetadata messagesWithMetadata) {
Message message2;
Map<Long, StoreMessageReplies.MessageState> parentChannelMessageReplyState = messagesWithMetadata.getParentChannelMessageReplyState();
MessageReference messageReference = message.getMessageReference();
StoreMessageReplies.MessageState messageState = parentChannelMessageReplyState.get(messageReference != null ? messageReference.c() : null);
if (channel == null || !(messageState instanceof StoreMessageReplies.MessageState.Loaded)) {
long h = channel2.h();
User author = message.getAuthor();
m.checkNotNull(author);
message2 = LocalMessageCreatorsKt.createThreadStarterMessageNotFoundMessage(h, author, ClockFactory.get());
channel = channel2;
} else {
message2 = ((StoreMessageReplies.MessageState.Loaded) messageState).getMessage();
}
return new Pair<>(message2, channel);
}
private final Observable<Long> observePermissionsForChannel(StorePermissions storePermissions, Channel channel) {
if (ChannelUtils.A(channel)) {
k kVar = new k(null);
m.checkNotNullExpressionValue(kVar, "Observable.just(null)");
return kVar;
} else if (ChannelUtils.x(channel)) {
k kVar2 = new k(null);
m.checkNotNullExpressionValue(kVar2, "Observable.just(null)");
return kVar2;
} else {
Observable<Long> q = storePermissions.observePermissionsForChannel(channel.h()).q();
m.checkNotNullExpressionValue(q, "observePermissionsForCha… .distinctUntilChanged()");
return q;
}
}
private final Observable<Long> observeUnreadMarkerMessageId(StoreReadStates storeReadStates, long j) {
Observable<R> F = storeReadStates.getUnreadMarker(j).F(WidgetChatListModelMessages$Companion$observeUnreadMarkerMessageId$1.INSTANCE);
m.checkNotNullExpressionValue(F, "getUnreadMarker(channelI… marker.messageId ?: 0L }");
return ObservableExtensionsKt.computationLatest(F).q();
}
private final MessageEntry.WelcomeCtaData parseWelcomeData(Message message, long j, Map<Long, GuildMember> map, Channel channel, Long l) {
Guild guild;
Boolean e;
Integer type = message.getType();
if (type == null || type.intValue() != 7 || (guild = StoreStream.Companion.getGuilds().getGuild(channel.f())) == null) {
return null;
}
boolean z2 = true;
boolean z3 = false;
if (!((guild.getSystemChannelFlags() & 8) == 0)) {
return null;
}
GuildMember guildMember = map.get(Long.valueOf(j));
if (guildMember != null) {
z2 = guildMember.getPending();
}
if (z2 || !PermissionUtils.can(Permission.SEND_MESSAGES, l)) {
return null;
}
User author = message.getAuthor();
if (!(author == null || (e = author.e()) == null)) {
z3 = e.booleanValue();
}
if (z3) {
return null;
}
return new MessageEntry.WelcomeCtaData(MessageUtils.INSTANCE.getWelcomeSticker(j, message.getId()), channel);
}
private final boolean shouldConcatMessage(Items items, Message message, Message message2) {
MGRecyclerDataPayload listItemMostRecentlyAdded;
MGRecyclerDataPayload listItemMostRecentlyAdded2;
MGRecyclerDataPayload listItemMostRecentlyAdded3;
Integer type;
if (message2 == null || message2.isSystemMessage() || message.hasThread() || message2.hasThread()) {
return false;
}
Integer type2 = message.getType();
if ((type2 == null || type2.intValue() != 0) && ((type = message.getType()) == null || type.intValue() != -1)) {
return false;
}
MGRecyclerDataPayload listItemMostRecentlyAdded4 = items.getListItemMostRecentlyAdded();
if ((listItemMostRecentlyAdded4 == null || listItemMostRecentlyAdded4.getType() != 0) && (((listItemMostRecentlyAdded = items.getListItemMostRecentlyAdded()) == null || listItemMostRecentlyAdded.getType() != 1) && (((listItemMostRecentlyAdded2 = items.getListItemMostRecentlyAdded()) == null || listItemMostRecentlyAdded2.getType() != 21) && ((listItemMostRecentlyAdded3 = items.getListItemMostRecentlyAdded()) == null || listItemMostRecentlyAdded3.getType() != 4)))) {
return false;
}
User author = message2.getAuthor();
String str = null;
Long valueOf = author != null ? Long.valueOf(author.i()) : null;
User author2 = message.getAuthor();
if (!m.areEqual(valueOf, author2 != null ? Long.valueOf(author2.i()) : null)) {
return false;
}
UtcDateTime timestamp = message.getTimestamp();
long j = 0;
long g = timestamp != null ? timestamp.g() : 0;
UtcDateTime timestamp2 = message2.getTimestamp();
if (timestamp2 != null) {
j = timestamp2.g();
}
if (g - j >= WidgetChatListModelMessages.MESSAGE_CONCAT_TIMESTAMP_DELTA_THRESHOLD || message2.hasAttachments() || message2.hasEmbeds()) {
return false;
}
List<User> mentions = message2.getMentions();
if (!(mentions == null || mentions.isEmpty()) || message.hasAttachments() || message.hasEmbeds()) {
return false;
}
List<User> mentions2 = message.getMentions();
if (!(mentions2 == null || mentions2.isEmpty()) || items.getConcatCount() >= 5) {
return false;
}
if (message.isWebhook()) {
User author3 = message2.getAuthor();
String r = author3 != null ? author3.r() : null;
User author4 = message.getAuthor();
if (author4 != null) {
str = author4.r();
}
if (!m.areEqual(r, str)) {
return false;
}
}
return true;
}
private final boolean tryAddNewMessagesSeparator(Items items, long j, boolean z2, long j2, Channel channel) {
boolean z3 = true;
boolean z4 = j > 0;
if (z2 || !z4 || MessageUtils.compareMessages(Long.valueOf(j2), Long.valueOf(j)) != 0) {
z3 = false;
}
if (z3) {
items.addItem(new NewMessagesEntry(channel.h(), j2));
}
return z3;
}
private final long tryAddTimestamp(Items items, long j, long j2, long j3) {
if (!willAddTimestamp(j2, j3)) {
return j3;
}
items.addItem(new TimestampEntry(j, j2));
Calendar calendar = TimeUtils.toCalendar(j2);
calendar.add(5, 1);
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
return calendar.getTimeInMillis();
}
private final boolean willAddTimestamp(long j, long j2) {
return j > j2;
}
public final Observable<WidgetChatListModelMessages> get(Channel channel) {
m.checkNotNullParameter(channel, "channel");
Observable<MessagesWithMetadata> observable = MessagesWithMetadata.Companion.get(channel);
StoreStream.Companion companion = StoreStream.Companion;
Observable<Channel> observeChannel = companion.getChannels().observeChannel(channel.r());
Observable<Map<Long, Integer>> observeForType = companion.getUserRelationships().observeForType(2);
Observable<List<Long>> observeExpandedBlockedMessageIds = companion.getChat().observeExpandedBlockedMessageIds();
Observable<Map<Long, GuildMember>> observeGuildMembers = companion.getGuilds().observeGuildMembers(channel.f());
m.checkNotNullExpressionValue(observeGuildMembers, "StoreStream\n …dMembers(channel.guildId)");
Observable<Long> observeUnreadMarkerMessageId = observeUnreadMarkerMessageId(companion.getReadStates(), channel.h());
m.checkNotNullExpressionValue(observeUnreadMarkerMessageId, "StoreStream\n …rkerMessageId(channel.id)");
return ObservableCombineLatestOverloadsKt.combineLatest(observable, observeChannel, observeForType, observeExpandedBlockedMessageIds, observeGuildMembers, observeUnreadMarkerMessageId, companion.getGuilds().observeRoles(channel.f()), observePermissionsForChannel(companion.getPermissions(), channel), StoreUserSettings.observeIsAnimatedEmojisEnabled$default(companion.getUserSettings(), false, 1, null), StoreUserSettings.observeIsAutoPlayGifsEnabled$default(companion.getUserSettings(), false, 1, null), companion.getUserSettings().observeIsRenderEmbedsEnabled(), companion.getUsers().observeMeId(), ComponentChatListState.INSTANCE.observeChatListComponentState(), InviteEmbedModel.Companion.observe$default(InviteEmbedModel.Companion, null, null, null, null, 15, null), new WidgetChatListModelMessages$Companion$get$1(channel));
}
public final List<ChatListEntry> getMessageItems(Channel channel, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, Integer> map3, Channel channel2, StoreThreadMessages.ThreadState threadState, Message message, StoreMessageState.State state, Map<Long, ? extends StoreMessageReplies.MessageState> map4, boolean z2, boolean z3, Long l, boolean z4, boolean z5, boolean z6, long j, boolean z7, Map<Long, ComponentChatListState.ComponentStoreState> map5, InviteEmbedModel inviteEmbedModel, boolean z8) {
ArrayList arrayList;
MessageEntry.ReplyData replyData;
Map<Long, GuildMember> map6;
Long l2;
User c;
User user;
MessageEntry.ReplyData replyData2;
StoreMessageReplies.MessageState messageState;
MessageEntry.ReplyData replyData3;
boolean z9;
MessageEntry messageEntry;
MessageEntry.ReplyData replyData4;
boolean z10;
StoreMessageReplies.MessageState messageState2;
Map<Long, Integer> map7;
Long l3;
m.checkNotNullParameter(channel, "channel");
m.checkNotNullParameter(map, "guildMembers");
m.checkNotNullParameter(map2, "guildRoles");
m.checkNotNullParameter(map3, "blockedRelationships");
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(map4, "repliedMessages");
m.checkNotNullParameter(map5, "componentStoreState");
m.checkNotNullParameter(inviteEmbedModel, "inviteEmbedModel");
Integer type = message.getType();
if (type != null && type.intValue() == 38 && !PermissionUtils.can(1, l)) {
return n.emptyList();
}
ArrayList arrayList2 = new ArrayList();
MessageReference messageReference = message.getMessageReference();
Long l4 = null;
StoreMessageReplies.MessageState messageState3 = (StoreMessageReplies.MessageState) map4.get(messageReference != null ? messageReference.c() : null);
if (messageState3 != null) {
boolean z11 = messageState3 instanceof StoreMessageReplies.MessageState.Loaded;
if (z11) {
z9 = z11;
replyData3 = replyData2;
messageState = messageState3;
arrayList = arrayList2;
Object firstOrNull = u.firstOrNull((List<? extends Object>) getMessageItems$default(this, channel, map, map2, map3, channel2, threadState, ((StoreMessageReplies.MessageState.Loaded) messageState3).getMessage(), state, map4, z2, false, null, false, z5, z6, j, z7, map5, inviteEmbedModel, false, 524288, null));
if (!(firstOrNull instanceof MessageEntry)) {
firstOrNull = null;
}
messageEntry = (MessageEntry) firstOrNull;
} else {
replyData3 = replyData2;
messageState = messageState3;
arrayList = arrayList2;
z9 = z11;
messageEntry = null;
}
if (z9) {
messageState2 = messageState;
User author = ((StoreMessageReplies.MessageState.Loaded) messageState2).getMessage().getAuthor();
if (author != null) {
l3 = Long.valueOf(author.i());
map7 = map3;
} else {
map7 = map3;
l3 = null;
}
z10 = map7.containsKey(l3);
replyData4 = replyData3;
} else {
messageState2 = messageState;
replyData4 = replyData3;
z10 = false;
}
replyData = new MessageEntry.ReplyData(messageState2, messageEntry, z10);
} else {
arrayList = arrayList2;
replyData = null;
}
User author2 = message.getAuthor();
if (author2 != null) {
l2 = Long.valueOf(author2.i());
map6 = map;
} else {
map6 = map;
l2 = null;
}
GuildMember guildMember = map6.get(l2);
List<User> mentions = message.getMentions();
GuildMember guildMember2 = map6.get((mentions == null || (user = (User) u.firstOrNull(mentions)) == null) ? null : Long.valueOf(user.i()));
Map<Long, GuildRole> map8 = RoleUtils.containsRoleMentions(message.getContent()) ? map2 : null;
Map<Long, String> nickOrUsernames = MessageUtils.getNickOrUsernames(message, channel, map6, channel.n());
Interaction interaction = message.getInteraction();
if (!(interaction == null || (c = interaction.c()) == null)) {
l4 = Long.valueOf(c.i());
}
arrayList.add(new MessageEntry(message, state, guildMember, guildMember2, map8, nickOrUsernames, z3, z2, z4, replyData, map6.get(l4), z8, parseWelcomeData(message, j, map, channel, l), l));
int size = arrayList.size();
ChatListEntry.Companion companion = ChatListEntry.Companion;
arrayList.addAll(companion.createEmbedEntries(message, state, z2, z4, z5, z6, channel.f(), z8));
arrayList.addAll(companion.createStickerEntries(message));
arrayList.addAll(companion.createGameInviteEntries(message));
arrayList.addAll(companion.createSpotifyListenTogetherEntries(message));
arrayList.addAll(companion.createInviteEntries(message, inviteEmbedModel));
arrayList.addAll(companion.createGuildTemplateEntries(message));
arrayList.addAll(companion.createGiftEntries(message));
if (z8) {
arrayList.add(new ThreadStarterDividerEntry(channel.h(), message.getId()));
return arrayList;
}
if (z7) {
arrayList.addAll(companion.createBotComponentEntries(message, channel.f(), map5.get(Long.valueOf(message.getId())), z4));
}
boolean z12 = true;
if (!message.getReactionsMap().isEmpty()) {
ThreadMetadata y2 = channel.y();
boolean z13 = y2 == null || !y2.b();
if (!PermissionUtils.can(64, l) || !z13) {
z12 = false;
}
arrayList.add(new ReactionsEntry(message, z13, z12, z4));
}
if (message.getHasLocalUploads() && !message.isFailed()) {
String nonce = message.getNonce();
if (nonce == null) {
nonce = "";
}
arrayList.add(new UploadProgressEntry(nonce, message.getChannelId()));
}
if (ViewThreadsFeatureFlag.Companion.getINSTANCE().isEnabled() && message.hasThread() && channel2 != null) {
enableThreadSpine(arrayList, size);
arrayList.addAll(companion.createThreadEmbedEntries(channel, map, message, channel2, threadState, map2, z4, z6));
}
if (message.isEphemeralMessage() || (message.isInteraction() && message.isFailed())) {
arrayList.add(new EphemeralMessageEntry(message));
}
return arrayList;
}
public final Observable<List<ChatListEntry>> getSingleMessage(Channel channel, long j) {
m.checkNotNullParameter(channel, "channel");
StoreStream.Companion companion = StoreStream.Companion;
Observable<List<ChatListEntry>> c = Observable.c(companion.getMessages().observeMessagesForChannel(channel.h(), j), MessagesWithMetadata.Companion.get(channel), companion.getGuilds().observeGuildMembers(channel.f()), companion.getGuilds().observeRoles(channel.f()), StoreUserSettings.observeIsAnimatedEmojisEnabled$default(companion.getUserSettings(), false, 1, null), StoreUserSettings.observeIsAutoPlayGifsEnabled$default(companion.getUserSettings(), false, 1, null), companion.getUsers().observeMeId(), companion.getUserSettings().observeIsRenderEmbedsEnabled(), InviteEmbedModel.Companion.observe$default(InviteEmbedModel.Companion, null, null, null, null, 15, null), new WidgetChatListModelMessages$Companion$getSingleMessage$1(channel, j));
m.checkNotNullExpressionValue(c, "Observable.combineLatest… ?: emptyList()\n }");
return c;
}
public final List<ChatListEntry> getThreadStarterMessageItems(Channel channel, Channel channel2, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, Integer> map3, Message message, MessagesWithMetadata messagesWithMetadata, boolean z2, boolean z3, boolean z4, long j, boolean z5, Map<Long, ComponentChatListState.ComponentStoreState> map4, InviteEmbedModel inviteEmbedModel) {
m.checkNotNullParameter(channel2, "channel");
m.checkNotNullParameter(map, "guildMembers");
m.checkNotNullParameter(map2, "guildRoles");
m.checkNotNullParameter(map3, "blockedRelationships");
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(messagesWithMetadata, "messagesWithMetadata");
m.checkNotNullParameter(map4, "componentStoreState");
m.checkNotNullParameter(inviteEmbedModel, "inviteEmbedModel");
Pair<Message, Channel> threadStarterMessageAndChannel = getThreadStarterMessageAndChannel(channel, channel2, message, messagesWithMetadata);
Message first = threadStarterMessageAndChannel.getFirst();
return getMessageItems(threadStarterMessageAndChannel.getSecond(), map, map2, map3, null, null, first, messagesWithMetadata.getMessageState().get(Long.valueOf(first.getId())), messagesWithMetadata.getParentChannelMessageReplyState(), false, false, null, z2, z3, z4, j, z5, map4, inviteEmbedModel, true);
}
}
/* compiled from: WidgetChatListModelMessages.kt */
public static final class Items {
private static final Companion Companion = new Companion(null);
@Deprecated
private static final int LIST_CAPACITY_BUFFER = 10;
private int concatCount;
private List<ChatListEntry> items;
private MGRecyclerDataPayload listItemMostRecentlyAdded;
/* compiled from: WidgetChatListModelMessages.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public Items(int i) {
this.items = new ArrayList(i + 10);
}
public final void addItem(ChatListEntry chatListEntry) {
m.checkNotNullParameter(chatListEntry, "item");
this.items.add(chatListEntry);
this.listItemMostRecentlyAdded = chatListEntry;
}
public final void addItems(List<? extends ChatListEntry> list) {
m.checkNotNullParameter(list, "itemList");
if (!list.isEmpty()) {
this.items.addAll(list);
this.listItemMostRecentlyAdded = (MGRecyclerDataPayload) list.get(list.size() - 1);
}
}
public final int getConcatCount() {
return this.concatCount;
}
public final List<ChatListEntry> getItems() {
return this.items;
}
public final MGRecyclerDataPayload getListItemMostRecentlyAdded() {
return this.listItemMostRecentlyAdded;
}
public final void setConcatCount(int i) {
this.concatCount = i;
}
public final void setItems(List<ChatListEntry> list) {
m.checkNotNullParameter(list, "<set-?>");
this.items = list;
}
public final void setListItemMostRecentlyAdded(MGRecyclerDataPayload mGRecyclerDataPayload) {
this.listItemMostRecentlyAdded = mGRecyclerDataPayload;
}
}
/* compiled from: WidgetChatListModelMessages.kt */
public static final class MessagesWithMetadata {
public static final Companion Companion = new Companion(null);
private final Map<Long, StoreMessageReplies.MessageState> messageReplyState;
private final Map<Long, StoreMessageState.State> messageState;
private final Map<Long, Channel> messageThreads;
private final List<Message> messages;
private final Map<Long, StoreMessageReplies.MessageState> parentChannelMessageReplyState;
private final Map<Long, StoreThreadMessages.ThreadState> threadCountsAndLatestMessages;
/* compiled from: WidgetChatListModelMessages.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Observable<MessagesWithMetadata> get(Channel channel) {
m.checkNotNullParameter(channel, "channel");
Observable<R> Y = StoreStream.Companion.getMessages().observeMessagesForChannel(channel.h()).Y(new WidgetChatListModelMessages$MessagesWithMetadata$Companion$get$2(channel));
m.checkNotNullExpressionValue(Y, "StoreStream\n … )\n }");
return Y;
}
public final Observable<MessagesWithMetadata> get(List<Message> list) {
m.checkNotNullParameter(list, "messages");
StoreStream.Companion companion = StoreStream.Companion;
Observable<MessagesWithMetadata> i = Observable.i(companion.getMessageState().getMessageState(), companion.getChannels().observeThreadsFromMessages(list), companion.getThreadMessages().observeThreadCountAndLatestMessage(), new WidgetChatListModelMessages$MessagesWithMetadata$Companion$get$1(list));
m.checkNotNullExpressionValue(i, "Observable\n .… )\n }");
return i;
}
}
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.stores.StoreMessageReplies$MessageState> */
/* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.stores.StoreMessageReplies$MessageState> */
/* JADX WARN: Multi-variable type inference failed */
public MessagesWithMetadata(List<Message> list, Map<Long, StoreMessageState.State> map, Map<Long, Channel> map2, Map<Long, StoreThreadMessages.ThreadState> map3, Map<Long, ? extends StoreMessageReplies.MessageState> map4, Map<Long, ? extends StoreMessageReplies.MessageState> map5) {
m.checkNotNullParameter(list, "messages");
m.checkNotNullParameter(map, "messageState");
m.checkNotNullParameter(map2, "messageThreads");
m.checkNotNullParameter(map3, "threadCountsAndLatestMessages");
m.checkNotNullParameter(map4, "messageReplyState");
m.checkNotNullParameter(map5, "parentChannelMessageReplyState");
this.messages = list;
this.messageState = map;
this.messageThreads = map2;
this.threadCountsAndLatestMessages = map3;
this.messageReplyState = map4;
this.parentChannelMessageReplyState = map5;
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.chat.list.model.WidgetChatListModelMessages$MessagesWithMetadata */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ MessagesWithMetadata copy$default(MessagesWithMetadata messagesWithMetadata, List list, Map map, Map map2, Map map3, Map map4, Map map5, int i, Object obj) {
if ((i & 1) != 0) {
list = messagesWithMetadata.messages;
}
if ((i & 2) != 0) {
map = messagesWithMetadata.messageState;
}
if ((i & 4) != 0) {
map2 = messagesWithMetadata.messageThreads;
}
if ((i & 8) != 0) {
map3 = messagesWithMetadata.threadCountsAndLatestMessages;
}
if ((i & 16) != 0) {
map4 = messagesWithMetadata.messageReplyState;
}
if ((i & 32) != 0) {
map5 = messagesWithMetadata.parentChannelMessageReplyState;
}
return messagesWithMetadata.copy(list, map, map2, map3, map4, map5);
}
public final List<Message> component1() {
return this.messages;
}
public final Map<Long, StoreMessageState.State> component2() {
return this.messageState;
}
public final Map<Long, Channel> component3() {
return this.messageThreads;
}
public final Map<Long, StoreThreadMessages.ThreadState> component4() {
return this.threadCountsAndLatestMessages;
}
public final Map<Long, StoreMessageReplies.MessageState> component5() {
return this.messageReplyState;
}
public final Map<Long, StoreMessageReplies.MessageState> component6() {
return this.parentChannelMessageReplyState;
}
public final MessagesWithMetadata copy(List<Message> list, Map<Long, StoreMessageState.State> map, Map<Long, Channel> map2, Map<Long, StoreThreadMessages.ThreadState> map3, Map<Long, ? extends StoreMessageReplies.MessageState> map4, Map<Long, ? extends StoreMessageReplies.MessageState> map5) {
m.checkNotNullParameter(list, "messages");
m.checkNotNullParameter(map, "messageState");
m.checkNotNullParameter(map2, "messageThreads");
m.checkNotNullParameter(map3, "threadCountsAndLatestMessages");
m.checkNotNullParameter(map4, "messageReplyState");
m.checkNotNullParameter(map5, "parentChannelMessageReplyState");
return new MessagesWithMetadata(list, map, map2, map3, map4, map5);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MessagesWithMetadata)) {
return false;
}
MessagesWithMetadata messagesWithMetadata = (MessagesWithMetadata) obj;
return m.areEqual(this.messages, messagesWithMetadata.messages) && m.areEqual(this.messageState, messagesWithMetadata.messageState) && m.areEqual(this.messageThreads, messagesWithMetadata.messageThreads) && m.areEqual(this.threadCountsAndLatestMessages, messagesWithMetadata.threadCountsAndLatestMessages) && m.areEqual(this.messageReplyState, messagesWithMetadata.messageReplyState) && m.areEqual(this.parentChannelMessageReplyState, messagesWithMetadata.parentChannelMessageReplyState);
}
public final Map<Long, StoreMessageReplies.MessageState> getMessageReplyState() {
return this.messageReplyState;
}
public final Map<Long, StoreMessageState.State> getMessageState() {
return this.messageState;
}
public final Map<Long, Channel> getMessageThreads() {
return this.messageThreads;
}
public final List<Message> getMessages() {
return this.messages;
}
public final Map<Long, StoreMessageReplies.MessageState> getParentChannelMessageReplyState() {
return this.parentChannelMessageReplyState;
}
public final Map<Long, StoreThreadMessages.ThreadState> getThreadCountsAndLatestMessages() {
return this.threadCountsAndLatestMessages;
}
public int hashCode() {
List<Message> list = this.messages;
int i = 0;
int hashCode = (list != null ? list.hashCode() : 0) * 31;
Map<Long, StoreMessageState.State> map = this.messageState;
int hashCode2 = (hashCode + (map != null ? map.hashCode() : 0)) * 31;
Map<Long, Channel> map2 = this.messageThreads;
int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31;
Map<Long, StoreThreadMessages.ThreadState> map3 = this.threadCountsAndLatestMessages;
int hashCode4 = (hashCode3 + (map3 != null ? map3.hashCode() : 0)) * 31;
Map<Long, StoreMessageReplies.MessageState> map4 = this.messageReplyState;
int hashCode5 = (hashCode4 + (map4 != null ? map4.hashCode() : 0)) * 31;
Map<Long, StoreMessageReplies.MessageState> map5 = this.parentChannelMessageReplyState;
if (map5 != null) {
i = map5.hashCode();
}
return hashCode5 + i;
}
public String toString() {
StringBuilder R = a.R("MessagesWithMetadata(messages=");
R.append(this.messages);
R.append(", messageState=");
R.append(this.messageState);
R.append(", messageThreads=");
R.append(this.messageThreads);
R.append(", threadCountsAndLatestMessages=");
R.append(this.threadCountsAndLatestMessages);
R.append(", messageReplyState=");
R.append(this.messageReplyState);
R.append(", parentChannelMessageReplyState=");
return a.K(R, this.parentChannelMessageReplyState, ")");
}
}
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.List<? extends com.discord.widgets.chat.list.entries.ChatListEntry> */
/* JADX WARN: Multi-variable type inference failed */
public WidgetChatListModelMessages(List<? extends ChatListEntry> list, long j, long j2, Map<Long, GuildMember> map, long j3, Long l) {
m.checkNotNullParameter(list, "items");
this.items = list;
this.oldestMessageId = j;
this.newestKnownMessageId = j2;
this.guildMembers = map;
this.newMessagesMarkerMessageId = j3;
this.newestSentByUserMessageId = l;
}
public static /* synthetic */ WidgetChatListModelMessages copy$default(WidgetChatListModelMessages widgetChatListModelMessages, List list, long j, long j2, Map map, long j3, Long l, int i, Object obj) {
return widgetChatListModelMessages.copy((i & 1) != 0 ? widgetChatListModelMessages.items : list, (i & 2) != 0 ? widgetChatListModelMessages.oldestMessageId : j, (i & 4) != 0 ? widgetChatListModelMessages.newestKnownMessageId : j2, (i & 8) != 0 ? widgetChatListModelMessages.guildMembers : map, (i & 16) != 0 ? widgetChatListModelMessages.newMessagesMarkerMessageId : j3, (i & 32) != 0 ? widgetChatListModelMessages.newestSentByUserMessageId : l);
}
public final List<ChatListEntry> component1() {
return this.items;
}
public final long component2() {
return this.oldestMessageId;
}
public final long component3() {
return this.newestKnownMessageId;
}
public final Map<Long, GuildMember> component4() {
return this.guildMembers;
}
public final long component5() {
return this.newMessagesMarkerMessageId;
}
public final Long component6() {
return this.newestSentByUserMessageId;
}
public final WidgetChatListModelMessages copy(List<? extends ChatListEntry> list, long j, long j2, Map<Long, GuildMember> map, long j3, Long l) {
m.checkNotNullParameter(list, "items");
return new WidgetChatListModelMessages(list, j, j2, map, j3, l);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WidgetChatListModelMessages)) {
return false;
}
WidgetChatListModelMessages widgetChatListModelMessages = (WidgetChatListModelMessages) obj;
return m.areEqual(this.items, widgetChatListModelMessages.items) && this.oldestMessageId == widgetChatListModelMessages.oldestMessageId && this.newestKnownMessageId == widgetChatListModelMessages.newestKnownMessageId && m.areEqual(this.guildMembers, widgetChatListModelMessages.guildMembers) && this.newMessagesMarkerMessageId == widgetChatListModelMessages.newMessagesMarkerMessageId && m.areEqual(this.newestSentByUserMessageId, widgetChatListModelMessages.newestSentByUserMessageId);
}
public final Map<Long, GuildMember> getGuildMembers() {
return this.guildMembers;
}
public final List<ChatListEntry> getItems() {
return this.items;
}
public final long getNewMessagesMarkerMessageId() {
return this.newMessagesMarkerMessageId;
}
public final long getNewestKnownMessageId() {
return this.newestKnownMessageId;
}
public final Long getNewestSentByUserMessageId() {
return this.newestSentByUserMessageId;
}
public final long getOldestMessageId() {
return this.oldestMessageId;
}
public int hashCode() {
List<ChatListEntry> list = this.items;
int i = 0;
int a = (b.a(this.newestKnownMessageId) + ((b.a(this.oldestMessageId) + ((list != null ? list.hashCode() : 0) * 31)) * 31)) * 31;
Map<Long, GuildMember> map = this.guildMembers;
int a2 = (b.a(this.newMessagesMarkerMessageId) + ((a + (map != null ? map.hashCode() : 0)) * 31)) * 31;
Long l = this.newestSentByUserMessageId;
if (l != null) {
i = l.hashCode();
}
return a2 + i;
}
public String toString() {
StringBuilder R = a.R("WidgetChatListModelMessages(items=");
R.append(this.items);
R.append(", oldestMessageId=");
R.append(this.oldestMessageId);
R.append(", newestKnownMessageId=");
R.append(this.newestKnownMessageId);
R.append(", guildMembers=");
R.append(this.guildMembers);
R.append(", newMessagesMarkerMessageId=");
R.append(this.newMessagesMarkerMessageId);
R.append(", newestSentByUserMessageId=");
return a.F(R, this.newestSentByUserMessageId, ")");
}
}