2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.stores;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
|
|
import com.discord.api.channel.Channel;
|
|
|
|
import com.discord.api.role.GuildRole;
|
|
|
|
import com.discord.api.stageinstance.StageInstance;
|
|
|
|
import com.discord.api.voice.state.StageRequestToSpeakState;
|
|
|
|
import com.discord.api.voice.state.VoiceState;
|
|
|
|
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.updates.ObservationDeck;
|
|
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
|
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
|
|
import com.discord.widgets.stage.StageChannelNotifications;
|
|
|
|
import com.discord.widgets.stage.StageRoles;
|
|
|
|
import com.discord.widgets.stage.model.StageChannel;
|
|
|
|
import d0.d0.f;
|
|
|
|
import d0.f0.n;
|
|
|
|
import d0.f0.q;
|
|
|
|
import d0.t.g0;
|
|
|
|
import d0.t.h0;
|
|
|
|
import d0.t.n0;
|
|
|
|
import d0.t.o;
|
|
|
|
import d0.t.o0;
|
|
|
|
import d0.t.r;
|
|
|
|
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.LinkedHashSet;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.sequences.Sequence;
|
|
|
|
import rx.Observable;
|
|
|
|
/* compiled from: StoreStageChannels.kt */
|
|
|
|
public final class StoreStageChannels extends StoreV2 {
|
|
|
|
public static final long CAN_MODERATE_STAGE_CHANNELS = 4194320;
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final StoreStageChannels$Companion$EventStateUpdateSource$1 EventStateUpdateSource = new StoreStageChannels$Companion$EventStateUpdateSource$1();
|
|
|
|
private final StoreChannels channelsStore;
|
|
|
|
private final Set<Long> dirtyChannelIds;
|
|
|
|
private final StoreGuilds guildsStore;
|
|
|
|
private final ObservationDeck observationDeck;
|
|
|
|
private final StorePermissions permissionsStore;
|
|
|
|
private final Map<Long, Map<Long, StageEventActivationState>> stageEventStates;
|
|
|
|
private final StoreStageInstances stageInstancesStore;
|
|
|
|
private final Map<Long, Map<Long, StageRoles>> stageRolesByChannel;
|
|
|
|
private Map<Long, ? extends Map<Long, StageRoles>> stageRolesByChannelSnapshot;
|
|
|
|
private final StoreUser userStore;
|
|
|
|
private final StoreVoiceStates voiceStatesStore;
|
|
|
|
|
|
|
|
/* compiled from: StoreStageChannels.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: StoreStageChannels.kt */
|
|
|
|
public static final class StageEventActivationState {
|
|
|
|
private final Set<Long> moderators;
|
|
|
|
|
|
|
|
public StageEventActivationState() {
|
|
|
|
this(null, 1, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public StageEventActivationState(Set<Long> set) {
|
|
|
|
m.checkNotNullParameter(set, "moderators");
|
|
|
|
this.moderators = set;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ StageEventActivationState(Set set, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this((i & 1) != 0 ? n0.emptySet() : set);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreStageChannels$StageEventActivationState */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public static /* synthetic */ StageEventActivationState copy$default(StageEventActivationState stageEventActivationState, Set set, int i, Object obj) {
|
|
|
|
if ((i & 1) != 0) {
|
|
|
|
set = stageEventActivationState.moderators;
|
|
|
|
}
|
|
|
|
return stageEventActivationState.copy(set);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Set<Long> component1() {
|
|
|
|
return this.moderators;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final StageEventActivationState copy(Set<Long> set) {
|
|
|
|
m.checkNotNullParameter(set, "moderators");
|
|
|
|
return new StageEventActivationState(set);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this != obj) {
|
|
|
|
return (obj instanceof StageEventActivationState) && m.areEqual(this.moderators, ((StageEventActivationState) obj).moderators);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Set<Long> getModerators() {
|
|
|
|
return this.moderators;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
Set<Long> set = this.moderators;
|
|
|
|
if (set != null) {
|
|
|
|
return set.hashCode();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder L = a.L("StageEventActivationState(moderators=");
|
|
|
|
L.append(this.moderators);
|
|
|
|
L.append(")");
|
|
|
|
return L.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public StoreStageChannels(StoreUser storeUser, StoreGuilds storeGuilds, StoreChannels storeChannels, StoreVoiceStates storeVoiceStates, StorePermissions storePermissions, StoreStageInstances storeStageInstances, ObservationDeck observationDeck) {
|
|
|
|
m.checkNotNullParameter(storeUser, "userStore");
|
|
|
|
m.checkNotNullParameter(storeGuilds, "guildsStore");
|
|
|
|
m.checkNotNullParameter(storeChannels, "channelsStore");
|
|
|
|
m.checkNotNullParameter(storeVoiceStates, "voiceStatesStore");
|
|
|
|
m.checkNotNullParameter(storePermissions, "permissionsStore");
|
|
|
|
m.checkNotNullParameter(storeStageInstances, "stageInstancesStore");
|
|
|
|
m.checkNotNullParameter(observationDeck, "observationDeck");
|
|
|
|
this.userStore = storeUser;
|
|
|
|
this.guildsStore = storeGuilds;
|
|
|
|
this.channelsStore = storeChannels;
|
|
|
|
this.voiceStatesStore = storeVoiceStates;
|
|
|
|
this.permissionsStore = storePermissions;
|
|
|
|
this.stageInstancesStore = storeStageInstances;
|
|
|
|
this.observationDeck = observationDeck;
|
|
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
|
|
this.stageRolesByChannel = linkedHashMap;
|
|
|
|
this.stageRolesByChannelSnapshot = new HashMap(linkedHashMap);
|
|
|
|
this.stageEventStates = new LinkedHashMap();
|
|
|
|
this.dirtyChannelIds = new LinkedHashSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ StoreStageChannels(StoreUser storeUser, StoreGuilds storeGuilds, StoreChannels storeChannels, StoreVoiceStates storeVoiceStates, StorePermissions storePermissions, StoreStageInstances storeStageInstances, ObservationDeck observationDeck, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(storeUser, storeGuilds, storeChannels, storeVoiceStates, storePermissions, storeStageInstances, (i & 64) != 0 ? ObservationDeckProvider.get() : observationDeck);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ StoreChannels access$getChannelsStore$p(StoreStageChannels storeStageChannels) {
|
|
|
|
return storeStageChannels.channelsStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ StoreGuilds access$getGuildsStore$p(StoreStageChannels storeStageChannels) {
|
|
|
|
return storeStageChannels.guildsStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Map access$getStageRolesByChannelSnapshot$p(StoreStageChannels storeStageChannels) {
|
|
|
|
return storeStageChannels.stageRolesByChannelSnapshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ StoreUser access$getUserStore$p(StoreStageChannels storeStageChannels) {
|
|
|
|
return storeStageChannels.userStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ StoreVoiceStates access$getVoiceStatesStore$p(StoreStageChannels storeStageChannels) {
|
|
|
|
return storeStageChannels.voiceStatesStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setStageRolesByChannelSnapshot$p(StoreStageChannels storeStageChannels, Map map) {
|
|
|
|
storeStageChannels.stageRolesByChannelSnapshot = map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: computeUserRolesInDispatch-t27eFtU reason: not valid java name */
|
|
|
|
private final int m4computeUserRolesInDispatcht27eFtU(long j, Channel channel, Map<Long, VoiceState> map, Map<Long, GuildRole> map2) {
|
|
|
|
Guild guild = (Guild) a.c(channel, this.guildsStore.getGuildsInternal$app_productionBetaRelease());
|
|
|
|
if (guild == null) {
|
|
|
|
return StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
Map map3 = (Map) a.c(channel, this.guildsStore.getGuildMembersComputedInternal$app_productionBetaRelease());
|
|
|
|
if (map3 == null) {
|
|
|
|
return StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
GuildMember guildMember = (GuildMember) map3.get(Long.valueOf(j));
|
|
|
|
if (guildMember == null) {
|
|
|
|
return StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
if (map2 == null) {
|
|
|
|
map2 = (Map) a.c(channel, this.guildsStore.getGuildRolesInternal$app_productionBetaRelease());
|
|
|
|
}
|
|
|
|
if (map == null) {
|
|
|
|
map = (Map) a.c(channel, this.voiceStatesStore.getInternal$app_productionBetaRelease());
|
|
|
|
}
|
|
|
|
if (map == null) {
|
|
|
|
return StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
StageChannelRoleContext roleContext = roleContext(channel, guild, map, map2);
|
|
|
|
return roleContext != null ? roleContext.m3getRoleK6mKVE(j, guildMember) : StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: computeUserRolesInDispatch-t27eFtU$default reason: not valid java name */
|
|
|
|
public static /* synthetic */ int m5computeUserRolesInDispatcht27eFtU$default(StoreStageChannels storeStageChannels, long j, Channel channel, Map map, Map map2, int i, Object obj) {
|
|
|
|
return storeStageChannels.m4computeUserRolesInDispatcht27eFtU(j, channel, (i & 4) != 0 ? null : map, (i & 8) != 0 ? null : map2);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final Guild getGuild(Channel channel) {
|
|
|
|
return (Guild) a.c(channel, this.guildsStore.getGuilds());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ int getOtherModeratorsCountInChannel$default(StoreStageChannels storeStageChannels, Channel channel, long j, int i, Object obj) {
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
j = storeStageChannels.userStore.getMe().getId();
|
|
|
|
}
|
|
|
|
return storeStageChannels.getOtherModeratorsCountInChannel(channel, j);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final Map<Long, GuildRole> getRolesMap(Guild guild) {
|
|
|
|
Map<Long, GuildRole> map = this.guildsStore.getRoles().get(Long.valueOf(guild.getId()));
|
|
|
|
return map != null ? map : h0.emptyMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ Map getStageChannelsInGuild$default(StoreStageChannels storeStageChannels, long j, Map map, long j2, Map map2, Map map3, int i, Object obj) {
|
|
|
|
Map<Long, VoiceState> map4;
|
|
|
|
Map<Long, Channel> channelsForGuild = (i & 2) != 0 ? storeStageChannels.channelsStore.getChannelsForGuild(j) : map;
|
|
|
|
long id2 = (i & 4) != 0 ? storeStageChannels.userStore.getMe().getId() : j2;
|
|
|
|
Map<Long, User> users = (i & 8) != 0 ? storeStageChannels.userStore.getUsers() : map2;
|
|
|
|
if ((i & 16) != 0) {
|
|
|
|
Map<Long, VoiceState> map5 = storeStageChannels.voiceStatesStore.get().get(Long.valueOf(j));
|
|
|
|
if (map5 == null) {
|
|
|
|
map5 = h0.emptyMap();
|
|
|
|
}
|
|
|
|
map4 = map5;
|
|
|
|
} else {
|
|
|
|
map4 = map3;
|
|
|
|
}
|
|
|
|
return storeStageChannels.getStageChannelsInGuild(j, channelsForGuild, id2, users, map4);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: handleUserJoinedStageOrGainedRole-oRmTEFA reason: not valid java name */
|
|
|
|
private final void m6handleUserJoinedStageOrGainedRoleoRmTEFA(Channel channel, long j, int i) {
|
|
|
|
if (StageRoles.m25isModeratorimpl(i) || StageRoles.m26isSpeakerimpl(i)) {
|
|
|
|
Map<Long, StageEventActivationState> map = (Map) a.c(channel, this.stageEventStates);
|
|
|
|
if (map == null) {
|
|
|
|
map = new LinkedHashMap<>();
|
2021-07-03 23:36:06 +00:00
|
|
|
this.stageEventStates.put(Long.valueOf(channel.f()), map);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
StageEventActivationState stageEventActivationState = (StageEventActivationState) a.d(channel, map);
|
|
|
|
boolean z2 = true;
|
|
|
|
if (stageEventActivationState == null) {
|
|
|
|
stageEventActivationState = new StageEventActivationState(null, 1, null);
|
2021-07-03 23:36:06 +00:00
|
|
|
map.put(Long.valueOf(channel.h()), stageEventActivationState);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (!StageRoles.m25isModeratorimpl(i) || stageEventActivationState.getModerators().contains(Long.valueOf(j))) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if (z2) {
|
2021-07-03 23:36:06 +00:00
|
|
|
map.put(Long.valueOf(channel.h()), stageEventActivationState.copy(z2 ? o0.plus(stageEventActivationState.getModerators(), Long.valueOf(j)) : stageEventActivationState.getModerators()));
|
2021-06-27 20:44:35 +00:00
|
|
|
markStageEventDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: handleUserLeftStageOrLostRoles-GM3QuyE reason: not valid java name */
|
|
|
|
private final void m7handleUserLeftStageOrLostRolesGM3QuyE(Channel channel, long j, int i, int i2) {
|
|
|
|
Map map;
|
|
|
|
StageEventActivationState stageEventActivationState;
|
|
|
|
if ((StageRoles.m25isModeratorimpl(i) || StageRoles.m26isSpeakerimpl(i)) && (map = (Map) a.c(channel, this.stageEventStates)) != null && (stageEventActivationState = (StageEventActivationState) a.d(channel, map)) != null) {
|
|
|
|
boolean z2 = !StageRoles.m25isModeratorimpl(i2) && StageRoles.m25isModeratorimpl(i) && stageEventActivationState.getModerators().contains(Long.valueOf(j));
|
|
|
|
if (z2) {
|
2021-07-03 23:36:06 +00:00
|
|
|
map.put(Long.valueOf(channel.h()), stageEventActivationState.copy(z2 ? o0.minus(stageEventActivationState.getModerators(), Long.valueOf(j)) : stageEventActivationState.getModerators()));
|
2021-06-27 20:44:35 +00:00
|
|
|
markStageEventDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: handleUserLeftStageOrLostRoles-GM3QuyE$default reason: not valid java name */
|
|
|
|
public static /* synthetic */ void m8handleUserLeftStageOrLostRolesGM3QuyE$default(StoreStageChannels storeStageChannels, Channel channel, long j, int i, int i2, int i3, Object obj) {
|
|
|
|
if ((i3 & 8) != 0) {
|
|
|
|
i2 = StageRoles.Companion.m30getAUDIENCE1LxfuJo();
|
|
|
|
}
|
|
|
|
storeStageChannels.m7handleUserLeftStageOrLostRolesGM3QuyE(channel, j, i, i2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: handleUserRoleChange-uOJZ9lM reason: not valid java name */
|
|
|
|
private final void m9handleUserRoleChangeuOJZ9lM(Channel channel, long j, StageRoles stageRoles, int i) {
|
|
|
|
if ((StageRoles.m25isModeratorimpl(i) && (stageRoles == null || !StageRoles.m25isModeratorimpl(stageRoles.m28unboximpl()))) || (StageRoles.m26isSpeakerimpl(i) && (stageRoles == null || !StageRoles.m26isSpeakerimpl(stageRoles.m28unboximpl())))) {
|
|
|
|
m6handleUserJoinedStageOrGainedRoleoRmTEFA(channel, j, i);
|
|
|
|
}
|
|
|
|
if ((stageRoles != null && StageRoles.m25isModeratorimpl(stageRoles.m28unboximpl()) && !StageRoles.m25isModeratorimpl(i)) || (stageRoles != null && StageRoles.m26isSpeakerimpl(stageRoles.m28unboximpl()) && !StageRoles.m26isSpeakerimpl(i))) {
|
|
|
|
m7handleUserLeftStageOrLostRolesGM3QuyE(channel, j, stageRoles.m28unboximpl(), i);
|
|
|
|
}
|
|
|
|
if (j != this.userStore.getMe().getId()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (stageRoles != null && !StageRoles.m24isInvitedToSpeakimpl(stageRoles.m28unboximpl()) && StageRoles.m24isInvitedToSpeakimpl(i)) {
|
2021-07-03 23:36:06 +00:00
|
|
|
StageChannelNotifications.Companion.getINSTANCE().onInvitedToSpeak(channel.h());
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (stageRoles != null && StageRoles.m24isInvitedToSpeakimpl(stageRoles.m28unboximpl()) && !StageRoles.m24isInvitedToSpeakimpl(i)) {
|
|
|
|
StageChannelNotifications.Companion.getINSTANCE().onInviteToSpeakRescinded();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void markStageEventDirty() {
|
|
|
|
markChanged(EventStateUpdateSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final StageChannelRoleContext roleContext(Channel channel, Guild guild, Map<Long, VoiceState> map, Map<Long, GuildRole> map2) {
|
|
|
|
if (guild == null) {
|
|
|
|
guild = getGuild(channel);
|
|
|
|
}
|
|
|
|
if (guild == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (map == null) {
|
2021-07-03 23:36:06 +00:00
|
|
|
map = this.voiceStatesStore.getForChannel(guild.getId(), channel.h());
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (map2 == null) {
|
|
|
|
map2 = getRolesMap(guild);
|
|
|
|
}
|
|
|
|
return new StageChannelRoleContext(guild, channel, map2, map);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: com.discord.stores.StoreStageChannels */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public static /* synthetic */ StageChannelRoleContext roleContext$default(StoreStageChannels storeStageChannels, Channel channel, Guild guild, Map map, Map map2, int i, Object obj) {
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
guild = null;
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
map = null;
|
|
|
|
}
|
|
|
|
if ((i & 8) != 0) {
|
|
|
|
map2 = null;
|
|
|
|
}
|
|
|
|
return storeStageChannels.roleContext(channel, guild, map, map2);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final Sequence<Long> stageChannelIdsInGuildForDispatch(long j) {
|
|
|
|
Collection<Channel> values;
|
|
|
|
Sequence asSequence;
|
|
|
|
Sequence<Long> mapNotNull;
|
|
|
|
Map<Long, Channel> channelsForGuildInternal$app_productionBetaRelease = this.channelsStore.getChannelsForGuildInternal$app_productionBetaRelease(j);
|
|
|
|
return (channelsForGuildInternal$app_productionBetaRelease == null || (values = channelsForGuildInternal$app_productionBetaRelease.values()) == null || (asSequence = u.asSequence(values)) == null || (mapNotNull = q.mapNotNull(asSequence, StoreStageChannels$stageChannelIdsInGuildForDispatch$1.INSTANCE)) == null) ? n.emptySequence() : mapNotNull;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, StageRoles> getChannelRoles(long j) {
|
|
|
|
return (Map) this.stageRolesByChannelSnapshot.get(Long.valueOf(j));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, StageRoles> getChannelRolesInternal(long j) {
|
|
|
|
return this.stageRolesByChannel.get(Long.valueOf(j));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: getMyRoles-visDeB4 reason: not valid java name */
|
|
|
|
public final StageRoles m10getMyRolesvisDeB4(long j) {
|
|
|
|
return m12getUserRolesuOBN1zc(this.userStore.getMe().getId(), j);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: getMyRolesInternal-visDeB4 reason: not valid java name */
|
|
|
|
public final StageRoles m11getMyRolesInternalvisDeB4(long j) {
|
|
|
|
return m13getUserRolesInternaluOBN1zc(this.userStore.getMe().getId(), j);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int getOtherModeratorsCountInChannel(Channel channel, long j) {
|
|
|
|
StageEventActivationState stageEventActivationState;
|
|
|
|
m.checkNotNullParameter(channel, "channel");
|
|
|
|
Map map = (Map) a.c(channel, this.stageEventStates);
|
|
|
|
if (map == null || (stageEventActivationState = (StageEventActivationState) a.d(channel, map)) == null) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int size = stageEventActivationState.getModerators().size();
|
|
|
|
return stageEventActivationState.getModerators().contains(Long.valueOf(j)) ? size - 1 : size;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, StageChannel> getStageChannelsInGuild(long j, Map<Long, Channel> map, long j2, Map<Long, ? extends User> map2, Map<Long, VoiceState> map3) {
|
|
|
|
ArrayList arrayList;
|
|
|
|
Iterator it;
|
|
|
|
StageChannel stageChannel;
|
|
|
|
StoreStageChannels storeStageChannels = this;
|
|
|
|
Map<Long, ? extends User> map4 = map2;
|
|
|
|
m.checkNotNullParameter(map, "channelsInGuild");
|
|
|
|
m.checkNotNullParameter(map4, "users");
|
|
|
|
m.checkNotNullParameter(map3, "voiceStates");
|
|
|
|
Collection<Channel> values = map.values();
|
|
|
|
ArrayList arrayList2 = new ArrayList();
|
|
|
|
Iterator it2 = values.iterator();
|
|
|
|
while (it2.hasNext()) {
|
|
|
|
Channel channel = (Channel) it2.next();
|
|
|
|
Map map5 = (Map) a.d(channel, storeStageChannels.stageRolesByChannelSnapshot);
|
|
|
|
if (map5 != null) {
|
|
|
|
Set<Number> keySet = map5.keySet();
|
|
|
|
ArrayList arrayList3 = new ArrayList();
|
|
|
|
for (Number number : keySet) {
|
|
|
|
User user = (User) map4.get(Long.valueOf(number.longValue()));
|
|
|
|
if (user != null) {
|
|
|
|
arrayList3.add(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ArrayList<User> arrayList4 = new ArrayList();
|
|
|
|
for (Object obj : arrayList3) {
|
2021-07-03 23:36:06 +00:00
|
|
|
StageRoles r11 = storeStageChannels.m12getUserRolesuOBN1zc(((User) obj).getId(), channel.h());
|
2021-06-27 20:44:35 +00:00
|
|
|
if (r11 != null && StageRoles.m26isSpeakerimpl(r11.m28unboximpl())) {
|
|
|
|
arrayList4.add(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ArrayList arrayList5 = new ArrayList(o.collectionSizeOrDefault(arrayList4, 10));
|
|
|
|
for (User user2 : arrayList4) {
|
|
|
|
arrayList5.add(Long.valueOf(user2.getId()));
|
|
|
|
}
|
|
|
|
Set set = u.toSet(arrayList5);
|
|
|
|
int size = arrayList3.size() - set.size();
|
|
|
|
Long l = (Long) a.d(channel, storeStageChannels.permissionsStore.getPermissionsByChannel());
|
|
|
|
boolean z2 = PermissionUtils.can(1048576, l) && PermissionUtils.can(1024, l);
|
|
|
|
Map<Long, GuildMember> map6 = storeStageChannels.guildsStore.getMembers().get(Long.valueOf(j));
|
|
|
|
ArrayList<User> arrayList6 = new ArrayList();
|
|
|
|
for (Object obj2 : arrayList3) {
|
|
|
|
if (set.contains(Long.valueOf(((User) obj2).getId()))) {
|
|
|
|
arrayList6.add(obj2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ArrayList arrayList7 = new ArrayList(o.collectionSizeOrDefault(arrayList6, 10));
|
|
|
|
for (User user3 : arrayList6) {
|
|
|
|
arrayList7.add(new UserGuildMember(user3, map6 != null ? (GuildMember) a.e(user3, map6) : null));
|
|
|
|
}
|
|
|
|
it = it2;
|
|
|
|
arrayList = arrayList2;
|
2021-07-03 23:36:06 +00:00
|
|
|
StageRoles r9 = storeStageChannels.m10getMyRolesvisDeB4(channel.h());
|
|
|
|
StageInstance stageInstanceForChannel = storeStageChannels.stageInstancesStore.getStageInstanceForChannel(channel.h());
|
2021-06-27 20:44:35 +00:00
|
|
|
VoiceState voiceState = map3.get(Long.valueOf(j2));
|
|
|
|
Long a = voiceState != null ? voiceState.a() : null;
|
2021-07-03 23:36:06 +00:00
|
|
|
stageChannel = new StageChannel(channel, arrayList3, r9, set, arrayList7, size, stageInstanceForChannel, z2, a != null && a.longValue() == channel.h(), null);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
it = it2;
|
|
|
|
arrayList = arrayList2;
|
|
|
|
stageChannel = null;
|
|
|
|
}
|
|
|
|
if (stageChannel != null) {
|
|
|
|
arrayList.add(stageChannel);
|
|
|
|
map4 = map2;
|
|
|
|
arrayList2 = arrayList;
|
|
|
|
it2 = it;
|
|
|
|
storeStageChannels = this;
|
|
|
|
} else {
|
|
|
|
storeStageChannels = this;
|
|
|
|
arrayList2 = arrayList;
|
|
|
|
map4 = map2;
|
|
|
|
it2 = it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap(f.coerceAtLeast(g0.mapCapacity(o.collectionSizeOrDefault(arrayList2, 10)), 16));
|
|
|
|
for (Object obj3 : arrayList2) {
|
2021-07-03 23:36:06 +00:00
|
|
|
linkedHashMap.put(Long.valueOf(((StageChannel) obj3).getChannel().h()), obj3);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
return linkedHashMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: getUserRoles-uOBN1zc reason: not valid java name */
|
|
|
|
public final StageRoles m12getUserRolesuOBN1zc(long j, long j2) {
|
|
|
|
Map map = (Map) this.stageRolesByChannelSnapshot.get(Long.valueOf(j2));
|
|
|
|
if (map == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
StageRoles stageRoles = (StageRoles) map.get(Long.valueOf(j));
|
|
|
|
return StageRoles.m18boximpl(stageRoles != null ? stageRoles.m28unboximpl() : StageRoles.Companion.m30getAUDIENCE1LxfuJo());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* renamed from: getUserRolesInternal-uOBN1zc reason: not valid java name */
|
|
|
|
public final StageRoles m13getUserRolesInternaluOBN1zc(long j, long j2) {
|
|
|
|
Map<Long, StageRoles> map = this.stageRolesByChannel.get(Long.valueOf(j2));
|
|
|
|
if (map == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
StageRoles stageRoles = map.get(Long.valueOf(j));
|
|
|
|
return StageRoles.m18boximpl(stageRoles != null ? stageRoles.m28unboximpl() : StageRoles.Companion.m30getAUDIENCE1LxfuJo());
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleChannelDelete(Channel channel) {
|
|
|
|
m.checkNotNullParameter(channel, "channel");
|
2021-07-03 23:36:06 +00:00
|
|
|
if (AnimatableValueParser.v1(channel)) {
|
|
|
|
if (this.stageRolesByChannel.remove(Long.valueOf(channel.h())) != null) {
|
|
|
|
this.dirtyChannelIds.add(Long.valueOf(channel.h()));
|
2021-06-27 20:44:35 +00:00
|
|
|
markChanged();
|
|
|
|
}
|
|
|
|
Map map = (Map) a.c(channel, this.stageEventStates);
|
2021-07-03 23:36:06 +00:00
|
|
|
if (map != null && ((StageEventActivationState) map.remove(Long.valueOf(channel.h()))) != null) {
|
2021-06-27 20:44:35 +00:00
|
|
|
markStageEventDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleConnectionOpen() {
|
|
|
|
this.stageRolesByChannel.clear();
|
|
|
|
this.stageEventStates.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleGuildMemberAdd(com.discord.api.guildmember.GuildMember guildMember) {
|
|
|
|
StageRoles stageRoles;
|
|
|
|
m.checkNotNullParameter(guildMember, "member");
|
|
|
|
User user = this.userStore.getUsersInternal$app_productionBetaRelease().get(Long.valueOf(guildMember.j().i()));
|
|
|
|
if (user == null || !user.isBot()) {
|
|
|
|
for (Long l : stageChannelIdsInGuildForDispatch(guildMember.c())) {
|
|
|
|
long longValue = l.longValue();
|
|
|
|
Map<Long, StageRoles> map = this.stageRolesByChannel.get(Long.valueOf(longValue));
|
|
|
|
if (!(map == null || (stageRoles = map.get(Long.valueOf(guildMember.j().i()))) == null)) {
|
|
|
|
int r15 = stageRoles.m28unboximpl();
|
|
|
|
Channel channel = this.channelsStore.getChannelsByIdInternal$app_productionBetaRelease().get(Long.valueOf(longValue));
|
|
|
|
if (channel != null) {
|
|
|
|
int r5 = m5computeUserRolesInDispatcht27eFtU$default(this, guildMember.j().i(), channel, null, null, 12, null);
|
|
|
|
if (!StageRoles.m21equalsimpl0(r5, r15)) {
|
|
|
|
map.put(Long.valueOf(guildMember.j().i()), StageRoles.m18boximpl(r5));
|
|
|
|
m9handleUserRoleChangeuOJZ9lM(channel, guildMember.j().i(), StageRoles.m18boximpl(r15), r5);
|
|
|
|
this.dirtyChannelIds.add(Long.valueOf(longValue));
|
|
|
|
markChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleGuildMemberRemove(long j, long j2) {
|
|
|
|
StageRoles stageRoles;
|
|
|
|
Channel channel;
|
|
|
|
User user = this.userStore.getUsersInternal$app_productionBetaRelease().get(Long.valueOf(j2));
|
|
|
|
if (user == null || !user.isBot()) {
|
|
|
|
for (Long l : stageChannelIdsInGuildForDispatch(j)) {
|
|
|
|
long longValue = l.longValue();
|
|
|
|
Map<Long, StageRoles> map = this.stageRolesByChannel.get(Long.valueOf(longValue));
|
|
|
|
if (!(map == null || (stageRoles = map.get(Long.valueOf(j2))) == null || (channel = this.channelsStore.getChannelsByIdInternal$app_productionBetaRelease().get(Long.valueOf(longValue))) == null)) {
|
|
|
|
m8handleUserLeftStageOrLostRolesGM3QuyE$default(this, channel, j2, stageRoles.m28unboximpl(), 0, 8, null);
|
|
|
|
this.dirtyChannelIds.add(Long.valueOf(longValue));
|
|
|
|
markChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleGuildRemove(com.discord.api.guild.Guild guild) {
|
|
|
|
m.checkNotNullParameter(guild, "guild");
|
|
|
|
if (this.stageEventStates.remove(Long.valueOf(guild.o())) != null) {
|
|
|
|
markStageEventDirty();
|
|
|
|
}
|
|
|
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
|
|
|
for (Number number : this.channelsStore.getChannelsForGuild(guild.o()).keySet()) {
|
|
|
|
long longValue = number.longValue();
|
|
|
|
if (this.stageRolesByChannel.remove(Long.valueOf(longValue)) != null) {
|
|
|
|
linkedHashSet.add(Long.valueOf(longValue));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!linkedHashSet.isEmpty()) {
|
|
|
|
r.addAll(this.dirtyChannelIds, linkedHashSet);
|
|
|
|
markChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleGuildRoleCreateOrUpdate(long j) {
|
|
|
|
for (Long l : stageChannelIdsInGuildForDispatch(j)) {
|
|
|
|
long longValue = l.longValue();
|
|
|
|
Map<Long, StageRoles> map = this.stageRolesByChannel.get(Long.valueOf(longValue));
|
|
|
|
if (map != null) {
|
|
|
|
for (Number number : u.toList(map.keySet())) {
|
|
|
|
handleVoiceStatesUpdated(j, longValue, number.longValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
public final void handleVoiceStatesUpdated(long j, long j2, long j3) {
|
|
|
|
boolean z2;
|
|
|
|
Long a;
|
|
|
|
Long a2;
|
|
|
|
Map<Long, VoiceState> map = this.voiceStatesStore.getInternal$app_productionBetaRelease().get(Long.valueOf(j));
|
|
|
|
StageRoles stageRoles = null;
|
|
|
|
VoiceState voiceState = map != null ? map.get(Long.valueOf(j3)) : null;
|
|
|
|
long longValue = (voiceState == null || (a2 = voiceState.a()) == null) ? j2 : a2.longValue();
|
|
|
|
Channel channelInternal$app_productionBetaRelease = this.channelsStore.getChannelInternal$app_productionBetaRelease(j, longValue);
|
|
|
|
Channel channelInternal$app_productionBetaRelease2 = this.channelsStore.getChannelInternal$app_productionBetaRelease(j, j2);
|
2021-07-03 23:36:06 +00:00
|
|
|
if (channelInternal$app_productionBetaRelease2 != null && AnimatableValueParser.v1(channelInternal$app_productionBetaRelease2) && (voiceState == null || (a = voiceState.a()) == null || a.longValue() != j2)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Map<Long, StageRoles> map2 = this.stageRolesByChannel.get(Long.valueOf(j2));
|
|
|
|
if (map2 != null) {
|
|
|
|
stageRoles = map2.remove(Long.valueOf(j3));
|
|
|
|
}
|
|
|
|
if (stageRoles != null) {
|
|
|
|
z2 = true;
|
|
|
|
m8handleUserLeftStageOrLostRolesGM3QuyE$default(this, channelInternal$app_productionBetaRelease2, j3, stageRoles.m28unboximpl(), 0, 8, null);
|
|
|
|
this.dirtyChannelIds.add(Long.valueOf(j2));
|
|
|
|
markChanged();
|
2021-07-03 23:36:06 +00:00
|
|
|
if (voiceState != null && channelInternal$app_productionBetaRelease != null && AnimatableValueParser.v1(channelInternal$app_productionBetaRelease) == z2) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Map<Long, StageRoles> map3 = this.stageRolesByChannel.get(Long.valueOf(longValue));
|
|
|
|
if (map3 == null) {
|
|
|
|
map3 = new LinkedHashMap<>();
|
|
|
|
this.stageRolesByChannel.put(Long.valueOf(longValue), map3);
|
|
|
|
}
|
|
|
|
StageRoles stageRoles2 = map3.get(Long.valueOf(j3));
|
|
|
|
int r6 = m5computeUserRolesInDispatcht27eFtU$default(this, j3, channelInternal$app_productionBetaRelease, map, null, 8, null);
|
|
|
|
if (StageRoles.m20equalsimpl(r6, stageRoles2) ^ z2) {
|
|
|
|
m9handleUserRoleChangeuOJZ9lM(channelInternal$app_productionBetaRelease, j3, stageRoles2, r6);
|
|
|
|
map3.put(Long.valueOf(j3), StageRoles.m18boximpl(r6));
|
|
|
|
this.dirtyChannelIds.add(Long.valueOf(longValue));
|
|
|
|
markChanged();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
z2 = true;
|
|
|
|
if (voiceState != null) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<Map<Long, StageChannel>> observeGuildStageChannels(long j) {
|
2021-07-03 23:36:06 +00:00
|
|
|
Observable<Map<Long, StageChannel>> r = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore, this.userStore, this.voiceStatesStore, this.stageInstancesStore}, false, null, null, new StoreStageChannels$observeGuildStageChannels$1(this, j), 14, null).r();
|
|
|
|
m.checkNotNullExpressionValue(r, "observationDeck.connectR… }.distinctUntilChanged()");
|
|
|
|
return r;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<StageRequestToSpeakState> observeMyRequestToSpeakState(long j) {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore, this.guildsStore, this.userStore, this.voiceStatesStore}, false, null, null, new StoreStageChannels$observeMyRequestToSpeakState$1(this, j), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<StageRoles> observeMyRoles(long j) {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore}, false, null, null, new StoreStageChannels$observeMyRoles$1(this, j), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<Map<Long, Map<Long, StageRoles>>> observeRoles() {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreStageChannels$observeRoles$1(this), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<Map<Long, StageChannel>> observeStageChannels() {
|
2021-07-03 23:36:06 +00:00
|
|
|
Observable<Map<Long, StageChannel>> r = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore, this.guildsStore, this.userStore, this.voiceStatesStore, this.stageInstancesStore}, false, null, null, new StoreStageChannels$observeStageChannels$1(this), 14, null).r();
|
|
|
|
m.checkNotNullExpressionValue(r, "observationDeck.connectR… }.distinctUntilChanged()");
|
|
|
|
return r;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<Map<Long, StageRoles>> observeStageRolesByChannel(long j) {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreStageChannels$observeStageRolesByChannel$1(this, j), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<StageRequestToSpeakState> observeUserRequestToSpeakState(long j, long j2) {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore, this.guildsStore, this.voiceStatesStore}, false, null, null, new StoreStageChannels$observeUserRequestToSpeakState$1(this, j2, j), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<StageRoles> observeUserRoles(long j, long j2) {
|
|
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this, this.channelsStore}, false, null, null, new StoreStageChannels$observeUserRoles$1(this, j2, j), 14, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.stores.StoreV2
|
|
|
|
@StoreThread
|
|
|
|
public void snapshotData() {
|
|
|
|
Map<Long, Map<Long, StageRoles>> map = this.stageRolesByChannel;
|
|
|
|
Map<Long, ? extends Map<Long, StageRoles>> map2 = this.stageRolesByChannelSnapshot;
|
|
|
|
Set<Long> set = this.dirtyChannelIds;
|
|
|
|
if (!set.isEmpty()) {
|
|
|
|
HashMap hashMap = new HashMap(map.size());
|
|
|
|
for (Map.Entry<Long, Map<Long, StageRoles>> entry : map.entrySet()) {
|
|
|
|
Long key = entry.getKey();
|
|
|
|
Map<Long, StageRoles> value = entry.getValue();
|
|
|
|
if (set.contains(key)) {
|
|
|
|
key.longValue();
|
|
|
|
hashMap.put(key, new HashMap(value));
|
|
|
|
} else {
|
|
|
|
Object obj = map2.get(key);
|
|
|
|
if (obj != null) {
|
|
|
|
hashMap.put(key, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
map2 = hashMap;
|
|
|
|
}
|
|
|
|
this.stageRolesByChannelSnapshot = map2;
|
|
|
|
this.dirtyChannelIds.clear();
|
|
|
|
}
|
|
|
|
}
|