288 lines
12 KiB
Java
288 lines
12 KiB
Java
package com.discord.utilities.channel;
|
|
|
|
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.models.domain.ModelNotificationSettings;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.permissions.ManageGuildContext;
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
import com.discord.utilities.rx.ObservableWithLeadingEdgeThrottle;
|
|
import d0.t.n;
|
|
import d0.t.r;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.TreeMap;
|
|
import java.util.TreeSet;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
/* compiled from: GuildChannelsInfo.kt */
|
|
public final class GuildChannelsInfo {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final boolean ableToInstantInvite;
|
|
private final boolean canChangeNickname;
|
|
private final Map<Long, Long> channelPermissions;
|
|
private final GuildRole everyoneRole;
|
|
private final Guild guild;
|
|
private final boolean hideMutedChannels;
|
|
private final boolean isVerifiedServer;
|
|
private final ManageGuildContext manageGuildContext;
|
|
private final ModelNotificationSettings notificationSettings;
|
|
private final boolean unelevated;
|
|
|
|
/* compiled from: GuildChannelsInfo.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Observable<GuildChannelsInfo> get(long j) {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
Observable<GuildChannelsInfo> r = ObservableWithLeadingEdgeThrottle.combineLatest(companion.getUsers().observeMe(true), companion.getGuilds().observeGuild(j), companion.getUserGuildSettings().observeGuildSettings(j), companion.getUserGuildSettings().observeHideMutedChannels(j), companion.getGuilds().observeRoles(j), companion.getPermissions().observePermissionsForGuild(j), companion.getPermissions().observeChannelPermissionsForGuild(j), companion.getChannels().observeChannelCategories(j), GuildChannelsInfo$Companion$get$1.INSTANCE, 500, TimeUnit.MILLISECONDS).r();
|
|
m.checkNotNullExpressionValue(r, "ObservableWithLeadingEdg… .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
public GuildChannelsInfo(Guild guild, GuildRole guildRole, ModelNotificationSettings modelNotificationSettings, boolean z2, Map<Long, Long> map, boolean z3, boolean z4, boolean z5, ManageGuildContext manageGuildContext, boolean z6) {
|
|
m.checkNotNullParameter(modelNotificationSettings, "notificationSettings");
|
|
m.checkNotNullParameter(map, "channelPermissions");
|
|
m.checkNotNullParameter(manageGuildContext, "manageGuildContext");
|
|
this.guild = guild;
|
|
this.everyoneRole = guildRole;
|
|
this.notificationSettings = modelNotificationSettings;
|
|
this.hideMutedChannels = z2;
|
|
this.channelPermissions = map;
|
|
this.ableToInstantInvite = z3;
|
|
this.unelevated = z4;
|
|
this.isVerifiedServer = z5;
|
|
this.manageGuildContext = manageGuildContext;
|
|
this.canChangeNickname = z6;
|
|
}
|
|
|
|
public static /* synthetic */ GuildChannelsInfo copy$default(GuildChannelsInfo guildChannelsInfo, Guild guild, GuildRole guildRole, ModelNotificationSettings modelNotificationSettings, boolean z2, Map map, boolean z3, boolean z4, boolean z5, ManageGuildContext manageGuildContext, boolean z6, int i, Object obj) {
|
|
return guildChannelsInfo.copy((i & 1) != 0 ? guildChannelsInfo.guild : guild, (i & 2) != 0 ? guildChannelsInfo.everyoneRole : guildRole, (i & 4) != 0 ? guildChannelsInfo.notificationSettings : modelNotificationSettings, (i & 8) != 0 ? guildChannelsInfo.hideMutedChannels : z2, (i & 16) != 0 ? guildChannelsInfo.channelPermissions : map, (i & 32) != 0 ? guildChannelsInfo.ableToInstantInvite : z3, (i & 64) != 0 ? guildChannelsInfo.unelevated : z4, (i & 128) != 0 ? guildChannelsInfo.isVerifiedServer : z5, (i & 256) != 0 ? guildChannelsInfo.manageGuildContext : manageGuildContext, (i & 512) != 0 ? guildChannelsInfo.canChangeNickname : z6);
|
|
}
|
|
|
|
public final Guild component1() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final boolean component10() {
|
|
return this.canChangeNickname;
|
|
}
|
|
|
|
public final GuildRole component2() {
|
|
return this.everyoneRole;
|
|
}
|
|
|
|
public final ModelNotificationSettings component3() {
|
|
return this.notificationSettings;
|
|
}
|
|
|
|
public final boolean component4() {
|
|
return this.hideMutedChannels;
|
|
}
|
|
|
|
public final Map<Long, Long> component5() {
|
|
return this.channelPermissions;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.ableToInstantInvite;
|
|
}
|
|
|
|
public final boolean component7() {
|
|
return this.unelevated;
|
|
}
|
|
|
|
public final boolean component8() {
|
|
return this.isVerifiedServer;
|
|
}
|
|
|
|
public final ManageGuildContext component9() {
|
|
return this.manageGuildContext;
|
|
}
|
|
|
|
public final GuildChannelsInfo copy(Guild guild, GuildRole guildRole, ModelNotificationSettings modelNotificationSettings, boolean z2, Map<Long, Long> map, boolean z3, boolean z4, boolean z5, ManageGuildContext manageGuildContext, boolean z6) {
|
|
m.checkNotNullParameter(modelNotificationSettings, "notificationSettings");
|
|
m.checkNotNullParameter(map, "channelPermissions");
|
|
m.checkNotNullParameter(manageGuildContext, "manageGuildContext");
|
|
return new GuildChannelsInfo(guild, guildRole, modelNotificationSettings, z2, map, z3, z4, z5, manageGuildContext, z6);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof GuildChannelsInfo)) {
|
|
return false;
|
|
}
|
|
GuildChannelsInfo guildChannelsInfo = (GuildChannelsInfo) obj;
|
|
return m.areEqual(this.guild, guildChannelsInfo.guild) && m.areEqual(this.everyoneRole, guildChannelsInfo.everyoneRole) && m.areEqual(this.notificationSettings, guildChannelsInfo.notificationSettings) && this.hideMutedChannels == guildChannelsInfo.hideMutedChannels && m.areEqual(this.channelPermissions, guildChannelsInfo.channelPermissions) && this.ableToInstantInvite == guildChannelsInfo.ableToInstantInvite && this.unelevated == guildChannelsInfo.unelevated && this.isVerifiedServer == guildChannelsInfo.isVerifiedServer && m.areEqual(this.manageGuildContext, guildChannelsInfo.manageGuildContext) && this.canChangeNickname == guildChannelsInfo.canChangeNickname;
|
|
}
|
|
|
|
public final boolean getAbleToInstantInvite() {
|
|
return this.ableToInstantInvite;
|
|
}
|
|
|
|
public final boolean getCanChangeNickname() {
|
|
return this.canChangeNickname;
|
|
}
|
|
|
|
public final Map<Long, Long> getChannelPermissions() {
|
|
return this.channelPermissions;
|
|
}
|
|
|
|
public final GuildRole getEveryoneRole() {
|
|
return this.everyoneRole;
|
|
}
|
|
|
|
public final Guild getGuild() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final boolean getHideMutedChannels() {
|
|
return this.hideMutedChannels;
|
|
}
|
|
|
|
public final ManageGuildContext getManageGuildContext() {
|
|
return this.manageGuildContext;
|
|
}
|
|
|
|
public final ModelNotificationSettings getNotificationSettings() {
|
|
return this.notificationSettings;
|
|
}
|
|
|
|
public final Map<Long, Collection<Channel>> getSortedCategories(Map<Long, Channel> map) {
|
|
m.checkNotNullParameter(map, "guildChannels");
|
|
TreeMap treeMap = new TreeMap(new GuildChannelsInfo$getSortedCategories$sortedCategories$1(map));
|
|
for (Channel channel : u.filterNotNull(map.values())) {
|
|
Long valueOf = Long.valueOf(AnimatableValueParser.f1(channel) ? channel.h() : channel.r());
|
|
Object obj = treeMap.get(valueOf);
|
|
if (obj == null) {
|
|
obj = new TreeSet(AnimatableValueParser.K0(Channel.Companion));
|
|
treeMap.put(valueOf, obj);
|
|
}
|
|
((Set) obj).add(channel);
|
|
}
|
|
return treeMap;
|
|
}
|
|
|
|
public final List<Channel> getSortedVisibleChannels(Map<Long, Channel> map) {
|
|
m.checkNotNullParameter(map, "guildChannels");
|
|
Map<Long, Collection<Channel>> sortedCategories = getSortedCategories(map);
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Map.Entry<Long, Collection<Channel>> entry : sortedCategories.entrySet()) {
|
|
List arrayList2 = new ArrayList();
|
|
for (Object obj : entry.getValue()) {
|
|
Channel channel = (Channel) obj;
|
|
if (PermissionUtils.INSTANCE.hasAccess(channel, (Long) a.p0(channel, this.channelPermissions))) {
|
|
arrayList2.add(obj);
|
|
}
|
|
}
|
|
if (arrayList2.size() == 1) {
|
|
arrayList2 = n.emptyList();
|
|
}
|
|
r.addAll(arrayList, arrayList2);
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final boolean getUnelevated() {
|
|
return this.unelevated;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Guild guild = this.guild;
|
|
int i = 0;
|
|
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
|
|
GuildRole guildRole = this.everyoneRole;
|
|
int hashCode2 = (hashCode + (guildRole != null ? guildRole.hashCode() : 0)) * 31;
|
|
ModelNotificationSettings modelNotificationSettings = this.notificationSettings;
|
|
int hashCode3 = (hashCode2 + (modelNotificationSettings != null ? modelNotificationSettings.hashCode() : 0)) * 31;
|
|
boolean z2 = this.hideMutedChannels;
|
|
int i2 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = (hashCode3 + i3) * 31;
|
|
Map<Long, Long> map = this.channelPermissions;
|
|
int hashCode4 = (i6 + (map != null ? map.hashCode() : 0)) * 31;
|
|
boolean z3 = this.ableToInstantInvite;
|
|
if (z3) {
|
|
z3 = true;
|
|
}
|
|
int i7 = z3 ? 1 : 0;
|
|
int i8 = z3 ? 1 : 0;
|
|
int i9 = z3 ? 1 : 0;
|
|
int i10 = (hashCode4 + i7) * 31;
|
|
boolean z4 = this.unelevated;
|
|
if (z4) {
|
|
z4 = true;
|
|
}
|
|
int i11 = z4 ? 1 : 0;
|
|
int i12 = z4 ? 1 : 0;
|
|
int i13 = z4 ? 1 : 0;
|
|
int i14 = (i10 + i11) * 31;
|
|
boolean z5 = this.isVerifiedServer;
|
|
if (z5) {
|
|
z5 = true;
|
|
}
|
|
int i15 = z5 ? 1 : 0;
|
|
int i16 = z5 ? 1 : 0;
|
|
int i17 = z5 ? 1 : 0;
|
|
int i18 = (i14 + i15) * 31;
|
|
ManageGuildContext manageGuildContext = this.manageGuildContext;
|
|
if (manageGuildContext != null) {
|
|
i = manageGuildContext.hashCode();
|
|
}
|
|
int i19 = (i18 + i) * 31;
|
|
boolean z6 = this.canChangeNickname;
|
|
if (!z6) {
|
|
i2 = z6 ? 1 : 0;
|
|
}
|
|
return i19 + i2;
|
|
}
|
|
|
|
public final boolean isVerifiedServer() {
|
|
return this.isVerifiedServer;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("GuildChannelsInfo(guild=");
|
|
L.append(this.guild);
|
|
L.append(", everyoneRole=");
|
|
L.append(this.everyoneRole);
|
|
L.append(", notificationSettings=");
|
|
L.append(this.notificationSettings);
|
|
L.append(", hideMutedChannels=");
|
|
L.append(this.hideMutedChannels);
|
|
L.append(", channelPermissions=");
|
|
L.append(this.channelPermissions);
|
|
L.append(", ableToInstantInvite=");
|
|
L.append(this.ableToInstantInvite);
|
|
L.append(", unelevated=");
|
|
L.append(this.unelevated);
|
|
L.append(", isVerifiedServer=");
|
|
L.append(this.isVerifiedServer);
|
|
L.append(", manageGuildContext=");
|
|
L.append(this.manageGuildContext);
|
|
L.append(", canChangeNickname=");
|
|
return a.G(L, this.canChangeNickname, ")");
|
|
}
|
|
}
|