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

81 lines
3.3 KiB
Java

package com.discord.widgets.user.search;
import com.discord.models.domain.ModelNotificationSettings;
import com.discord.models.guild.Guild;
import com.discord.widgets.user.search.WidgetGlobalSearchGuildsModel;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.functions.Function1;
/* compiled from: WidgetGlobalSearchGuildsModel.kt */
public final class WidgetGlobalSearchGuildsModel$Companion$asGuildItems$1 extends o implements Function1<Guild, WidgetGlobalSearchGuildsModel.Item> {
public final /* synthetic */ Map $channelIds;
public final /* synthetic */ Map $guildSettings;
public final /* synthetic */ Map $mentionCounts;
public final /* synthetic */ long $selectedGuildId;
public final /* synthetic */ long $selectedVoiceChannelId;
public final /* synthetic */ Set $unreadGuildIds;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetGlobalSearchGuildsModel$Companion$asGuildItems$1(Map map, Map map2, Map map3, Set set, long j, long j2) {
super(1);
this.$channelIds = map;
this.$mentionCounts = map2;
this.$guildSettings = map3;
this.$unreadGuildIds = set;
this.$selectedGuildId = j;
this.$selectedVoiceChannelId = j2;
}
public final WidgetGlobalSearchGuildsModel.Item invoke(Guild guild) {
int i;
boolean z2;
boolean z3;
m.checkNotNullParameter(guild, "guild");
long id2 = guild.getId();
List<Number> list = (List) this.$channelIds.get(Long.valueOf(id2));
if (list != null) {
ArrayList arrayList = new ArrayList();
for (Number number : list) {
Integer num = (Integer) this.$mentionCounts.get(Long.valueOf(number.longValue()));
if (num != null) {
arrayList.add(num);
}
}
i = u.sumOfInt(arrayList);
} else {
i = 0;
}
ModelNotificationSettings modelNotificationSettings = (ModelNotificationSettings) this.$guildSettings.get(Long.valueOf(id2));
boolean contains = (modelNotificationSettings == null || !modelNotificationSettings.isMuted()) ? this.$unreadGuildIds.contains(Long.valueOf(id2)) : false;
boolean z4 = id2 == this.$selectedGuildId;
if (!z4 && this.$selectedVoiceChannelId > 0 && list != null && !list.isEmpty()) {
Iterator it = list.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (this.$selectedVoiceChannelId == ((Number) it.next()).longValue()) {
z3 = true;
continue;
} else {
z3 = false;
continue;
}
if (z3) {
z2 = true;
break;
}
}
return WidgetGlobalSearchGuildsModel.Item.Companion.createGuild$app_productionBetaRelease(guild, i, contains, z4, z2);
}
z2 = false;
return WidgetGlobalSearchGuildsModel.Item.Companion.createGuild$app_productionBetaRelease(guild, i, contains, z4, z2);
}
}