discord-jadx/app/src/main/java/com/discord/widgets/user/search/WidgetGlobalSearchGuildsMod...

356 lines
14 KiB
Java

package com.discord.widgets.user.search;
import a0.a.a.b;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.models.domain.ModelNotificationSettings;
import com.discord.models.guild.Guild;
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
import d0.f0.n;
import d0.f0.q;
import d0.t.u;
import d0.z.d.m;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.sequences.Sequence;
/* compiled from: WidgetGlobalSearchGuildsModel.kt */
public final class WidgetGlobalSearchGuildsModel {
public static final Companion Companion = new Companion(null);
private final boolean hasChannels;
private final List<Item> items;
/* compiled from: WidgetGlobalSearchGuildsModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private final Sequence<Item> asDirectMessageItems(Map<Long, Channel> map, Map<Long, Integer> map2, ModelNotificationSettings modelNotificationSettings) {
return q.map(q.sortedWith(q.filter(q.filterNotNull(u.asSequence(map.values())), new WidgetGlobalSearchGuildsModel$Companion$asDirectMessageItems$1(modelNotificationSettings, map2)), AnimatableValueParser.K0(Channel.Companion)), new WidgetGlobalSearchGuildsModel$Companion$asDirectMessageItems$2(map2));
}
private final Sequence<Item> asGuildItems(Sequence<Guild> sequence, long j, long j2, Set<Long> set, Map<Long, ? extends ModelNotificationSettings> map, Map<Long, Integer> map2, Map<Long, ? extends List<Long>> map3) {
return q.map(sequence, new WidgetGlobalSearchGuildsModel$Companion$asGuildItems$1(map3, map2, map, set, j, j2));
}
public final WidgetGlobalSearchGuildsModel create(List<Long> list, long j, Set<Long> set, Map<Long, Integer> map, Map<Long, Channel> map2, Map<Long, Guild> map3, Map<Long, ? extends List<Long>> map4, Map<Long, ? extends ModelNotificationSettings> map5) {
m.checkNotNullParameter(list, "recentGuildIds");
m.checkNotNullParameter(set, "unreadGuildIds");
m.checkNotNullParameter(map, "mentionCounts");
m.checkNotNullParameter(map2, "privateChannels");
m.checkNotNullParameter(map3, "guilds");
m.checkNotNullParameter(map4, "channelIds");
m.checkNotNullParameter(map5, "guildSettings");
Sequence<Item> asDirectMessageItems = asDirectMessageItems(map2, map, (ModelNotificationSettings) map5.get(0L));
return new WidgetGlobalSearchGuildsModel(q.toList(q.plus(q.plus((Sequence) asDirectMessageItems, q.any(asDirectMessageItems) ? n.sequenceOf(Item.Companion.createDivider$app_productionBetaRelease()) : n.emptySequence()), q.sortedWith(asGuildItems(q.mapNotNull(q.drop(q.distinct(u.asSequence(u.plus((Collection) list, (Iterable) map3.keySet()))), 1), new WidgetGlobalSearchGuildsModel$Companion$create$guildItems$1(map3)), ((Number) u.first((List<? extends Object>) list)).longValue(), j, set, map5, map, map4), new WidgetGlobalSearchGuildsModel$Companion$create$$inlined$sortedByDescending$1()))), !map4.isEmpty());
}
}
/* compiled from: WidgetGlobalSearchGuildsModel.kt */
public static final class Item implements MGRecyclerDataPayload {
public static final Companion Companion = new Companion(null);
public static final int TYPE_DIVIDER = 1;
public static final int TYPE_DM = 2;
public static final int TYPE_GUILD = 3;
private final int _type;
private final Channel channel;
private final boolean connectedToVoice;
private final Guild guild;
/* renamed from: id reason: collision with root package name */
private final long f2175id;
private final boolean isSelected;
private final boolean isUnread;
private final String key;
private final int mentionCount;
private final int type;
private final int unavailableGuildCount;
/* compiled from: WidgetGlobalSearchGuildsModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Item createDirectMessage$app_productionBetaRelease(Channel channel, int i) {
m.checkNotNullParameter(channel, "channel");
return new Item(2, channel.h(), channel, null, i, false, false, false, 0, 488, null);
}
public final Item createDivider$app_productionBetaRelease() {
return new Item(1, 1, null, null, 0, false, false, false, 0, 508, null);
}
public final Item createGuild$app_productionBetaRelease(Guild guild, int i, boolean z2, boolean z3, boolean z4) {
m.checkNotNullParameter(guild, "guild");
return new Item(3, guild.getId(), null, guild, i, z2, z3, z4, 0, 260, null);
}
}
public Item() {
this(0, 0, null, null, 0, false, false, false, 0, 511, null);
}
/* JADX DEBUG: TODO: convert one arg to string using `String.valueOf()`, args: [(wrap: int : 0x001c: INVOKE (r4v1 int) = (r0v0 'this' com.discord.widgets.user.search.WidgetGlobalSearchGuildsModel$Item A[IMMUTABLE_TYPE, THIS]) type: VIRTUAL call: com.discord.widgets.user.search.WidgetGlobalSearchGuildsModel.Item.getType():int), ('-' char), (r2v0 long)] */
public Item(int i, long j, Channel channel, Guild guild, int i2, boolean z2, boolean z3, boolean z4, int i3) {
this._type = i;
this.f2175id = j;
this.channel = channel;
this.guild = guild;
this.mentionCount = i2;
this.isUnread = z2;
this.isSelected = z3;
this.connectedToVoice = z4;
this.unavailableGuildCount = i3;
this.type = i;
StringBuilder sb = new StringBuilder();
sb.append(getType());
sb.append('-');
sb.append(j);
this.key = sb.toString();
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ Item(int i, long j, Channel channel, Guild guild, int i2, boolean z2, boolean z3, boolean z4, int i3, int i4, DefaultConstructorMarker defaultConstructorMarker) {
this((i4 & 1) != 0 ? 0 : i, (i4 & 2) != 0 ? 0 : j, (i4 & 4) != 0 ? null : channel, (i4 & 8) == 0 ? guild : null, (i4 & 16) != 0 ? 0 : i2, (i4 & 32) != 0 ? false : z2, (i4 & 64) != 0 ? false : z3, (i4 & 128) != 0 ? false : z4, (i4 & 256) == 0 ? i3 : 0);
}
private final int component1() {
return this._type;
}
public static /* synthetic */ Item copy$default(Item item, int i, long j, Channel channel, Guild guild, int i2, boolean z2, boolean z3, boolean z4, int i3, int i4, Object obj) {
return item.copy((i4 & 1) != 0 ? item._type : i, (i4 & 2) != 0 ? item.f2175id : j, (i4 & 4) != 0 ? item.channel : channel, (i4 & 8) != 0 ? item.guild : guild, (i4 & 16) != 0 ? item.mentionCount : i2, (i4 & 32) != 0 ? item.isUnread : z2, (i4 & 64) != 0 ? item.isSelected : z3, (i4 & 128) != 0 ? item.connectedToVoice : z4, (i4 & 256) != 0 ? item.unavailableGuildCount : i3);
}
public final long component2() {
return this.f2175id;
}
public final Channel component3() {
return this.channel;
}
public final Guild component4() {
return this.guild;
}
public final int component5() {
return this.mentionCount;
}
public final boolean component6() {
return this.isUnread;
}
public final boolean component7() {
return this.isSelected;
}
public final boolean component8() {
return this.connectedToVoice;
}
public final int component9() {
return this.unavailableGuildCount;
}
public final Item copy(int i, long j, Channel channel, Guild guild, int i2, boolean z2, boolean z3, boolean z4, int i3) {
return new Item(i, j, channel, guild, i2, z2, z3, z4, i3);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Item)) {
return false;
}
Item item = (Item) obj;
return this._type == item._type && this.f2175id == item.f2175id && m.areEqual(this.channel, item.channel) && m.areEqual(this.guild, item.guild) && this.mentionCount == item.mentionCount && this.isUnread == item.isUnread && this.isSelected == item.isSelected && this.connectedToVoice == item.connectedToVoice && this.unavailableGuildCount == item.unavailableGuildCount;
}
public final Channel getChannel() {
return this.channel;
}
public final boolean getConnectedToVoice() {
return this.connectedToVoice;
}
public final Guild getGuild() {
return this.guild;
}
public final long getId() {
return this.f2175id;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
public final int getMentionCount() {
return this.mentionCount;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
public final int getUnavailableGuildCount() {
return this.unavailableGuildCount;
}
public int hashCode() {
int a = (b.a(this.f2175id) + (this._type * 31)) * 31;
Channel channel = this.channel;
int i = 0;
int hashCode = (a + (channel != null ? channel.hashCode() : 0)) * 31;
Guild guild = this.guild;
if (guild != null) {
i = guild.hashCode();
}
int i2 = (((hashCode + i) * 31) + this.mentionCount) * 31;
boolean z2 = this.isUnread;
int i3 = 1;
if (z2) {
z2 = true;
}
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = z2 ? 1 : 0;
int i7 = (i2 + i4) * 31;
boolean z3 = this.isSelected;
if (z3) {
z3 = true;
}
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = z3 ? 1 : 0;
int i11 = (i7 + i8) * 31;
boolean z4 = this.connectedToVoice;
if (!z4) {
i3 = z4 ? 1 : 0;
}
return ((i11 + i3) * 31) + this.unavailableGuildCount;
}
public final boolean isSelected() {
return this.isSelected;
}
public final boolean isUnread() {
return this.isUnread;
}
public String toString() {
StringBuilder K = a.K("Item(_type=");
K.append(this._type);
K.append(", id=");
K.append(this.f2175id);
K.append(", channel=");
K.append(this.channel);
K.append(", guild=");
K.append(this.guild);
K.append(", mentionCount=");
K.append(this.mentionCount);
K.append(", isUnread=");
K.append(this.isUnread);
K.append(", isSelected=");
K.append(this.isSelected);
K.append(", connectedToVoice=");
K.append(this.connectedToVoice);
K.append(", unavailableGuildCount=");
return a.w(K, this.unavailableGuildCount, ")");
}
}
public WidgetGlobalSearchGuildsModel(List<Item> list, boolean z2) {
m.checkNotNullParameter(list, "items");
this.items = list;
this.hasChannels = z2;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetGlobalSearchGuildsModel(List list, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(list, (i & 2) != 0 ? true : z2);
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchGuildsModel */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ WidgetGlobalSearchGuildsModel copy$default(WidgetGlobalSearchGuildsModel widgetGlobalSearchGuildsModel, List list, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
list = widgetGlobalSearchGuildsModel.items;
}
if ((i & 2) != 0) {
z2 = widgetGlobalSearchGuildsModel.hasChannels;
}
return widgetGlobalSearchGuildsModel.copy(list, z2);
}
public final List<Item> component1() {
return this.items;
}
public final boolean component2() {
return this.hasChannels;
}
public final WidgetGlobalSearchGuildsModel copy(List<Item> list, boolean z2) {
m.checkNotNullParameter(list, "items");
return new WidgetGlobalSearchGuildsModel(list, z2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WidgetGlobalSearchGuildsModel)) {
return false;
}
WidgetGlobalSearchGuildsModel widgetGlobalSearchGuildsModel = (WidgetGlobalSearchGuildsModel) obj;
return m.areEqual(this.items, widgetGlobalSearchGuildsModel.items) && this.hasChannels == widgetGlobalSearchGuildsModel.hasChannels;
}
public final boolean getHasChannels() {
return this.hasChannels;
}
public final List<Item> getItems() {
return this.items;
}
public int hashCode() {
List<Item> list = this.items;
int hashCode = (list != null ? list.hashCode() : 0) * 31;
boolean z2 = this.hasChannels;
if (z2) {
z2 = true;
}
int i = z2 ? 1 : 0;
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
return hashCode + i;
}
public String toString() {
StringBuilder K = a.K("WidgetGlobalSearchGuildsModel(items=");
K.append(this.items);
K.append(", hasChannels=");
return a.F(K, this.hasChannels, ")");
}
}