package com.discord.stores; import c.d.b.a.a; import com.discord.api.channel.Channel; import com.discord.api.message.MessageReference; import com.discord.models.domain.ModelMessageDelete; import com.discord.models.message.Message; import com.discord.stores.updates.ObservationDeck; import com.discord.stores.updates.ObservationDeckProvider; import com.discord.utilities.collections.SnowflakePartitionMap; import d0.t.h0; import d0.z.d.m; import java.util.Map; import kotlin.jvm.internal.DefaultConstructorMarker; import rx.Observable; /* compiled from: StorePendingReplies.kt */ public final class StorePendingReplies extends StoreV2 { private final Dispatcher dispatcher; private final ObservationDeck observationDeck; private final SnowflakePartitionMap.CopiablePartitionMap pendingReplies; private Map pendingRepliesSnapshot; /* compiled from: StorePendingReplies.kt */ public static final class PendingReply { private final MessageReference messageReference; private final Message originalMessage; private boolean shouldMention; private final boolean showMentionToggle; public PendingReply(MessageReference messageReference, Message message, boolean z2, boolean z3) { m.checkNotNullParameter(messageReference, "messageReference"); m.checkNotNullParameter(message, "originalMessage"); this.messageReference = messageReference; this.originalMessage = message; this.shouldMention = z2; this.showMentionToggle = z3; } public static /* synthetic */ PendingReply copy$default(PendingReply pendingReply, MessageReference messageReference, Message message, boolean z2, boolean z3, int i, Object obj) { if ((i & 1) != 0) { messageReference = pendingReply.messageReference; } if ((i & 2) != 0) { message = pendingReply.originalMessage; } if ((i & 4) != 0) { z2 = pendingReply.shouldMention; } if ((i & 8) != 0) { z3 = pendingReply.showMentionToggle; } return pendingReply.copy(messageReference, message, z2, z3); } public final MessageReference component1() { return this.messageReference; } public final Message component2() { return this.originalMessage; } public final boolean component3() { return this.shouldMention; } public final boolean component4() { return this.showMentionToggle; } public final PendingReply copy(MessageReference messageReference, Message message, boolean z2, boolean z3) { m.checkNotNullParameter(messageReference, "messageReference"); m.checkNotNullParameter(message, "originalMessage"); return new PendingReply(messageReference, message, z2, z3); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PendingReply)) { return false; } PendingReply pendingReply = (PendingReply) obj; return m.areEqual(this.messageReference, pendingReply.messageReference) && m.areEqual(this.originalMessage, pendingReply.originalMessage) && this.shouldMention == pendingReply.shouldMention && this.showMentionToggle == pendingReply.showMentionToggle; } public final MessageReference getMessageReference() { return this.messageReference; } public final Message getOriginalMessage() { return this.originalMessage; } public final boolean getShouldMention() { return this.shouldMention; } public final boolean getShowMentionToggle() { return this.showMentionToggle; } public int hashCode() { MessageReference messageReference = this.messageReference; int i = 0; int hashCode = (messageReference != null ? messageReference.hashCode() : 0) * 31; Message message = this.originalMessage; if (message != null) { i = message.hashCode(); } int i2 = (hashCode + i) * 31; boolean z2 = this.shouldMention; int i3 = 1; if (z2) { z2 = true; } int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; int i6 = z2 ? 1 : 0; int i7 = (i2 + i4) * 31; boolean z3 = this.showMentionToggle; if (!z3) { i3 = z3 ? 1 : 0; } return i7 + i3; } public final void setShouldMention(boolean z2) { this.shouldMention = z2; } public String toString() { StringBuilder L = a.L("PendingReply(messageReference="); L.append(this.messageReference); L.append(", originalMessage="); L.append(this.originalMessage); L.append(", shouldMention="); L.append(this.shouldMention); L.append(", showMentionToggle="); return a.G(L, this.showMentionToggle, ")"); } } public StorePendingReplies(Dispatcher dispatcher, ObservationDeck observationDeck) { m.checkNotNullParameter(dispatcher, "dispatcher"); m.checkNotNullParameter(observationDeck, "observationDeck"); this.dispatcher = dispatcher; this.observationDeck = observationDeck; this.pendingReplies = new SnowflakePartitionMap.CopiablePartitionMap<>(0, 1, null); this.pendingRepliesSnapshot = h0.emptyMap(); } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ StorePendingReplies(Dispatcher dispatcher, ObservationDeck observationDeck, int i, DefaultConstructorMarker defaultConstructorMarker) { this(dispatcher, (i & 2) != 0 ? ObservationDeckProvider.get() : observationDeck); } public static final /* synthetic */ SnowflakePartitionMap.CopiablePartitionMap access$getPendingReplies$p(StorePendingReplies storePendingReplies) { return storePendingReplies.pendingReplies; } public static /* synthetic */ void onCreatePendingReply$default(StorePendingReplies storePendingReplies, Channel channel, Message message, boolean z2, boolean z3, int i, Object obj) { if ((i & 4) != 0) { z2 = true; } if ((i & 8) != 0) { z3 = true; } storePendingReplies.onCreatePendingReply(channel, message, z2, z3); } public final PendingReply getPendingReply(long j) { return this.pendingRepliesSnapshot.get(Long.valueOf(j)); } @StoreThread public final void handleMessageDelete(ModelMessageDelete modelMessageDelete) { m.checkNotNullParameter(modelMessageDelete, "messageDeleteBulk"); PendingReply pendingReply = this.pendingReplies.get(Long.valueOf(modelMessageDelete.getChannelId())); if (pendingReply != null && modelMessageDelete.getMessageIds().contains(pendingReply.getMessageReference().c())) { this.pendingReplies.remove(Long.valueOf(modelMessageDelete.getChannelId())); markChanged(); } } @StoreThread public final void handlePreLogout() { this.pendingReplies.clear(); markChanged(); } public final Observable observePendingReply(long j) { return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StorePendingReplies$observePendingReply$1(this, j), 14, null); } public final void onCreatePendingReply(Channel channel, Message message, boolean z2, boolean z3) { m.checkNotNullParameter(channel, "channel"); m.checkNotNullParameter(message, "message"); this.dispatcher.schedule(new StorePendingReplies$onCreatePendingReply$1(this, channel, message, z2, z3)); } public final void onDeletePendingReply(long j) { this.dispatcher.schedule(new StorePendingReplies$onDeletePendingReply$1(this, j)); } public final void onSetPendingReplyShouldMention(long j, boolean z2) { this.dispatcher.schedule(new StorePendingReplies$onSetPendingReplyShouldMention$1(this, j, z2)); } @Override // com.discord.stores.StoreV2 @StoreThread public void snapshotData() { this.pendingRepliesSnapshot = this.pendingReplies.fastCopy(); } }