85 lines
4.2 KiB
Java
85 lines
4.2 KiB
Java
package com.discord.widgets.chat.list.model;
|
|
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.channel.ChannelUtils;
|
|
import com.discord.api.permission.Permission;
|
|
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.models.user.User;
|
|
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.t.n;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import rx.functions.Func7;
|
|
/* compiled from: WidgetChatListModelTop.kt */
|
|
public final class WidgetChatListModelTop$Companion$getWelcomeEntry$2<T1, T2, T3, T4, T5, T6, T7, R> implements Func7<Guild, MeUser, Long, Long, GuildMember, User, Map<Long, ? extends List<? extends Guild>>, 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, User user, Map<Long, ? extends List<Guild>> map) {
|
|
ChatListEntry startOfChatEntry;
|
|
boolean z2 = true;
|
|
boolean z3 = false;
|
|
boolean z4 = l2 != null && this.$channel.h() == l2.longValue();
|
|
if (guild == null || !guild.hasIcon()) {
|
|
z2 = false;
|
|
}
|
|
boolean can = PermissionUtils.can(Permission.READ_MESSAGE_HISTORY, 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);
|
|
User a = ChannelUtils.a(this.$channel);
|
|
List list = (List) map.get(Long.valueOf(a != null ? a.getId() : 0));
|
|
if (list == null) {
|
|
list = n.emptyList();
|
|
}
|
|
if (guild != null) {
|
|
z3 = guild.isOwner(meUser.getId());
|
|
}
|
|
if (!ChannelUtils.s(this.$channel) || guild == null || !z4 || !can || (!can2 && z2)) {
|
|
Integer num = null;
|
|
if (ChannelUtils.x(this.$channel)) {
|
|
startOfChatEntry = new StartOfPrivateChatEntry(this.$channel.h(), ChannelUtils.c(this.$channel), this.$channel.A(), IconUtils.getForChannel$default(this.$channel, null, 2, null), ChannelUtils.A(this.$channel), list);
|
|
} else {
|
|
long h = this.$channel.h();
|
|
String c2 = ChannelUtils.c(this.$channel);
|
|
boolean E = ChannelUtils.E(this.$channel);
|
|
boolean C = ChannelUtils.C(this.$channel);
|
|
ThreadMetadata y2 = this.$channel.y();
|
|
if (y2 != null) {
|
|
num = Integer.valueOf(y2.c());
|
|
}
|
|
startOfChatEntry = new StartOfChatEntry(h, c2, can, can3, canManageThread, C, num, guildMember, user != null ? GuildMember.Companion.getNickOrUsername(guildMember, user) : "", E);
|
|
}
|
|
return startOfChatEntry;
|
|
}
|
|
long id2 = guild.getId();
|
|
String name = guild.getName();
|
|
if (name == null) {
|
|
name = "";
|
|
}
|
|
return new GuildWelcomeEntry(z3, z2, can2, id2, name);
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object] */
|
|
@Override // rx.functions.Func7
|
|
public /* bridge */ /* synthetic */ ChatListEntry call(Guild guild, MeUser meUser, Long l, Long l2, GuildMember guildMember, User user, Map<Long, ? extends List<? extends Guild>> map) {
|
|
return call(guild, meUser, l, l2, guildMember, user, (Map<Long, ? extends List<Guild>>) map);
|
|
}
|
|
}
|