discord-jadx/app/src/main/java/com/discord/widgets/user/search/WidgetGlobalSearchModel$Com...

59 lines
2.5 KiB
Java

package com.discord.widgets.user.search;
import com.discord.models.guild.Guild;
import com.discord.widgets.user.search.WidgetGlobalSearchModel;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.functions.Function2;
/* compiled from: WidgetGlobalSearchModel.kt */
public final class WidgetGlobalSearchModel$Companion$create$3 extends o implements Function2<Guild, String, WidgetGlobalSearchModel.ItemGuild> {
public final /* synthetic */ WidgetGlobalSearchModel.ChannelContext $channelContext;
public final /* synthetic */ WidgetGlobalSearchModel.SearchContext $searchContext;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetGlobalSearchModel$Companion$create$3(WidgetGlobalSearchModel.ChannelContext channelContext, WidgetGlobalSearchModel.SearchContext searchContext) {
super(2);
this.$channelContext = channelContext;
this.$searchContext = searchContext;
}
public final WidgetGlobalSearchModel.ItemGuild invoke(Guild guild, String str) {
int i;
boolean z2;
m.checkNotNullParameter(guild, "$this$toItemGuild");
m.checkNotNullParameter(str, "guildFilter");
WidgetGlobalSearchModel.MatchedResult matchedResult = WidgetGlobalSearchModel.Companion.toMatchedResult(guild.getName(), str);
if (matchedResult == null) {
return null;
}
List<Long> list = this.$channelContext.getGuildToChannels().get(Long.valueOf(guild.getId()));
if (list != null) {
int i2 = 0;
for (Number number : list) {
Integer num = this.$searchContext.getMentionCounts().get(Long.valueOf(number.longValue()));
i2 += num != null ? num.intValue() : 0;
}
i = i2;
} else {
i = 0;
}
if (list != null && !list.isEmpty()) {
Iterator<T> it = list.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (this.$channelContext.getUnreadChannelIds().contains(Long.valueOf(((Number) it.next()).longValue()))) {
z2 = true;
break;
}
}
return new WidgetGlobalSearchModel.ItemGuild(matchedResult, guild, null, i, z2, 4, null);
}
z2 = false;
return new WidgetGlobalSearchModel.ItemGuild(matchedResult, guild, null, i, z2, 4, null);
}
}