2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guilds.invite;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
|
|
import com.discord.api.channel.Channel;
|
2021-08-13 06:23:11 +00:00
|
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.api.stageinstance.StageInstance;
|
|
|
|
import com.discord.models.domain.ModelInvite;
|
|
|
|
import com.discord.models.guild.Guild;
|
|
|
|
import com.discord.models.user.MeUser;
|
|
|
|
import com.discord.utilities.guilds.GuildUtilsKt;
|
|
|
|
import com.discord.widgets.guilds.invite.InviteGenerator;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: WidgetInviteModel.kt */
|
|
|
|
public final class WidgetInviteModel {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final List<Channel> dms;
|
|
|
|
private final List<Channel> invitableChannels;
|
|
|
|
private final ModelInvite invite;
|
|
|
|
private final boolean isGeneratingInvite;
|
|
|
|
private final boolean isValidInvite;
|
|
|
|
|
|
|
|
/* renamed from: me reason: collision with root package name */
|
2021-08-27 06:37:59 +00:00
|
|
|
private final MeUser f2211me;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final ModelInvite.Settings settings;
|
|
|
|
private final Channel targetChannel;
|
|
|
|
|
|
|
|
/* compiled from: WidgetInviteModel.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final ModelInvite tryGetStaticInvite(Long l, Guild guild, Map<Long, StageInstance> map) {
|
|
|
|
String d;
|
|
|
|
if (guild == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
StageInstance stageInstance = map.get(l);
|
|
|
|
if (stageInstance != null && (d = stageInstance.d()) != null) {
|
|
|
|
return ModelInvite.createForStaticUrl(d, GuildUtilsKt.createApiGuild(guild));
|
|
|
|
}
|
|
|
|
String vanityUrlCode = guild.getVanityUrlCode();
|
|
|
|
if (vanityUrlCode != null) {
|
|
|
|
return ModelInvite.createForStaticUrl(vanityUrlCode, GuildUtilsKt.createApiGuild(guild));
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-08-20 05:39:29 +00:00
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:32:0x00ba */
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:33:0x00bc */
|
2021-08-13 06:23:11 +00:00
|
|
|
public final WidgetInviteModel create(ModelInvite.Settings settings, Map<Long, Channel> map, InviteGenerator.InviteGenerationState inviteGenerationState, Long l, MeUser meUser, List<Channel> list, Guild guild, Map<Long, StageInstance> map2, GuildScheduledEvent guildScheduledEvent) {
|
2021-08-03 07:33:18 +00:00
|
|
|
boolean z2;
|
|
|
|
ModelInvite modelInvite;
|
|
|
|
m.checkNotNullParameter(settings, "settings");
|
|
|
|
m.checkNotNullParameter(map, "invitableChannels");
|
|
|
|
m.checkNotNullParameter(inviteGenerationState, "inviteGenerationState");
|
|
|
|
m.checkNotNullParameter(meUser, "me");
|
|
|
|
m.checkNotNullParameter(list, "dms");
|
|
|
|
m.checkNotNullParameter(map2, "guildStageInstances");
|
|
|
|
ModelInvite lastGeneratedInvite = inviteGenerationState.getLastGeneratedInvite();
|
|
|
|
ArrayList arrayList = new ArrayList(map.values());
|
|
|
|
Collections.sort(arrayList, AnimatableValueParser.K0(Channel.Companion));
|
|
|
|
Channel channel = map.containsKey(l) ? map.get(l) : arrayList.isEmpty() ^ true ? (Channel) arrayList.get(0) : null;
|
2021-08-20 05:39:29 +00:00
|
|
|
boolean z3 = (lastGeneratedInvite == null || channel == null || lastGeneratedInvite.getChannel() == null || lastGeneratedInvite.getChannel().h() != channel.h()) ? false : true;
|
2021-08-03 07:33:18 +00:00
|
|
|
if (channel == null || inviteGenerationState.getState() == InviteGenerator.GenerationState.FAILURE) {
|
|
|
|
modelInvite = tryGetStaticInvite(l, guild, map2);
|
|
|
|
if (modelInvite != null) {
|
|
|
|
z2 = true;
|
2021-08-20 05:39:29 +00:00
|
|
|
if (!(channel == null || guildScheduledEvent == null || !guildScheduledEvent.n(channel.h()) || modelInvite == null)) {
|
|
|
|
modelInvite.setGuildScheduledEvent(guildScheduledEvent);
|
2021-08-13 06:23:11 +00:00
|
|
|
}
|
2021-08-20 05:39:29 +00:00
|
|
|
return new WidgetInviteModel(channel, settings, modelInvite, inviteGenerationState.getState() != InviteGenerator.GenerationState.GENERATING, z2, arrayList, meUser, list);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-20 05:39:29 +00:00
|
|
|
z2 = z3;
|
2021-08-03 07:33:18 +00:00
|
|
|
modelInvite = lastGeneratedInvite;
|
2021-08-13 06:23:11 +00:00
|
|
|
modelInvite.setGuildScheduledEvent(guildScheduledEvent);
|
2021-08-20 05:39:29 +00:00
|
|
|
return new WidgetInviteModel(channel, settings, modelInvite, inviteGenerationState.getState() != InviteGenerator.GenerationState.GENERATING, z2, arrayList, meUser, list);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetInviteModel(Channel channel, ModelInvite.Settings settings, ModelInvite modelInvite, boolean z2, boolean z3, List<Channel> list, MeUser meUser, List<Channel> list2) {
|
|
|
|
m.checkNotNullParameter(list, "invitableChannels");
|
|
|
|
m.checkNotNullParameter(meUser, "me");
|
|
|
|
m.checkNotNullParameter(list2, "dms");
|
|
|
|
this.targetChannel = channel;
|
|
|
|
this.settings = settings;
|
|
|
|
this.invite = modelInvite;
|
|
|
|
this.isGeneratingInvite = z2;
|
|
|
|
this.isValidInvite = z3;
|
|
|
|
this.invitableChannels = list;
|
2021-08-27 06:37:59 +00:00
|
|
|
this.f2211me = meUser;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.dms = list2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ WidgetInviteModel(Channel channel, ModelInvite.Settings settings, ModelInvite modelInvite, boolean z2, boolean z3, List list, MeUser meUser, List list2, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(channel, settings, modelInvite, (i & 8) != 0 ? false : z2, (i & 16) != 0 ? false : z3, list, meUser, list2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ WidgetInviteModel copy$default(WidgetInviteModel widgetInviteModel, Channel channel, ModelInvite.Settings settings, ModelInvite modelInvite, boolean z2, boolean z3, List list, MeUser meUser, List list2, int i, Object obj) {
|
2021-08-27 06:37:59 +00:00
|
|
|
return widgetInviteModel.copy((i & 1) != 0 ? widgetInviteModel.targetChannel : channel, (i & 2) != 0 ? widgetInviteModel.settings : settings, (i & 4) != 0 ? widgetInviteModel.invite : modelInvite, (i & 8) != 0 ? widgetInviteModel.isGeneratingInvite : z2, (i & 16) != 0 ? widgetInviteModel.isValidInvite : z3, (i & 32) != 0 ? widgetInviteModel.invitableChannels : list, (i & 64) != 0 ? widgetInviteModel.f2211me : meUser, (i & 128) != 0 ? widgetInviteModel.dms : list2);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Channel component1() {
|
|
|
|
return this.targetChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelInvite.Settings component2() {
|
|
|
|
return this.settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelInvite component3() {
|
|
|
|
return this.invite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component4() {
|
|
|
|
return this.isGeneratingInvite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component5() {
|
|
|
|
return this.isValidInvite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<Channel> component6() {
|
|
|
|
return this.invitableChannels;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final MeUser component7() {
|
2021-08-27 06:37:59 +00:00
|
|
|
return this.f2211me;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<Channel> component8() {
|
|
|
|
return this.dms;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final WidgetInviteModel copy(Channel channel, ModelInvite.Settings settings, ModelInvite modelInvite, boolean z2, boolean z3, List<Channel> list, MeUser meUser, List<Channel> list2) {
|
|
|
|
m.checkNotNullParameter(list, "invitableChannels");
|
|
|
|
m.checkNotNullParameter(meUser, "me");
|
|
|
|
m.checkNotNullParameter(list2, "dms");
|
|
|
|
return new WidgetInviteModel(channel, settings, modelInvite, z2, z3, list, meUser, list2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof WidgetInviteModel)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
WidgetInviteModel widgetInviteModel = (WidgetInviteModel) obj;
|
2021-08-27 06:37:59 +00:00
|
|
|
return m.areEqual(this.targetChannel, widgetInviteModel.targetChannel) && m.areEqual(this.settings, widgetInviteModel.settings) && m.areEqual(this.invite, widgetInviteModel.invite) && this.isGeneratingInvite == widgetInviteModel.isGeneratingInvite && this.isValidInvite == widgetInviteModel.isValidInvite && m.areEqual(this.invitableChannels, widgetInviteModel.invitableChannels) && m.areEqual(this.f2211me, widgetInviteModel.f2211me) && m.areEqual(this.dms, widgetInviteModel.dms);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<Channel> getDms() {
|
|
|
|
return this.dms;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<Channel> getInvitableChannels() {
|
|
|
|
return this.invitableChannels;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelInvite getInvite() {
|
|
|
|
return this.invite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final MeUser getMe() {
|
2021-08-27 06:37:59 +00:00
|
|
|
return this.f2211me;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final ModelInvite.Settings getSettings() {
|
|
|
|
return this.settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Channel getTargetChannel() {
|
|
|
|
return this.targetChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
Channel channel = this.targetChannel;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (channel != null ? channel.hashCode() : 0) * 31;
|
|
|
|
ModelInvite.Settings settings = this.settings;
|
|
|
|
int hashCode2 = (hashCode + (settings != null ? settings.hashCode() : 0)) * 31;
|
|
|
|
ModelInvite modelInvite = this.invite;
|
|
|
|
int hashCode3 = (hashCode2 + (modelInvite != null ? modelInvite.hashCode() : 0)) * 31;
|
|
|
|
boolean z2 = this.isGeneratingInvite;
|
|
|
|
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;
|
|
|
|
boolean z3 = this.isValidInvite;
|
|
|
|
if (!z3) {
|
|
|
|
i2 = z3 ? 1 : 0;
|
|
|
|
}
|
|
|
|
int i7 = (i6 + i2) * 31;
|
|
|
|
List<Channel> list = this.invitableChannels;
|
|
|
|
int hashCode4 = (i7 + (list != null ? list.hashCode() : 0)) * 31;
|
2021-08-27 06:37:59 +00:00
|
|
|
MeUser meUser = this.f2211me;
|
2021-08-03 07:33:18 +00:00
|
|
|
int hashCode5 = (hashCode4 + (meUser != null ? meUser.hashCode() : 0)) * 31;
|
|
|
|
List<Channel> list2 = this.dms;
|
|
|
|
if (list2 != null) {
|
|
|
|
i = list2.hashCode();
|
|
|
|
}
|
|
|
|
return hashCode5 + i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isGeneratingInvite() {
|
|
|
|
return this.isGeneratingInvite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isValidInvite() {
|
|
|
|
return this.isValidInvite;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-08-25 07:02:36 +00:00
|
|
|
StringBuilder N = a.N("WidgetInviteModel(targetChannel=");
|
|
|
|
N.append(this.targetChannel);
|
|
|
|
N.append(", settings=");
|
|
|
|
N.append(this.settings);
|
|
|
|
N.append(", invite=");
|
|
|
|
N.append(this.invite);
|
|
|
|
N.append(", isGeneratingInvite=");
|
|
|
|
N.append(this.isGeneratingInvite);
|
|
|
|
N.append(", isValidInvite=");
|
|
|
|
N.append(this.isValidInvite);
|
|
|
|
N.append(", invitableChannels=");
|
|
|
|
N.append(this.invitableChannels);
|
|
|
|
N.append(", me=");
|
2021-08-27 06:37:59 +00:00
|
|
|
N.append(this.f2211me);
|
2021-08-25 07:02:36 +00:00
|
|
|
N.append(", dms=");
|
|
|
|
return a.G(N, this.dms, ")");
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|