forked from Juby210/discord-jadx
64 lines
3.6 KiB
Java
64 lines
3.6 KiB
Java
package com.discord.widgets.guildscheduledevent;
|
|
|
|
import c0.t.u;
|
|
import c0.z.d.m;
|
|
import c0.z.d.o;
|
|
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 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 mo17invoke() {
|
|
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);
|
|
Map<Long, Long> permissionsByChannel = this.$permissionsStore.getPermissionsByChannel();
|
|
Long valueOf = Long.valueOf(this.$voiceChannelSelectedStore.getSelectedVoiceChannelId());
|
|
if (!(valueOf.longValue() != 0)) {
|
|
valueOf = null;
|
|
}
|
|
return new GuildScheduledEventListViewModel.StoreState(sortedWith, userGuildScheduledEventIds, channelsForGuild, canCreateAnyEvent, valueOf, permissionsByChannel);
|
|
}
|
|
}
|