2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guildscheduledevent;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import c.d.b.a.a;
|
2021-10-15 06:18:26 +00:00
|
|
|
import c0.t.o;
|
|
|
|
import c0.z.d.k;
|
|
|
|
import c0.z.d.m;
|
2021-08-04 23:47:20 +00:00
|
|
|
import com.discord.api.channel.Channel;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
2021-10-07 06:22:31 +00:00
|
|
|
import com.discord.api.permission.Permission;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.app.AppViewModel;
|
2021-08-04 23:47:20 +00:00
|
|
|
import com.discord.stores.StoreChannels;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.stores.StoreGuildScheduledEvents;
|
2021-08-13 06:23:11 +00:00
|
|
|
import com.discord.stores.StoreGuilds;
|
2021-08-10 21:19:22 +00:00
|
|
|
import com.discord.stores.StorePermissions;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.stores.StoreStream;
|
2021-09-27 20:31:35 +00:00
|
|
|
import com.discord.stores.StoreVoiceChannelSelected;
|
2021-08-13 06:23:11 +00:00
|
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
2021-08-20 02:22:46 +00:00
|
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities;
|
2021-10-07 06:22:31 +00:00
|
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.widgets.guildscheduledevent.GuildScheduledEventListItem;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2021-08-24 07:26:36 +00:00
|
|
|
import java.util.Set;
|
2021-08-03 07:33:18 +00:00
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import rx.Observable;
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public final class GuildScheduledEventListViewModel extends AppViewModel<ViewState> {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
2021-08-28 06:29:07 +00:00
|
|
|
private final Long channelId;
|
2021-08-04 23:47:20 +00:00
|
|
|
private final StoreChannels channelsStore;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final long guildId;
|
|
|
|
private final StoreGuildScheduledEvents guildScheduledEventsStore;
|
2021-08-13 06:23:11 +00:00
|
|
|
private final StoreGuilds guildsStore;
|
2021-08-10 21:19:22 +00:00
|
|
|
private final StorePermissions permissionsStore;
|
2021-09-27 20:31:35 +00:00
|
|
|
private final StoreVoiceChannelSelected voiceChannelSelectedStore;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
/* renamed from: com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel$1 reason: invalid class name */
|
|
|
|
public static final /* synthetic */ class AnonymousClass1 extends k implements Function1<StoreState, Unit> {
|
|
|
|
public AnonymousClass1(GuildScheduledEventListViewModel guildScheduledEventListViewModel) {
|
|
|
|
super(1, guildScheduledEventListViewModel, GuildScheduledEventListViewModel.class, "handleStoreState", "handleStoreState(Lcom/discord/widgets/guildscheduledevent/GuildScheduledEventListViewModel$StoreState;)V", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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] */
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public /* bridge */ /* synthetic */ Unit invoke(StoreState storeState) {
|
|
|
|
invoke(storeState);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void invoke(StoreState storeState) {
|
|
|
|
m.checkNotNullParameter(storeState, "p1");
|
|
|
|
GuildScheduledEventListViewModel.access$handleStoreState((GuildScheduledEventListViewModel) this.receiver, storeState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
2021-09-27 20:31:35 +00:00
|
|
|
public static final /* synthetic */ Observable access$observeStores(Companion companion, long j, Long l, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, StoreVoiceChannelSelected storeVoiceChannelSelected) {
|
|
|
|
return companion.observeStores(j, l, storeGuildScheduledEvents, storeChannels, storePermissions, storeGuilds, storeVoiceChannelSelected);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-09-27 20:31:35 +00:00
|
|
|
private final Observable<StoreState> observeStores(long j, Long l, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, StoreVoiceChannelSelected storeVoiceChannelSelected) {
|
|
|
|
return ObservationDeck.connectRx$default(ObservationDeckProvider.get(), new ObservationDeck.UpdateSource[]{storeGuildScheduledEvents, storeChannels, storePermissions, storeGuilds, storeVoiceChannelSelected}, false, null, null, new GuildScheduledEventListViewModel$Companion$observeStores$1(storeChannels, j, storeGuildScheduledEvents, l, storePermissions, storeVoiceChannelSelected), 14, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class StoreState {
|
2021-08-10 21:19:22 +00:00
|
|
|
private final boolean canCreateEvents;
|
2021-10-07 06:22:31 +00:00
|
|
|
private final Map<Long, Long> channelPermissions;
|
2021-08-04 23:47:20 +00:00
|
|
|
private final Map<Long, Channel> guildChannels;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final List<GuildScheduledEvent> guildScheduledEvents;
|
2021-09-27 20:31:35 +00:00
|
|
|
private final Long selectedVoiceChannelId;
|
2021-08-24 07:26:36 +00:00
|
|
|
private final Set<Long> userGuildScheduledEventIds;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
2021-10-07 06:22:31 +00:00
|
|
|
public StoreState(List<GuildScheduledEvent> list, Set<Long> set, Map<Long, Channel> map, boolean z2, Long l, Map<Long, Long> map2) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
2021-08-24 07:26:36 +00:00
|
|
|
m.checkNotNullParameter(set, "userGuildScheduledEventIds");
|
|
|
|
m.checkNotNullParameter(map, "guildChannels");
|
2021-10-07 06:22:31 +00:00
|
|
|
m.checkNotNullParameter(map2, "channelPermissions");
|
2021-08-03 07:33:18 +00:00
|
|
|
this.guildScheduledEvents = list;
|
2021-08-24 07:26:36 +00:00
|
|
|
this.userGuildScheduledEventIds = set;
|
|
|
|
this.guildChannels = map;
|
2021-08-10 21:19:22 +00:00
|
|
|
this.canCreateEvents = z2;
|
2021-09-27 20:31:35 +00:00
|
|
|
this.selectedVoiceChannelId = l;
|
2021-10-07 06:22:31 +00:00
|
|
|
this.channelPermissions = map2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-07 06:22:31 +00:00
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel$StoreState */
|
2021-08-03 07:33:18 +00:00
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
2021-10-07 06:22:31 +00:00
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, List list, Set set, Map map, boolean z2, Long l, Map map2, int i, Object obj) {
|
2021-08-03 07:33:18 +00:00
|
|
|
if ((i & 1) != 0) {
|
|
|
|
list = storeState.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
if ((i & 2) != 0) {
|
2021-08-24 07:26:36 +00:00
|
|
|
set = storeState.userGuildScheduledEventIds;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-04 23:47:20 +00:00
|
|
|
if ((i & 4) != 0) {
|
2021-08-24 07:26:36 +00:00
|
|
|
map = storeState.guildChannels;
|
2021-08-04 23:47:20 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
if ((i & 8) != 0) {
|
|
|
|
z2 = storeState.canCreateEvents;
|
|
|
|
}
|
2021-09-27 20:31:35 +00:00
|
|
|
if ((i & 16) != 0) {
|
|
|
|
l = storeState.selectedVoiceChannelId;
|
|
|
|
}
|
2021-10-07 06:22:31 +00:00
|
|
|
if ((i & 32) != 0) {
|
|
|
|
map2 = storeState.channelPermissions;
|
|
|
|
}
|
|
|
|
return storeState.copy(list, set, map, z2, l, map2);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> component1() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
2021-08-24 07:26:36 +00:00
|
|
|
public final Set<Long> component2() {
|
|
|
|
return this.userGuildScheduledEventIds;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-08-04 23:47:20 +00:00
|
|
|
public final Map<Long, Channel> component3() {
|
|
|
|
return this.guildChannels;
|
|
|
|
}
|
|
|
|
|
2021-08-20 02:22:46 +00:00
|
|
|
public final boolean component4() {
|
2021-08-10 21:19:22 +00:00
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
2021-09-27 20:31:35 +00:00
|
|
|
public final Long component5() {
|
|
|
|
return this.selectedVoiceChannelId;
|
|
|
|
}
|
|
|
|
|
2021-10-07 06:22:31 +00:00
|
|
|
public final Map<Long, Long> component6() {
|
|
|
|
return this.channelPermissions;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final StoreState copy(List<GuildScheduledEvent> list, Set<Long> set, Map<Long, Channel> map, boolean z2, Long l, Map<Long, Long> map2) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
2021-08-24 07:26:36 +00:00
|
|
|
m.checkNotNullParameter(set, "userGuildScheduledEventIds");
|
|
|
|
m.checkNotNullParameter(map, "guildChannels");
|
2021-10-07 06:22:31 +00:00
|
|
|
m.checkNotNullParameter(map2, "channelPermissions");
|
|
|
|
return new StoreState(list, set, map, z2, l, map2);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof StoreState)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
StoreState storeState = (StoreState) obj;
|
2021-10-07 06:22:31 +00:00
|
|
|
return m.areEqual(this.guildScheduledEvents, storeState.guildScheduledEvents) && m.areEqual(this.userGuildScheduledEventIds, storeState.userGuildScheduledEventIds) && m.areEqual(this.guildChannels, storeState.guildChannels) && this.canCreateEvents == storeState.canCreateEvents && m.areEqual(this.selectedVoiceChannelId, storeState.selectedVoiceChannelId) && m.areEqual(this.channelPermissions, storeState.channelPermissions);
|
2021-08-10 21:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean getCanCreateEvents() {
|
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
2021-10-07 06:22:31 +00:00
|
|
|
public final Map<Long, Long> getChannelPermissions() {
|
|
|
|
return this.channelPermissions;
|
|
|
|
}
|
|
|
|
|
2021-08-04 23:47:20 +00:00
|
|
|
public final Map<Long, Channel> getGuildChannels() {
|
|
|
|
return this.guildChannels;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> getGuildScheduledEvents() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
2021-09-27 20:31:35 +00:00
|
|
|
public final Long getSelectedVoiceChannelId() {
|
|
|
|
return this.selectedVoiceChannelId;
|
|
|
|
}
|
|
|
|
|
2021-08-24 07:26:36 +00:00
|
|
|
public final Set<Long> getUserGuildScheduledEventIds() {
|
|
|
|
return this.userGuildScheduledEventIds;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
List<GuildScheduledEvent> list = this.guildScheduledEvents;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
2021-08-24 07:26:36 +00:00
|
|
|
Set<Long> set = this.userGuildScheduledEventIds;
|
|
|
|
int hashCode2 = (hashCode + (set != null ? set.hashCode() : 0)) * 31;
|
|
|
|
Map<Long, Channel> map = this.guildChannels;
|
2021-09-27 20:31:35 +00:00
|
|
|
int hashCode3 = (hashCode2 + (map != null ? map.hashCode() : 0)) * 31;
|
2021-08-10 21:19:22 +00:00
|
|
|
boolean z2 = this.canCreateEvents;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-09-27 20:31:35 +00:00
|
|
|
int i2 = z2 ? 1 : 0;
|
2021-08-10 21:19:22 +00:00
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
2021-09-27 20:31:35 +00:00
|
|
|
int i5 = (hashCode3 + i2) * 31;
|
|
|
|
Long l = this.selectedVoiceChannelId;
|
2021-10-07 06:22:31 +00:00
|
|
|
int hashCode4 = (i5 + (l != null ? l.hashCode() : 0)) * 31;
|
|
|
|
Map<Long, Long> map2 = this.channelPermissions;
|
|
|
|
if (map2 != null) {
|
|
|
|
i = map2.hashCode();
|
2021-09-27 20:31:35 +00:00
|
|
|
}
|
2021-10-07 06:22:31 +00:00
|
|
|
return hashCode4 + i;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-10-09 06:29:02 +00:00
|
|
|
StringBuilder O = a.O("StoreState(guildScheduledEvents=");
|
|
|
|
O.append(this.guildScheduledEvents);
|
|
|
|
O.append(", userGuildScheduledEventIds=");
|
|
|
|
O.append(this.userGuildScheduledEventIds);
|
|
|
|
O.append(", guildChannels=");
|
|
|
|
O.append(this.guildChannels);
|
|
|
|
O.append(", canCreateEvents=");
|
|
|
|
O.append(this.canCreateEvents);
|
|
|
|
O.append(", selectedVoiceChannelId=");
|
|
|
|
O.append(this.selectedVoiceChannelId);
|
|
|
|
O.append(", channelPermissions=");
|
|
|
|
return a.J(O, this.channelPermissions, ")");
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static abstract class ViewState {
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class Initial extends ViewState {
|
|
|
|
public static final Initial INSTANCE = new Initial();
|
|
|
|
|
|
|
|
private Initial() {
|
|
|
|
super(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class Loaded extends ViewState {
|
2021-08-10 21:19:22 +00:00
|
|
|
private final boolean canCreateEvents;
|
2021-08-03 07:33:18 +00:00
|
|
|
private final List<GuildScheduledEventListItem.Event> guildScheduledEvents;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-08-10 21:19:22 +00:00
|
|
|
public Loaded(List<GuildScheduledEventListItem.Event> list, boolean z2) {
|
2021-08-03 07:33:18 +00:00
|
|
|
super(null);
|
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
|
|
|
this.guildScheduledEvents = list;
|
2021-08-10 21:19:22 +00:00
|
|
|
this.canCreateEvents = z2;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel$ViewState$Loaded */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
2021-08-10 21:19:22 +00:00
|
|
|
public static /* synthetic */ Loaded copy$default(Loaded loaded, List list, boolean z2, int i, Object obj) {
|
2021-08-03 07:33:18 +00:00
|
|
|
if ((i & 1) != 0) {
|
|
|
|
list = loaded.guildScheduledEvents;
|
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
if ((i & 2) != 0) {
|
|
|
|
z2 = loaded.canCreateEvents;
|
|
|
|
}
|
|
|
|
return loaded.copy(list, z2);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEventListItem.Event> component1() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
2021-08-10 21:19:22 +00:00
|
|
|
public final boolean component2() {
|
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Loaded copy(List<GuildScheduledEventListItem.Event> list, boolean z2) {
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
2021-08-10 21:19:22 +00:00
|
|
|
return new Loaded(list, z2);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
2021-08-10 21:19:22 +00:00
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
if (!(obj instanceof Loaded)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Loaded loaded = (Loaded) obj;
|
|
|
|
return m.areEqual(this.guildScheduledEvents, loaded.guildScheduledEvents) && this.canCreateEvents == loaded.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean getCanCreateEvents() {
|
|
|
|
return this.canCreateEvents;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEventListItem.Event> getGuildScheduledEvents() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
List<GuildScheduledEventListItem.Event> list = this.guildScheduledEvents;
|
2021-08-10 21:19:22 +00:00
|
|
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
|
|
|
boolean z2 = this.canCreateEvents;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
int i = z2 ? 1 : 0;
|
|
|
|
int i2 = z2 ? 1 : 0;
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
return hashCode + i;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-10-09 06:29:02 +00:00
|
|
|
StringBuilder O = a.O("Loaded(guildScheduledEvents=");
|
|
|
|
O.append(this.guildScheduledEvents);
|
|
|
|
O.append(", canCreateEvents=");
|
|
|
|
return a.K(O, this.canCreateEvents, ")");
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private ViewState() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-09-27 20:31:35 +00:00
|
|
|
public GuildScheduledEventListViewModel(long j, Long l, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, StoreVoiceChannelSelected storeVoiceChannelSelected, Observable<StoreState> observable) {
|
2021-08-03 07:33:18 +00:00
|
|
|
super(ViewState.Initial.INSTANCE);
|
|
|
|
m.checkNotNullParameter(storeGuildScheduledEvents, "guildScheduledEventsStore");
|
2021-08-04 23:47:20 +00:00
|
|
|
m.checkNotNullParameter(storeChannels, "channelsStore");
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullParameter(storePermissions, "permissionsStore");
|
2021-08-13 06:23:11 +00:00
|
|
|
m.checkNotNullParameter(storeGuilds, "guildsStore");
|
2021-09-27 20:31:35 +00:00
|
|
|
m.checkNotNullParameter(storeVoiceChannelSelected, "voiceChannelSelectedStore");
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
|
|
this.guildId = j;
|
2021-08-28 06:29:07 +00:00
|
|
|
this.channelId = l;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.guildScheduledEventsStore = storeGuildScheduledEvents;
|
2021-08-04 23:47:20 +00:00
|
|
|
this.channelsStore = storeChannels;
|
2021-08-10 21:19:22 +00:00
|
|
|
this.permissionsStore = storePermissions;
|
2021-08-13 06:23:11 +00:00
|
|
|
this.guildsStore = storeGuilds;
|
2021-09-27 20:31:35 +00:00
|
|
|
this.voiceChannelSelectedStore = storeVoiceChannelSelected;
|
2021-08-14 06:40:53 +00:00
|
|
|
storeGuildScheduledEvents.fetchGuildScheduledEventUserCounts(j);
|
2021-08-24 07:26:36 +00:00
|
|
|
storeGuildScheduledEvents.fetchUserGuildScheduledEvents(j);
|
2021-08-03 07:33:18 +00:00
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), GuildScheduledEventListViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
2021-09-27 20:31:35 +00:00
|
|
|
public /* synthetic */ GuildScheduledEventListViewModel(long j, Long l, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, StoreVoiceChannelSelected storeVoiceChannelSelected, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(j, l, r1, r11, r12, r13, r14, (i & 128) != 0 ? Companion.access$observeStores(Companion, j, l, r1, r11, r12, r13, r14) : observable);
|
2021-08-28 06:29:07 +00:00
|
|
|
StoreGuildScheduledEvents guildScheduledEvents = (i & 4) != 0 ? StoreStream.Companion.getGuildScheduledEvents() : storeGuildScheduledEvents;
|
|
|
|
StoreChannels channels = (i & 8) != 0 ? StoreStream.Companion.getChannels() : storeChannels;
|
|
|
|
StorePermissions permissions = (i & 16) != 0 ? StoreStream.Companion.getPermissions() : storePermissions;
|
|
|
|
StoreGuilds guilds = (i & 32) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds;
|
2021-09-27 20:31:35 +00:00
|
|
|
StoreVoiceChannelSelected voiceChannelSelected = (i & 64) != 0 ? StoreStream.Companion.getVoiceChannelSelected() : storeVoiceChannelSelected;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(GuildScheduledEventListViewModel guildScheduledEventListViewModel, StoreState storeState) {
|
|
|
|
guildScheduledEventListViewModel.handleStoreState(storeState);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleStoreState(StoreState storeState) {
|
2021-09-27 20:31:35 +00:00
|
|
|
boolean z2;
|
2021-08-03 07:33:18 +00:00
|
|
|
if (!(getViewState() instanceof ViewState.Loaded)) {
|
|
|
|
AnalyticsTracker.INSTANCE.openGuildScheduledEventSheet(this.guildId, storeState.getGuildScheduledEvents().size());
|
|
|
|
}
|
2021-08-04 23:47:20 +00:00
|
|
|
List<GuildScheduledEvent> guildScheduledEvents = storeState.getGuildScheduledEvents();
|
|
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(guildScheduledEvents, 10));
|
|
|
|
for (GuildScheduledEvent guildScheduledEvent : guildScheduledEvents) {
|
2021-08-17 07:10:14 +00:00
|
|
|
Long b = guildScheduledEvent.b();
|
2021-08-20 02:22:46 +00:00
|
|
|
Long l = null;
|
2021-08-17 07:10:14 +00:00
|
|
|
Channel channel = b != null ? storeState.getGuildChannels().get(Long.valueOf(b.longValue())) : null;
|
2021-08-24 07:26:36 +00:00
|
|
|
boolean contains = storeState.getUserGuildScheduledEventIds().contains(Long.valueOf(guildScheduledEvent.g()));
|
2021-08-20 02:22:46 +00:00
|
|
|
GuildScheduledEventUtilities.Companion companion = GuildScheduledEventUtilities.Companion;
|
2021-09-18 07:43:22 +00:00
|
|
|
boolean canStartEvent$default = GuildScheduledEventUtilities.Companion.canStartEvent$default(companion, this.guildId, channel != null ? Long.valueOf(channel.h()) : null, null, null, 12, null);
|
2021-08-20 02:22:46 +00:00
|
|
|
if (channel != null) {
|
|
|
|
l = Long.valueOf(channel.h());
|
2021-08-17 07:10:14 +00:00
|
|
|
}
|
2021-09-27 20:31:35 +00:00
|
|
|
boolean canShareEvent$default = GuildScheduledEventUtilities.Companion.canShareEvent$default(companion, l, null, null, null, 14, null);
|
|
|
|
Long selectedVoiceChannelId = storeState.getSelectedVoiceChannelId();
|
|
|
|
if (selectedVoiceChannelId != null) {
|
|
|
|
long longValue = selectedVoiceChannelId.longValue();
|
|
|
|
Long b2 = guildScheduledEvent.b();
|
2021-10-07 06:22:31 +00:00
|
|
|
z2 = b2 != null && longValue == b2.longValue();
|
2021-09-27 20:31:35 +00:00
|
|
|
} else {
|
|
|
|
z2 = false;
|
|
|
|
}
|
2021-10-07 06:22:31 +00:00
|
|
|
Long b3 = guildScheduledEvent.b();
|
|
|
|
arrayList.add(new GuildScheduledEventListItem.Event(guildScheduledEvent, channel, contains, canStartEvent$default, canShareEvent$default, z2, b3 != null ? PermissionUtils.can(Permission.CONNECT, storeState.getChannelPermissions().get(Long.valueOf(b3.longValue()))) : false));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-10 21:19:22 +00:00
|
|
|
updateViewState(new ViewState.Loaded(arrayList, storeState.getCanCreateEvents()));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void toggleRsvp(GuildScheduledEvent guildScheduledEvent) {
|
|
|
|
m.checkNotNullParameter(guildScheduledEvent, "guildScheduledEvent");
|
|
|
|
this.guildScheduledEventsStore.toggleRsvpGuildScheduledEvent(guildScheduledEvent);
|
|
|
|
}
|
|
|
|
}
|