discord-jadx/app/src/main/java/com/discord/widgets/channels/list/WidgetChannelListModel.java

917 lines
45 KiB
Java

package com.discord.widgets.channels.list;
import b.d.b.a.a;
import com.discord.api.channel.Channel;
import com.discord.api.directory.DirectoryEntryEvent;
import com.discord.api.directory.DirectoryEntryGuild;
import com.discord.api.guildjoinrequest.GuildJoinRequest;
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityMetadata;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
import com.discord.api.guildscheduledevent.GuildScheduledEventStatus;
import com.discord.api.permission.Permission;
import com.discord.api.stageinstance.StageInstance;
import com.discord.api.voice.state.VoiceState;
import com.discord.models.domain.ModelApplicationStream;
import com.discord.models.guild.Guild;
import com.discord.models.guild.UserGuildMember;
import com.discord.models.member.GuildMember;
import com.discord.models.user.User;
import com.discord.stores.StoreApplicationStreaming;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreChannelsSelected;
import com.discord.stores.StoreExperiments;
import com.discord.stores.StoreGuildScheduledEvents;
import com.discord.stores.StoreMentions;
import com.discord.stores.StoreMessageAck;
import com.discord.stores.StoreMessagesMostRecent;
import com.discord.stores.StoreNux;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreThreadsActiveJoined;
import com.discord.stores.StoreThreadsJoined;
import com.discord.stores.StoreUserConnections;
import com.discord.stores.StoreUserGuildSettings;
import com.discord.stores.StoreUserPresence;
import com.discord.stores.updates.ObservationDeck;
import com.discord.stores.updates.ObservationDeckProvider;
import com.discord.stores.utilities.RestCallState;
import com.discord.utilities.channel.GuildChannelsInfo;
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities;
import com.discord.utilities.permissions.PermissionUtils;
import com.discord.utilities.rx.ObservableCombineLatestOverloadsKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.widgets.channels.list.items.ChannelListItem;
import com.discord.widgets.channels.list.items.ChannelListItemActiveEventData;
import com.discord.widgets.channels.list.items.ChannelListItemCategory;
import com.discord.widgets.channels.list.items.ChannelListItemEventsSeparator;
import com.discord.widgets.channels.list.items.ChannelListItemGuildJoinRequest;
import com.discord.widgets.channels.list.items.ChannelListItemInvite;
import com.discord.widgets.channels.list.items.ChannelListItemMfaNotice;
import com.discord.widgets.channels.list.items.ChannelListItemVoiceUser;
import com.discord.widgets.guild_role_subscriptions.GuildRoleSubscriptionsFeatureFlag;
import com.discord.widgets.guildscheduledevent.GuildScheduledEventLocationInfo;
import com.discord.widgets.stage.StageRoles;
import com.discord.widgets.stage.model.StageChannel;
import d0.f0.q;
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.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
/* compiled from: WidgetChannelListModel.kt */
public final class WidgetChannelListModel {
public static final Companion Companion = new Companion(null);
private final List<GuildScheduledEvent> guildScheduledEvents;
private final boolean isGuildSelected;
private final List<ChannelListItem> items;
private final Guild selectedGuild;
private final boolean showEmptyState;
private final boolean showPremiumGuildHint;
/* compiled from: WidgetChannelListModel.kt */
public static final class Companion {
/* compiled from: WidgetChannelListModel.kt */
public static final class TextLikeChannelData {
private final boolean hide;
private final boolean locked;
private final int mentionCount;
private final boolean selected;
private final boolean unread;
public TextLikeChannelData(boolean z2, int i, boolean z3, boolean z4, boolean z5) {
this.selected = z2;
this.mentionCount = i;
this.unread = z3;
this.locked = z4;
this.hide = z5;
}
public static /* synthetic */ TextLikeChannelData copy$default(TextLikeChannelData textLikeChannelData, boolean z2, int i, boolean z3, boolean z4, boolean z5, int i2, Object obj) {
if ((i2 & 1) != 0) {
z2 = textLikeChannelData.selected;
}
if ((i2 & 2) != 0) {
i = textLikeChannelData.mentionCount;
}
if ((i2 & 4) != 0) {
z3 = textLikeChannelData.unread;
}
if ((i2 & 8) != 0) {
z4 = textLikeChannelData.locked;
}
if ((i2 & 16) != 0) {
z5 = textLikeChannelData.hide;
}
return textLikeChannelData.copy(z2, i, z3, z4, z5);
}
public final boolean component1() {
return this.selected;
}
public final int component2() {
return this.mentionCount;
}
public final boolean component3() {
return this.unread;
}
public final boolean component4() {
return this.locked;
}
public final boolean component5() {
return this.hide;
}
public final TextLikeChannelData copy(boolean z2, int i, boolean z3, boolean z4, boolean z5) {
return new TextLikeChannelData(z2, i, z3, z4, z5);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof TextLikeChannelData)) {
return false;
}
TextLikeChannelData textLikeChannelData = (TextLikeChannelData) obj;
return this.selected == textLikeChannelData.selected && this.mentionCount == textLikeChannelData.mentionCount && this.unread == textLikeChannelData.unread && this.locked == textLikeChannelData.locked && this.hide == textLikeChannelData.hide;
}
public final boolean getHide() {
return this.hide;
}
public final boolean getLocked() {
return this.locked;
}
public final int getMentionCount() {
return this.mentionCount;
}
public final boolean getSelected() {
return this.selected;
}
public final boolean getUnread() {
return this.unread;
}
public int hashCode() {
boolean z2 = this.selected;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = ((i2 * 31) + this.mentionCount) * 31;
boolean z3 = this.unread;
if (z3) {
z3 = true;
}
int i6 = z3 ? 1 : 0;
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = (i5 + i6) * 31;
boolean z4 = this.locked;
if (z4) {
z4 = true;
}
int i10 = z4 ? 1 : 0;
int i11 = z4 ? 1 : 0;
int i12 = z4 ? 1 : 0;
int i13 = (i9 + i10) * 31;
boolean z5 = this.hide;
if (!z5) {
i = z5 ? 1 : 0;
}
return i13 + i;
}
public String toString() {
StringBuilder R = a.R("TextLikeChannelData(selected=");
R.append(this.selected);
R.append(", mentionCount=");
R.append(this.mentionCount);
R.append(", unread=");
R.append(this.unread);
R.append(", locked=");
R.append(this.locked);
R.append(", hide=");
return a.M(R, this.hide, ")");
}
}
/* compiled from: WidgetChannelListModel.kt */
public static final class VocalChannelData {
private final boolean isGuildRoleSubscriptionChannel;
private final boolean isGuildRoleSubscriptionLockedChannel;
private final boolean locked;
private final int mentionCount;
private final boolean nsfw;
private final int numUsersConnected;
private final Long permission;
private final boolean textChannelSelected;
private final boolean unread;
private final boolean voiceChannelSelected;
public VocalChannelData(boolean z2, boolean z3, int i, boolean z4, boolean z5, boolean z6, Long l, int i2, boolean z7, boolean z8) {
this.voiceChannelSelected = z2;
this.textChannelSelected = z3;
this.mentionCount = i;
this.unread = z4;
this.locked = z5;
this.nsfw = z6;
this.permission = l;
this.numUsersConnected = i2;
this.isGuildRoleSubscriptionLockedChannel = z7;
this.isGuildRoleSubscriptionChannel = z8;
}
public static /* synthetic */ VocalChannelData copy$default(VocalChannelData vocalChannelData, boolean z2, boolean z3, int i, boolean z4, boolean z5, boolean z6, Long l, int i2, boolean z7, boolean z8, int i3, Object obj) {
return vocalChannelData.copy((i3 & 1) != 0 ? vocalChannelData.voiceChannelSelected : z2, (i3 & 2) != 0 ? vocalChannelData.textChannelSelected : z3, (i3 & 4) != 0 ? vocalChannelData.mentionCount : i, (i3 & 8) != 0 ? vocalChannelData.unread : z4, (i3 & 16) != 0 ? vocalChannelData.locked : z5, (i3 & 32) != 0 ? vocalChannelData.nsfw : z6, (i3 & 64) != 0 ? vocalChannelData.permission : l, (i3 & 128) != 0 ? vocalChannelData.numUsersConnected : i2, (i3 & 256) != 0 ? vocalChannelData.isGuildRoleSubscriptionLockedChannel : z7, (i3 & 512) != 0 ? vocalChannelData.isGuildRoleSubscriptionChannel : z8);
}
public final boolean component1() {
return this.voiceChannelSelected;
}
public final boolean component10() {
return this.isGuildRoleSubscriptionChannel;
}
public final boolean component2() {
return this.textChannelSelected;
}
public final int component3() {
return this.mentionCount;
}
public final boolean component4() {
return this.unread;
}
public final boolean component5() {
return this.locked;
}
public final boolean component6() {
return this.nsfw;
}
public final Long component7() {
return this.permission;
}
public final int component8() {
return this.numUsersConnected;
}
public final boolean component9() {
return this.isGuildRoleSubscriptionLockedChannel;
}
public final VocalChannelData copy(boolean z2, boolean z3, int i, boolean z4, boolean z5, boolean z6, Long l, int i2, boolean z7, boolean z8) {
return new VocalChannelData(z2, z3, i, z4, z5, z6, l, i2, z7, z8);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof VocalChannelData)) {
return false;
}
VocalChannelData vocalChannelData = (VocalChannelData) obj;
return this.voiceChannelSelected == vocalChannelData.voiceChannelSelected && this.textChannelSelected == vocalChannelData.textChannelSelected && this.mentionCount == vocalChannelData.mentionCount && this.unread == vocalChannelData.unread && this.locked == vocalChannelData.locked && this.nsfw == vocalChannelData.nsfw && m.areEqual(this.permission, vocalChannelData.permission) && this.numUsersConnected == vocalChannelData.numUsersConnected && this.isGuildRoleSubscriptionLockedChannel == vocalChannelData.isGuildRoleSubscriptionLockedChannel && this.isGuildRoleSubscriptionChannel == vocalChannelData.isGuildRoleSubscriptionChannel;
}
public final boolean getLocked() {
return this.locked;
}
public final int getMentionCount() {
return this.mentionCount;
}
public final boolean getNsfw() {
return this.nsfw;
}
public final int getNumUsersConnected() {
return this.numUsersConnected;
}
public final Long getPermission() {
return this.permission;
}
public final boolean getTextChannelSelected() {
return this.textChannelSelected;
}
public final boolean getUnread() {
return this.unread;
}
public final boolean getVoiceChannelSelected() {
return this.voiceChannelSelected;
}
public int hashCode() {
boolean z2 = this.voiceChannelSelected;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = i2 * 31;
boolean z3 = this.textChannelSelected;
if (z3) {
z3 = true;
}
int i6 = z3 ? 1 : 0;
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = (((i5 + i6) * 31) + this.mentionCount) * 31;
boolean z4 = this.unread;
if (z4) {
z4 = true;
}
int i10 = z4 ? 1 : 0;
int i11 = z4 ? 1 : 0;
int i12 = z4 ? 1 : 0;
int i13 = (i9 + i10) * 31;
boolean z5 = this.locked;
if (z5) {
z5 = true;
}
int i14 = z5 ? 1 : 0;
int i15 = z5 ? 1 : 0;
int i16 = z5 ? 1 : 0;
int i17 = (i13 + i14) * 31;
boolean z6 = this.nsfw;
if (z6) {
z6 = true;
}
int i18 = z6 ? 1 : 0;
int i19 = z6 ? 1 : 0;
int i20 = z6 ? 1 : 0;
int i21 = (i17 + i18) * 31;
Long l = this.permission;
int hashCode = (((i21 + (l != null ? l.hashCode() : 0)) * 31) + this.numUsersConnected) * 31;
boolean z7 = this.isGuildRoleSubscriptionLockedChannel;
if (z7) {
z7 = true;
}
int i22 = z7 ? 1 : 0;
int i23 = z7 ? 1 : 0;
int i24 = z7 ? 1 : 0;
int i25 = (hashCode + i22) * 31;
boolean z8 = this.isGuildRoleSubscriptionChannel;
if (!z8) {
i = z8 ? 1 : 0;
}
return i25 + i;
}
public final boolean isGuildRoleSubscriptionChannel() {
return this.isGuildRoleSubscriptionChannel;
}
public final boolean isGuildRoleSubscriptionLockedChannel() {
return this.isGuildRoleSubscriptionLockedChannel;
}
public String toString() {
StringBuilder R = a.R("VocalChannelData(voiceChannelSelected=");
R.append(this.voiceChannelSelected);
R.append(", textChannelSelected=");
R.append(this.textChannelSelected);
R.append(", mentionCount=");
R.append(this.mentionCount);
R.append(", unread=");
R.append(this.unread);
R.append(", locked=");
R.append(this.locked);
R.append(", nsfw=");
R.append(this.nsfw);
R.append(", permission=");
R.append(this.permission);
R.append(", numUsersConnected=");
R.append(this.numUsersConnected);
R.append(", isGuildRoleSubscriptionLockedChannel=");
R.append(this.isGuildRoleSubscriptionLockedChannel);
R.append(", isGuildRoleSubscriptionChannel=");
return a.M(R, this.isGuildRoleSubscriptionChannel, ")");
}
}
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ Observable access$getPrivateChannelList(Companion companion) {
return companion.getPrivateChannelList();
}
public static final /* synthetic */ Observable access$getSelectedGuildChannelList(Companion companion, long j) {
return companion.getSelectedGuildChannelList(j);
}
public static final /* synthetic */ List access$guildListBuilder(Companion companion, long j, GuildChannelsInfo guildChannelsInfo, Map map, Map map2, Map map3, Set set, Channel channel, long j2, Map map4, Map map5, Set set2, Set set3, Map map6, Map map7, List list, boolean z2, boolean z3, Map map8, Map map9, Map map10, GuildJoinRequest guildJoinRequest, GuildMember guildMember) {
return companion.guildListBuilder(j, guildChannelsInfo, map, map2, map3, set, channel, j2, map4, map5, set2, set3, map6, map7, list, z2, z3, map8, map9, map10, guildJoinRequest, guildMember);
}
/* JADX WARNING: Removed duplicated region for block: B:101:0x0195 A[EDGE_INSN: B:101:0x0195->B:81:0x0195 ?: BREAK , SYNTHETIC] */
private final ChannelListItemActiveEventData getChannelEventNoticeData(GuildChannelsInfo guildChannelsInfo, Map<Long, StageChannel> map, List<GuildScheduledEvent> list, Map<Long, ? extends Collection<ChannelListItemVoiceUser>> map2, Map<Long, Channel> map3, long j) {
Object obj;
Object obj2;
GuildScheduledEventEntityMetadata e;
String a;
boolean z2;
Channel channel;
List list2;
ChannelListItemVoiceUser channelListItemVoiceUser;
Object obj3;
boolean z3;
boolean z4;
Channel channel2;
Long b2;
StageChannel stageChannel = (StageChannel) q.firstOrNull(q.filter(u.asSequence(map.values()), WidgetChannelListModel$Companion$getChannelEventNoticeData$1.INSTANCE));
String str = null;
if (stageChannel != null) {
GuildScheduledEventLocationInfo.ChannelLocation channelLocation = new GuildScheduledEventLocationInfo.ChannelLocation(stageChannel.getChannel());
int audienceSize = stageChannel.getAudienceSize();
List<UserGuildMember> speakers = stageChannel.getSpeakers();
boolean containsMe = stageChannel.getContainsMe();
StageRoles r1 = stageChannel.m40getMyRolestwRsX0();
boolean z5 = r1 != null && StageRoles.m27isSpeakerimpl(r1.m29unboximpl());
StageInstance stageInstance = stageChannel.getStageInstance();
if (stageInstance != null) {
str = stageInstance.f();
}
return new ChannelListItemActiveEventData(str, channelLocation, audienceSize, speakers, containsMe, z5, null);
}
Iterator<T> it = list.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
GuildScheduledEvent guildScheduledEvent = (GuildScheduledEvent) obj;
if (guildScheduledEvent.m() != GuildScheduledEventStatus.ACTIVE || (channel2 = map3.get(guildScheduledEvent.b())) == null || channel2.A() != 2 || !PermissionUtils.can(Permission.CONNECT, guildChannelsInfo.getChannelPermissions().get(guildScheduledEvent.b())) || ((b2 = guildScheduledEvent.b()) != null && b2.longValue() == j)) {
z4 = false;
continue;
} else {
z4 = true;
continue;
}
if (z4) {
break;
}
}
GuildScheduledEvent guildScheduledEvent2 = (GuildScheduledEvent) obj;
if (!(guildScheduledEvent2 == null || (channel = map3.get(guildScheduledEvent2.b())) == null)) {
Collection<ChannelListItemVoiceUser> collection = (Collection) map2.get(guildScheduledEvent2.b());
if (collection != null) {
list2 = new ArrayList(o.collectionSizeOrDefault(collection, 10));
for (ChannelListItemVoiceUser channelListItemVoiceUser2 : collection) {
list2.add(new UserGuildMember(channelListItemVoiceUser2.getUser(), channelListItemVoiceUser2.getComputed()));
}
} else {
list2 = null;
}
long id2 = StoreStream.Companion.getUsers().getMe().getId();
Collection collection2 = (Collection) map2.get(guildScheduledEvent2.b());
if (collection2 != null) {
Iterator it2 = collection2.iterator();
while (true) {
if (!it2.hasNext()) {
obj3 = null;
break;
}
obj3 = it2.next();
if (((ChannelListItemVoiceUser) obj3).getUser().getId() == id2) {
z3 = true;
continue;
} else {
z3 = false;
continue;
}
if (z3) {
break;
}
}
channelListItemVoiceUser = (ChannelListItemVoiceUser) obj3;
} else {
channelListItemVoiceUser = null;
}
boolean z6 = channelListItemVoiceUser != null;
if (!z6) {
GuildScheduledEventLocationInfo.ChannelLocation channelLocation2 = new GuildScheduledEventLocationInfo.ChannelLocation(channel);
if (list2 == null) {
list2 = n.emptyList();
}
return new ChannelListItemActiveEventData(guildScheduledEvent2.j(), channelLocation2, 0, list2, z6, z6, null);
}
}
Iterator<T> it3 = list.iterator();
while (true) {
if (!it3.hasNext()) {
obj2 = null;
break;
}
obj2 = it3.next();
GuildScheduledEvent guildScheduledEvent3 = (GuildScheduledEvent) obj2;
if (guildScheduledEvent3.m() == GuildScheduledEventStatus.ACTIVE && guildScheduledEvent3.f() == GuildScheduledEventEntityType.EXTERNAL) {
GuildScheduledEventEntityMetadata e2 = guildScheduledEvent3.e();
if ((e2 != null ? e2.a() : null) != null) {
z2 = true;
continue;
if (z2) {
break;
}
}
}
z2 = false;
continue;
if (z2) {
}
}
GuildScheduledEvent guildScheduledEvent4 = (GuildScheduledEvent) obj2;
if (guildScheduledEvent4 == null || (e = guildScheduledEvent4.e()) == null || (a = e.a()) == null) {
return null;
}
return new ChannelListItemActiveEventData(guildScheduledEvent4.j(), new GuildScheduledEventLocationInfo.ExternalLocation(a), 0, n.emptyList(), false, false, Long.valueOf(guildScheduledEvent4.i()));
}
private final Observable<WidgetChannelListModel> getPrivateChannelList() {
StoreStream.Companion companion = StoreStream.Companion;
StoreChannels channels = companion.getChannels();
StoreChannelsSelected channelsSelected = companion.getChannelsSelected();
StoreUserPresence presences = companion.getPresences();
StoreMessagesMostRecent messagesMostRecent = companion.getMessagesMostRecent();
StoreMentions mentions = companion.getMentions();
StoreApplicationStreaming applicationStreaming = companion.getApplicationStreaming();
StoreUserGuildSettings userGuildSettings = companion.getUserGuildSettings();
StoreExperiments experiments = companion.getExperiments();
StoreUserConnections userConnections = companion.getUserConnections();
Observable<WidgetChannelListModel> F = ObservableExtensionsKt.leadingEdgeThrottle(ObservationDeck.connectRx$default(ObservationDeckProvider.get(), new ObservationDeck.UpdateSource[]{channels, channelsSelected, presences, messagesMostRecent, mentions, applicationStreaming, userGuildSettings, experiments, userConnections}, false, null, null, 14, null), 250, TimeUnit.MILLISECONDS).F(new WidgetChannelListModel$Companion$getPrivateChannelList$1(channels, messagesMostRecent, channelsSelected, presences, mentions, applicationStreaming, userGuildSettings, experiments, userConnections));
m.checkNotNullExpressionValue(F, "ObservationDeckProvider\n… )\n }");
return F;
}
private final Observable<WidgetChannelListModel> getSelectedGuildChannelList(long j) {
StoreStream.Companion companion = StoreStream.Companion;
long id2 = companion.getUsers().getMe().getId();
Observable<GuildChannelsInfo> observable = GuildChannelsInfo.Companion.get(j);
Observable observeChannelsForGuild$default = StoreChannels.observeChannelsForGuild$default(companion.getChannels(), j, null, 2, null);
Observable<Map<Long, StoreThreadsJoined.JoinedThread>> observeJoinedThreads = companion.getThreadsJoined().observeJoinedThreads();
Observable<Map<Long, Map<Long, StoreThreadsActiveJoined.ActiveJoinedThread>>> observeActiveJoinedThreadsForGuild = companion.getThreadsActiveJoined().observeActiveJoinedThreadsForGuild(j);
Observable<Set<Long>> observeChannelsWithActiveThreadsByGuild = companion.getThreadsActive().observeChannelsWithActiveThreadsByGuild(j);
Observable<Channel> observeSelectedChannel = companion.getChannelsSelected().observeSelectedChannel();
Observable<Long> observeSelectedVoiceChannelId = companion.getVoiceChannelSelected().observeSelectedVoiceChannelId();
Observable observable2 = VoiceStates.get$default(VoiceStates.INSTANCE, j, null, 2, null);
Observable<Map<Long, Integer>> observeMentionCounts = companion.getMentions().observeMentionCounts();
Observable<Set<Long>> unreadChannelIds = companion.getReadStates().getUnreadChannelIds();
Observable<Set<Long>> observeCollapsedCategories = companion.getStoreChannelCategories().observeCollapsedCategories(j);
Observable<StoreNux.NuxState> nuxState = companion.getNux().getNuxState();
Observable<Map<Long, StageChannel>> observeGuildStageChannels = companion.getStageChannels().observeGuildStageChannels(j);
Observable<Map<Long, StageInstance>> observeStageInstancesForGuild = companion.getStageInstances().observeStageInstancesForGuild(j);
Observable observeGuildScheduledEvents$default = StoreGuildScheduledEvents.observeGuildScheduledEvents$default(companion.getGuildScheduledEvents(), j, false, 2, null);
Observable observeCanCreateAnyEvent$default = GuildScheduledEventUtilities.Companion.observeCanCreateAnyEvent$default(GuildScheduledEventUtilities.Companion, j, null, null, null, 14, null);
Observable<Boolean> observeCanGuildSeeGuildRoleSubscriptions = GuildRoleSubscriptionsFeatureFlag.Companion.getINSTANCE().observeCanGuildSeeGuildRoleSubscriptions(j);
Observable<Map<Long, RestCallState<List<DirectoryEntryGuild>>>> observeDirectories = companion.getDirectories().observeDirectories();
Observable<Map<Long, StoreMessageAck.Ack>> observeAll = companion.getMessageAck().observeAll();
Observable<Map<Long, RestCallState<List<DirectoryEntryEvent>>>> observeDirectoryGuildScheduledEvents = companion.getDirectories().observeDirectoryGuildScheduledEvents();
Observable<GuildJoinRequest> observeGuildJoinRequest = companion.getGuildJoinRequests().observeGuildJoinRequest(j);
Observable<GuildMember> observeGuildMember = companion.getGuilds().observeGuildMember(j, id2);
m.checkNotNullExpressionValue(observeGuildMember, "StoreStream\n …er(selectedGuildId, meId)");
return ObservableCombineLatestOverloadsKt.combineLatest(observable, observeChannelsForGuild$default, observeJoinedThreads, observeActiveJoinedThreadsForGuild, observeChannelsWithActiveThreadsByGuild, observeSelectedChannel, observeSelectedVoiceChannelId, observable2, observeMentionCounts, unreadChannelIds, observeCollapsedCategories, nuxState, observeGuildStageChannels, observeStageInstancesForGuild, observeGuildScheduledEvents$default, observeCanCreateAnyEvent$default, observeCanGuildSeeGuildRoleSubscriptions, observeDirectories, observeAll, observeDirectoryGuildScheduledEvents, observeGuildJoinRequest, observeGuildMember, new WidgetChannelListModel$Companion$getSelectedGuildChannelList$1(j));
}
/* JADX ERROR: IndexOutOfBoundsException in pass: SSATransform
java.lang.IndexOutOfBoundsException: bitIndex < 0: -61
at java.base/java.util.BitSet.get(BitSet.java:626)
at jadx.core.dex.visitors.ssa.LiveVarAnalysis.fillBasicBlockInfo(LiveVarAnalysis.java:65)
at jadx.core.dex.visitors.ssa.LiveVarAnalysis.runAnalysis(LiveVarAnalysis.java:36)
at jadx.core.dex.visitors.ssa.SSATransform.process(SSATransform.java:55)
at jadx.core.dex.visitors.ssa.SSATransform.visit(SSATransform.java:41)
*/
private final java.util.List<com.discord.widgets.channels.list.items.ChannelListItem> guildListBuilder(long r178, com.discord.utilities.channel.GuildChannelsInfo r180, java.util.Map<java.lang.Long, com.discord.api.channel.Channel> r181, java.util.Map<java.lang.Long, ? extends java.util.Map<java.lang.Long, com.discord.stores.StoreThreadsActiveJoined.ActiveJoinedThread>> r182, java.util.Map<java.lang.Long, com.discord.stores.StoreThreadsJoined.JoinedThread> r183, java.util.Set<java.lang.Long> r184, com.discord.api.channel.Channel r185, long r186, java.util.Map<java.lang.Long, ? extends java.util.Collection<com.discord.widgets.channels.list.items.ChannelListItemVoiceUser>> r188, java.util.Map<java.lang.Long, java.lang.Integer> r189, java.util.Set<java.lang.Long> r190, java.util.Set<java.lang.Long> r191, java.util.Map<java.lang.Long, com.discord.widgets.stage.model.StageChannel> r192, java.util.Map<java.lang.Long, com.discord.api.stageinstance.StageInstance> r193, java.util.List<com.discord.api.guildscheduledevent.GuildScheduledEvent> r194, boolean r195, boolean r196, java.util.Map<java.lang.Long, ? extends com.discord.stores.utilities.RestCallState<? extends java.util.List<com.discord.api.directory.DirectoryEntryGuild>>> r197, java.util.Map<java.lang.Long, com.discord.stores.StoreMessageAck.Ack> r198, java.util.Map<java.lang.Long, ? extends com.discord.stores.utilities.RestCallState<? extends java.util.List<com.discord.api.directory.DirectoryEntryEvent>>> r199, com.discord.api.guildjoinrequest.GuildJoinRequest r200, com.discord.models.member.GuildMember r201) {
/*
// Method dump skipped, instructions count: 1744
*/
throw new UnsupportedOperationException("Method not decompiled: com.discord.widgets.channels.list.WidgetChannelListModel.Companion.guildListBuilder(long, com.discord.utilities.channel.GuildChannelsInfo, java.util.Map, java.util.Map, java.util.Map, java.util.Set, com.discord.api.channel.Channel, long, java.util.Map, java.util.Map, java.util.Set, java.util.Set, java.util.Map, java.util.Map, java.util.List, boolean, boolean, java.util.Map, java.util.Map, java.util.Map, com.discord.api.guildjoinrequest.GuildJoinRequest, com.discord.models.member.GuildMember):java.util.List");
}
public final Observable<WidgetChannelListModel> get() {
Observable<WidgetChannelListModel> q = StoreStream.Companion.getGuildSelected().observeSelectedGuildId().Y(WidgetChannelListModel$Companion$get$1.INSTANCE).q();
m.checkNotNullExpressionValue(q, "StoreStream\n .g… .distinctUntilChanged()");
return q;
}
}
/* compiled from: WidgetChannelListModel.kt */
public static abstract class ThreadSpineType {
/* compiled from: WidgetChannelListModel.kt */
public static final class End extends ThreadSpineType {
public static final End INSTANCE = new End();
private End() {
super(null);
}
}
/* compiled from: WidgetChannelListModel.kt */
public static final class Middle extends ThreadSpineType {
public static final Middle INSTANCE = new Middle();
private Middle() {
super(null);
}
}
/* compiled from: WidgetChannelListModel.kt */
public static final class Single extends ThreadSpineType {
public static final Single INSTANCE = new Single();
private Single() {
super(null);
}
}
/* compiled from: WidgetChannelListModel.kt */
public static final class Start extends ThreadSpineType {
public static final Start INSTANCE = new Start();
private Start() {
super(null);
}
}
private ThreadSpineType() {
}
public /* synthetic */ ThreadSpineType(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetChannelListModel.kt */
public static final class VoiceStates {
public static final VoiceStates INSTANCE = new VoiceStates();
private VoiceStates() {
}
public static final /* synthetic */ Map access$createVoiceStates(VoiceStates voiceStates, Map map, Map map2, Map map3, Map map4, Map map5, Map map6, Comparator comparator) {
return voiceStates.createVoiceStates(map, map2, map3, map4, map5, map6, comparator);
}
private final Map<Long, List<ChannelListItemVoiceUser>> createVoiceStates(Map<Long, VoiceState> map, Map<Long, ? extends User> map2, Map<Long, GuildMember> map3, Map<Long, Channel> map4, Map<Long, ? extends ModelApplicationStream> map5, Map<Long, Long> map6, Comparator<ChannelListItemVoiceUser> comparator) {
Long a;
HashMap hashMap = new HashMap();
for (VoiceState voiceState : map.values()) {
long m = voiceState.m();
User user = (User) map2.get(Long.valueOf(m));
if (user != null && (a = voiceState.a()) != null) {
long longValue = a.longValue();
boolean can = PermissionUtils.can(Permission.CONNECT, map6.get(Long.valueOf(longValue)));
Long valueOf = Long.valueOf(longValue);
Object obj = hashMap.get(valueOf);
if (obj == null) {
obj = new ArrayList();
hashMap.put(valueOf, obj);
}
List list = (List) obj;
GuildMember guildMember = map3.get(Long.valueOf(m));
if (guildMember != null) {
Channel channel = map4.get(Long.valueOf(longValue));
if (channel != null) {
list.add(new ChannelListItemVoiceUser(channel, voiceState, user, guildMember, map5.containsKey(Long.valueOf(m)), can));
}
}
}
}
for (Map.Entry entry : hashMap.entrySet()) {
d0.t.q.sortWith((List) entry.getValue(), comparator);
}
return hashMap;
}
private final Comparator<ChannelListItemVoiceUser> createVoiceUserComparator() {
return WidgetChannelListModel$VoiceStates$createVoiceUserComparator$1.INSTANCE;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.channels.list.WidgetChannelListModel$VoiceStates */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ Observable get$default(VoiceStates voiceStates, long j, Comparator comparator, int i, Object obj) {
if ((i & 2) != 0) {
comparator = voiceStates.createVoiceUserComparator();
}
return voiceStates.get(j, comparator);
}
public final Observable<Map<Long, List<ChannelListItemVoiceUser>>> get(long j, Comparator<ChannelListItemVoiceUser> comparator) {
m.checkNotNullParameter(comparator, "voiceUserComparator");
StoreStream.Companion companion = StoreStream.Companion;
Observable f = Observable.f(companion.getApplicationStreaming().observeStreamsForGuild(j), ObservableExtensionsKt.leadingEdgeThrottle(companion.getVoiceStates().observe(j), 200, TimeUnit.MILLISECONDS), companion.getUsers().observeAllUsers(), companion.getGuilds().observeComputed(j), StoreChannels.observeChannelsForGuild$default(companion.getChannels(), j, null, 2, null), companion.getPermissions().observeChannelPermissionsForGuild(j), new WidgetChannelListModel$VoiceStates$get$1(comparator));
m.checkNotNullExpressionValue(f, "Observable\n .co… )\n }");
Observable<Map<Long, List<ChannelListItemVoiceUser>>> q = ObservableExtensionsKt.computationLatest(f).q();
m.checkNotNullExpressionValue(q, "Observable\n .co… .distinctUntilChanged()");
return q;
}
}
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends com.discord.widgets.channels.list.items.ChannelListItem> */
/* JADX WARN: Multi-variable type inference failed */
public WidgetChannelListModel(Guild guild, List<? extends ChannelListItem> list, boolean z2, boolean z3, boolean z4, List<GuildScheduledEvent> list2) {
m.checkNotNullParameter(list, "items");
m.checkNotNullParameter(list2, "guildScheduledEvents");
this.selectedGuild = guild;
this.items = list;
this.isGuildSelected = z2;
this.showPremiumGuildHint = z3;
this.showEmptyState = z4;
this.guildScheduledEvents = list2;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetChannelListModel(Guild guild, List list, boolean z2, boolean z3, boolean z4, List list2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(guild, list, (i & 4) != 0 ? false : z2, (i & 8) != 0 ? false : z3, (i & 16) != 0 ? false : z4, (i & 32) != 0 ? n.emptyList() : list2);
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.channels.list.WidgetChannelListModel */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ WidgetChannelListModel copy$default(WidgetChannelListModel widgetChannelListModel, Guild guild, List list, boolean z2, boolean z3, boolean z4, List list2, int i, Object obj) {
if ((i & 1) != 0) {
guild = widgetChannelListModel.selectedGuild;
}
if ((i & 2) != 0) {
list = widgetChannelListModel.items;
}
if ((i & 4) != 0) {
z2 = widgetChannelListModel.isGuildSelected;
}
if ((i & 8) != 0) {
z3 = widgetChannelListModel.showPremiumGuildHint;
}
if ((i & 16) != 0) {
z4 = widgetChannelListModel.showEmptyState;
}
if ((i & 32) != 0) {
list2 = widgetChannelListModel.guildScheduledEvents;
}
return widgetChannelListModel.copy(guild, list, z2, z3, z4, list2);
}
public final Guild component1() {
return this.selectedGuild;
}
public final List<ChannelListItem> component2() {
return this.items;
}
public final boolean component3() {
return this.isGuildSelected;
}
public final boolean component4() {
return this.showPremiumGuildHint;
}
public final boolean component5() {
return this.showEmptyState;
}
public final List<GuildScheduledEvent> component6() {
return this.guildScheduledEvents;
}
public final WidgetChannelListModel copy(Guild guild, List<? extends ChannelListItem> list, boolean z2, boolean z3, boolean z4, List<GuildScheduledEvent> list2) {
m.checkNotNullParameter(list, "items");
m.checkNotNullParameter(list2, "guildScheduledEvents");
return new WidgetChannelListModel(guild, list, z2, z3, z4, list2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WidgetChannelListModel)) {
return false;
}
WidgetChannelListModel widgetChannelListModel = (WidgetChannelListModel) obj;
return m.areEqual(this.selectedGuild, widgetChannelListModel.selectedGuild) && m.areEqual(this.items, widgetChannelListModel.items) && this.isGuildSelected == widgetChannelListModel.isGuildSelected && this.showPremiumGuildHint == widgetChannelListModel.showPremiumGuildHint && this.showEmptyState == widgetChannelListModel.showEmptyState && m.areEqual(this.guildScheduledEvents, widgetChannelListModel.guildScheduledEvents);
}
public final List<GuildScheduledEvent> getGuildScheduledEvents() {
return this.guildScheduledEvents;
}
public final List<ChannelListItem> getItems() {
return this.items;
}
public final Guild getSelectedGuild() {
return this.selectedGuild;
}
public final boolean getShowEmptyState() {
return this.showEmptyState;
}
public final boolean getShowPremiumGuildHint() {
return this.showPremiumGuildHint;
}
public final boolean getStartsWithPaddedElement() {
ChannelListItem channelListItem = (ChannelListItem) u.firstOrNull((List<? extends Object>) this.items);
if (channelListItem != null) {
return (channelListItem instanceof ChannelListItemInvite) || (channelListItem instanceof ChannelListItemMfaNotice) || (channelListItem instanceof ChannelListItemCategory) || (channelListItem instanceof ChannelListItemEventsSeparator) || (channelListItem instanceof ChannelListItemGuildJoinRequest);
}
return false;
}
public int hashCode() {
Guild guild = this.selectedGuild;
int i = 0;
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
List<ChannelListItem> list = this.items;
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
boolean z2 = this.isGuildSelected;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode2 + i3) * 31;
boolean z3 = this.showPremiumGuildHint;
if (z3) {
z3 = true;
}
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = (i6 + i7) * 31;
boolean z4 = this.showEmptyState;
if (!z4) {
i2 = z4 ? 1 : 0;
}
int i11 = (i10 + i2) * 31;
List<GuildScheduledEvent> list2 = this.guildScheduledEvents;
if (list2 != null) {
i = list2.hashCode();
}
return i11 + i;
}
public final boolean isGuildSelected() {
return this.isGuildSelected;
}
public String toString() {
StringBuilder R = a.R("WidgetChannelListModel(selectedGuild=");
R.append(this.selectedGuild);
R.append(", items=");
R.append(this.items);
R.append(", isGuildSelected=");
R.append(this.isGuildSelected);
R.append(", showPremiumGuildHint=");
R.append(this.showPremiumGuildHint);
R.append(", showEmptyState=");
R.append(this.showEmptyState);
R.append(", guildScheduledEvents=");
return a.K(R, this.guildScheduledEvents, ")");
}
}