discord-jadx/app/src/main/java/com/discord/widgets/guildscheduledevent/GuildScheduledEventListView...

59 lines
3.3 KiB
Java

package com.discord.widgets.guildscheduledevent;
import com.discord.api.channel.Channel;
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
import com.discord.api.role.GuildRole;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreGuildScheduledEvents;
import com.discord.stores.StoreGuilds;
import com.discord.stores.StorePermissions;
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities;
import com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel;
import d0.t.h0;
import d0.t.u;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import kotlin.jvm.functions.Function0;
/* compiled from: GuildScheduledEventListViewModel.kt */
public final class GuildScheduledEventListViewModel$Companion$observeStores$1 extends o implements Function0<GuildScheduledEventListViewModel.StoreState> {
public final /* synthetic */ StoreChannels $channelStore;
public final /* synthetic */ long $guildId;
public final /* synthetic */ StoreGuildScheduledEvents $guildScheduledEventsStore;
public final /* synthetic */ StoreGuilds $guildStore;
public final /* synthetic */ StorePermissions $permissionsStore;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public GuildScheduledEventListViewModel$Companion$observeStores$1(StoreChannels storeChannels, long j, StoreGuildScheduledEvents storeGuildScheduledEvents, StorePermissions storePermissions, StoreGuilds storeGuilds) {
super(0);
this.$channelStore = storeChannels;
this.$guildId = j;
this.$guildScheduledEventsStore = storeGuildScheduledEvents;
this.$permissionsStore = storePermissions;
this.$guildStore = storeGuilds;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final GuildScheduledEventListViewModel.StoreState mo1invoke() {
Map<Long, Channel> channelsForGuild = this.$channelStore.getChannelsForGuild(this.$guildId);
List guildScheduledEvents$default = StoreGuildScheduledEvents.getGuildScheduledEvents$default(this.$guildScheduledEventsStore, this.$guildId, false, false, 6, null);
ArrayList arrayList = new ArrayList();
for (Object obj : guildScheduledEvents$default) {
if (channelsForGuild.containsKey(Long.valueOf(((GuildScheduledEvent) obj).b()))) {
arrayList.add(obj);
}
}
List sortedWith = u.sortedWith(arrayList, GuildScheduledEventListViewModel.GuildScheduledEventsComparator.INSTANCE);
Map<Long, GuildScheduledEvent> userGuildScheduledEvents = this.$guildScheduledEventsStore.getUserGuildScheduledEvents();
Map<Long, Long> permissionsByChannel = this.$permissionsStore.getPermissionsByChannel();
boolean z2 = !GuildScheduledEventUtilities.Companion.getGuildScheduledEventCreatableChannelsForGuild$default(GuildScheduledEventUtilities.Companion, this.$guildId, null, null, 6, null).isEmpty();
Map<Long, GuildRole> map = this.$guildStore.getRoles().get(Long.valueOf(this.$guildId));
if (map == null) {
map = h0.emptyMap();
}
return new GuildScheduledEventListViewModel.StoreState(sortedWith, userGuildScheduledEvents, channelsForGuild, permissionsByChannel, z2, map);
}
}