64 lines
3.5 KiB
Java
64 lines
3.5 KiB
Java
package com.discord.widgets.guildscheduledevent;
|
|
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreGuildScheduledEvents;
|
|
import com.discord.stores.StorePermissions;
|
|
import com.discord.stores.StoreVoiceChannelSelected;
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities;
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventsComparator;
|
|
import com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
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 */ Long $channelId;
|
|
public final /* synthetic */ StoreChannels $channelStore;
|
|
public final /* synthetic */ long $guildId;
|
|
public final /* synthetic */ StoreGuildScheduledEvents $guildScheduledEventsStore;
|
|
public final /* synthetic */ StorePermissions $permissionsStore;
|
|
public final /* synthetic */ StoreVoiceChannelSelected $voiceChannelSelectedStore;
|
|
|
|
/* 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, Long l, StorePermissions storePermissions, StoreVoiceChannelSelected storeVoiceChannelSelected) {
|
|
super(0);
|
|
this.$channelStore = storeChannels;
|
|
this.$guildId = j;
|
|
this.$guildScheduledEventsStore = storeGuildScheduledEvents;
|
|
this.$channelId = l;
|
|
this.$permissionsStore = storePermissions;
|
|
this.$voiceChannelSelectedStore = storeVoiceChannelSelected;
|
|
}
|
|
|
|
@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, 2, null);
|
|
if (this.$channelId != null) {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Object obj : guildScheduledEvents$default) {
|
|
if (m.areEqual(((GuildScheduledEvent) obj).b(), this.$channelId)) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
guildScheduledEvents$default = arrayList;
|
|
}
|
|
List sortedWith = u.sortedWith(guildScheduledEvents$default, GuildScheduledEventsComparator.INSTANCE);
|
|
Set<Long> userGuildScheduledEventIds = this.$guildScheduledEventsStore.getUserGuildScheduledEventIds(this.$guildId);
|
|
boolean canCreateAnyEvent = GuildScheduledEventUtilities.Companion.canCreateAnyEvent(this.$guildId, this.$channelStore, this.$permissionsStore);
|
|
Long valueOf = Long.valueOf(this.$voiceChannelSelectedStore.getSelectedVoiceChannelId());
|
|
if (!(valueOf.longValue() != 0)) {
|
|
valueOf = null;
|
|
}
|
|
return new GuildScheduledEventListViewModel.StoreState(sortedWith, userGuildScheduledEventIds, channelsForGuild, canCreateAnyEvent, valueOf);
|
|
}
|
|
}
|