60 lines
3 KiB
Java
60 lines
3 KiB
Java
package com.discord.widgets.chat.list.model;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.thread.ThreadMetadata;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.models.user.MeUser;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
import com.discord.utilities.threads.ThreadUtils;
|
|
import com.discord.widgets.chat.list.entries.ChatListEntry;
|
|
import com.discord.widgets.chat.list.entries.GuildWelcomeEntry;
|
|
import com.discord.widgets.chat.list.entries.StartOfChatEntry;
|
|
import com.discord.widgets.chat.list.entries.StartOfPrivateChatEntry;
|
|
import d0.z.d.m;
|
|
import rx.functions.Func5;
|
|
/* compiled from: WidgetChatListModelTop.kt */
|
|
public final class WidgetChatListModelTop$Companion$getWelcomeEntry$2<T1, T2, T3, T4, T5, R> implements Func5<Guild, MeUser, Long, Long, GuildMember, ChatListEntry> {
|
|
public final /* synthetic */ Channel $channel;
|
|
|
|
public WidgetChatListModelTop$Companion$getWelcomeEntry$2(Channel channel) {
|
|
this.$channel = channel;
|
|
}
|
|
|
|
public final ChatListEntry call(Guild guild, MeUser meUser, Long l, Long l2, GuildMember guildMember) {
|
|
ChatListEntry startOfChatEntry;
|
|
boolean z2 = l2 != null && this.$channel.h() == l2.longValue();
|
|
boolean z3 = guild != null && guild.hasIcon();
|
|
boolean can = PermissionUtils.can(65536, l);
|
|
boolean can2 = PermissionUtils.can(1, l);
|
|
boolean can3 = PermissionUtils.can(16, l);
|
|
ThreadUtils threadUtils = ThreadUtils.INSTANCE;
|
|
m.checkNotNullExpressionValue(meUser, "me");
|
|
boolean canManageThread = threadUtils.canManageThread(meUser, this.$channel, l);
|
|
boolean isOwner = guild != null ? guild.isOwner(meUser.getId()) : false;
|
|
if (!AnimatableValueParser.k1(this.$channel) || guild == null || !z2 || !can || (!can2 && z3)) {
|
|
Integer num = null;
|
|
if (AnimatableValueParser.s1(this.$channel)) {
|
|
startOfChatEntry = new StartOfPrivateChatEntry(this.$channel.h(), AnimatableValueParser.y0(this.$channel), this.$channel.A(), IconUtils.getForChannel$default(this.$channel, null, 2, null), AnimatableValueParser.x1(this.$channel));
|
|
} else {
|
|
long h = this.$channel.h();
|
|
String y0 = AnimatableValueParser.y0(this.$channel);
|
|
boolean z1 = AnimatableValueParser.z1(this.$channel);
|
|
ThreadMetadata y2 = this.$channel.y();
|
|
if (y2 != null) {
|
|
num = Integer.valueOf(y2.c());
|
|
}
|
|
startOfChatEntry = new StartOfChatEntry(h, y0, can, can3, canManageThread, z1, num, guildMember);
|
|
}
|
|
return startOfChatEntry;
|
|
}
|
|
long id2 = guild.getId();
|
|
String name = guild.getName();
|
|
if (name == null) {
|
|
name = "";
|
|
}
|
|
return new GuildWelcomeEntry(isOwner, z3, can2, id2, name);
|
|
}
|
|
}
|