discord-jadx/app/src/main/java/com/discord/widgets/chat/list/adapter/WidgetChatListAdapterItemSt...

101 lines
5.6 KiB
Java

package com.discord.widgets.chat.list.adapter;
import com.discord.api.channel.Channel;
import com.discord.api.stageinstance.StageInstance;
import com.discord.models.user.User;
import com.discord.stores.StoreAccessibility;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreGuilds;
import com.discord.stores.StoreRequestedStageChannels;
import com.discord.stores.StoreStageChannels;
import com.discord.stores.StoreStageInstances;
import com.discord.stores.StoreUser;
import com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemStageInvite;
import com.discord.widgets.chat.list.entries.StageInviteEntry;
import com.discord.widgets.stage.StageRoles;
import d0.t.n;
import d0.z.d.o;
import java.util.List;
import java.util.Map;
import kotlin.jvm.functions.Function0;
/* compiled from: WidgetChatListAdapterItemStageInvite.kt */
public final class WidgetChatListAdapterItemStageInvite$Model$Companion$observe$1 extends o implements Function0<WidgetChatListAdapterItemStageInvite.Model> {
public final /* synthetic */ StoreAccessibility $accessibilityStore;
public final /* synthetic */ StoreChannels $channelStore;
public final /* synthetic */ StoreGuilds $guildStore;
public final /* synthetic */ StageInviteEntry $item;
public final /* synthetic */ StoreRequestedStageChannels $requestedInstanceStore;
public final /* synthetic */ StoreStageChannels $stageChannelStore;
public final /* synthetic */ StoreStageInstances $stageInstanceStore;
public final /* synthetic */ StoreUser $userStore;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatListAdapterItemStageInvite$Model$Companion$observe$1(StoreUser storeUser, StageInviteEntry stageInviteEntry, StoreChannels storeChannels, StoreAccessibility storeAccessibility, StoreStageInstances storeStageInstances, StoreRequestedStageChannels storeRequestedStageChannels, StoreStageChannels storeStageChannels, StoreGuilds storeGuilds) {
super(0);
this.$userStore = storeUser;
this.$item = stageInviteEntry;
this.$channelStore = storeChannels;
this.$accessibilityStore = storeAccessibility;
this.$stageInstanceStore = storeStageInstances;
this.$requestedInstanceStore = storeRequestedStageChannels;
this.$stageChannelStore = storeStageChannels;
this.$guildStore = storeGuilds;
}
/* JADX WARNING: Removed duplicated region for block: B:35:0x00f8 */
/* JADX WARNING: Removed duplicated region for block: B:36:0x00fa */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final WidgetChatListAdapterItemStageInvite.Model mo1invoke() {
Channel channel;
StageInstance stageInstance;
StageInstance stageInstance2;
List list;
Integer num;
Integer valueOf;
long id2 = this.$userStore.getMe().getId();
User user = this.$userStore.getUsers().get(Long.valueOf(this.$item.getUserId()));
Channel channel2 = this.$item.getInvite().getChannel();
if (channel2 == null || (channel = this.$channelStore.getChannel(channel2.h())) == null) {
channel = this.$item.getInvite().getChannel();
}
boolean isReducedMotionEnabled = this.$accessibilityStore.isReducedMotionEnabled();
if (channel != null) {
long h = channel.h();
StageInstance stageInstanceForChannel = this.$stageInstanceStore.getStageInstanceForChannel(h);
if (stageInstanceForChannel == null) {
stageInstanceForChannel = this.$requestedInstanceStore.getStageInstanceForChannel(h);
}
stageInstance = stageInstanceForChannel;
} else {
stageInstance = null;
}
Map<Long, StageRoles> channelRoles = channel != null ? this.$stageChannelStore.getChannelRoles(channel.h()) : null;
StoreRequestedStageChannels.StageInstanceState stageInstanceState = channel != null ? this.$requestedInstanceStore.getRequestedInstanceStatesByChannel().get(Long.valueOf(channel.h())) : null;
if (channel != null) {
long h2 = channel.h();
WidgetChatListAdapterItemStageInvite.Model.Companion companion = WidgetChatListAdapterItemStageInvite.Model.Companion;
stageInstance2 = stageInstance;
list = WidgetChatListAdapterItemStageInvite.Model.Companion.access$speakersFromLocalStore(companion, this.$guildStore, this.$userStore, this.$stageChannelStore, h2, this.$item.getGuildId());
if (list == null) {
list = WidgetChatListAdapterItemStageInvite.Model.Companion.access$speakersFromRequest(companion, stageInstanceState);
}
} else {
stageInstance2 = stageInstance;
list = null;
}
if (channelRoles == null || list == null) {
if ((stageInstanceState != null ? stageInstanceState.getStageInstance() : null) != null) {
valueOf = Integer.valueOf(stageInstanceState.getStageInstance().c() - stageInstanceState.getStageInstance().g().size());
} else {
num = null;
return new WidgetChatListAdapterItemStageInvite.Model(this.$item.getInvite(), id2, user, channel, !isReducedMotionEnabled, stageInstance2, list == null ? list : n.emptyList(), num);
}
} else {
valueOf = Integer.valueOf(channelRoles.size() - list.size());
}
num = valueOf;
return new WidgetChatListAdapterItemStageInvite.Model(this.$item.getInvite(), id2, user, channel, !isReducedMotionEnabled, stageInstance2, list == null ? list : n.emptyList(), num);
}
}