2021-08-09 22:50:52 +00:00
|
|
|
package com.discord.widgets.guildscheduledevent;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import c.d.b.a.a;
|
2021-08-10 10:47:20 +00:00
|
|
|
import com.discord.api.channel.Channel;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEventStatus;
|
|
|
|
import com.discord.app.AppViewModel;
|
2021-08-10 10:47:20 +00:00
|
|
|
import com.discord.stores.StoreChannels;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.stores.StoreGuildScheduledEvents;
|
2021-08-18 07:29:27 +00:00
|
|
|
import com.discord.stores.StoreGuilds;
|
2021-08-10 10:47:20 +00:00
|
|
|
import com.discord.stores.StorePermissions;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.stores.StoreStream;
|
2021-08-18 07:29:27 +00:00
|
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
2021-08-24 07:28:10 +00:00
|
|
|
import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.widgets.guildscheduledevent.GuildScheduledEventListItem;
|
|
|
|
import d0.t.o;
|
|
|
|
import d0.z.d.k;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
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-10 10:47:20 +00:00
|
|
|
private final StoreChannels channelsStore;
|
2021-08-09 22:50:52 +00:00
|
|
|
private final long guildId;
|
|
|
|
private final StoreGuildScheduledEvents guildScheduledEventsStore;
|
2021-08-18 07:29:27 +00:00
|
|
|
private final StoreGuilds guildsStore;
|
2021-08-10 10:47:20 +00:00
|
|
|
private final StorePermissions permissionsStore;
|
2021-08-09 22:50:52 +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-08-18 07:29:27 +00:00
|
|
|
public static final /* synthetic */ Observable access$observeStores(Companion companion, long j, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds) {
|
|
|
|
return companion.observeStores(j, storeGuildScheduledEvents, storeChannels, storePermissions, storeGuilds);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
2021-08-18 07:29:27 +00:00
|
|
|
private final Observable<StoreState> observeStores(long j, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds) {
|
2021-08-24 07:28:10 +00:00
|
|
|
return ObservationDeck.connectRx$default(ObservationDeckProvider.get(), new ObservationDeck.UpdateSource[]{storeGuildScheduledEvents, storeChannels, storePermissions, storeGuilds}, false, null, null, new GuildScheduledEventListViewModel$Companion$observeStores$1(storeChannels, j, storeGuildScheduledEvents, storePermissions), 14, null);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class GuildScheduledEventsComparator implements Comparator<GuildScheduledEvent> {
|
|
|
|
public static final GuildScheduledEventsComparator INSTANCE = new GuildScheduledEventsComparator();
|
|
|
|
|
|
|
|
private GuildScheduledEventsComparator() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:9:0x0017, code lost:
|
2021-08-24 07:28:10 +00:00
|
|
|
if ((r7 != null ? r7.k() : null) != r2) goto L_0x0019;
|
2021-08-09 22:50:52 +00:00
|
|
|
*/
|
|
|
|
public int compare(GuildScheduledEvent guildScheduledEvent, GuildScheduledEvent guildScheduledEvent2) {
|
|
|
|
GuildScheduledEventStatus guildScheduledEventStatus = null;
|
2021-08-24 07:28:10 +00:00
|
|
|
GuildScheduledEventStatus k = guildScheduledEvent != null ? guildScheduledEvent.k() : null;
|
2021-08-09 22:50:52 +00:00
|
|
|
GuildScheduledEventStatus guildScheduledEventStatus2 = GuildScheduledEventStatus.ACTIVE;
|
2021-08-24 07:28:10 +00:00
|
|
|
if (k == guildScheduledEventStatus2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
2021-08-24 07:28:10 +00:00
|
|
|
if ((guildScheduledEvent != null ? guildScheduledEvent.k() : null) != guildScheduledEventStatus2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
if (guildScheduledEvent2 != null) {
|
2021-08-24 07:28:10 +00:00
|
|
|
guildScheduledEventStatus = guildScheduledEvent2.k();
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
if (guildScheduledEventStatus == guildScheduledEventStatus2) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (guildScheduledEvent != null && guildScheduledEvent2 != null) {
|
2021-08-24 07:28:10 +00:00
|
|
|
return guildScheduledEvent.j().compareTo(guildScheduledEvent2.j());
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
if (guildScheduledEvent == null) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return guildScheduledEvent2 == null ? -1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: GuildScheduledEventListViewModel.kt */
|
|
|
|
public static final class StoreState {
|
2021-08-10 10:47:20 +00:00
|
|
|
private final boolean canCreateEvents;
|
|
|
|
private final Map<Long, Channel> guildChannels;
|
2021-08-09 22:50:52 +00:00
|
|
|
private final List<GuildScheduledEvent> guildScheduledEvents;
|
|
|
|
private final Map<Long, GuildScheduledEvent> userGuildScheduledEvents;
|
|
|
|
|
2021-08-24 07:28:10 +00:00
|
|
|
public StoreState(List<GuildScheduledEvent> list, Map<Long, GuildScheduledEvent> map, Map<Long, Channel> map2, boolean z2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
|
|
|
m.checkNotNullParameter(map, "userGuildScheduledEvents");
|
2021-08-10 10:47:20 +00:00
|
|
|
m.checkNotNullParameter(map2, "guildChannels");
|
2021-08-09 22:50:52 +00:00
|
|
|
this.guildScheduledEvents = list;
|
|
|
|
this.userGuildScheduledEvents = map;
|
2021-08-10 10:47:20 +00:00
|
|
|
this.guildChannels = map2;
|
|
|
|
this.canCreateEvents = z2;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
2021-08-24 07:28:10 +00:00
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.guildscheduledevent.GuildScheduledEventListViewModel$StoreState */
|
2021-08-09 22:50:52 +00:00
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
2021-08-24 07:28:10 +00:00
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, List list, Map map, Map map2, boolean z2, int i, Object obj) {
|
2021-08-09 22:50:52 +00:00
|
|
|
if ((i & 1) != 0) {
|
|
|
|
list = storeState.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
map = storeState.userGuildScheduledEvents;
|
|
|
|
}
|
2021-08-10 10:47:20 +00:00
|
|
|
if ((i & 4) != 0) {
|
|
|
|
map2 = storeState.guildChannels;
|
|
|
|
}
|
|
|
|
if ((i & 8) != 0) {
|
|
|
|
z2 = storeState.canCreateEvents;
|
|
|
|
}
|
2021-08-24 07:28:10 +00:00
|
|
|
return storeState.copy(list, map, map2, z2);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> component1() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, GuildScheduledEvent> component2() {
|
|
|
|
return this.userGuildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
2021-08-10 10:47:20 +00:00
|
|
|
public final Map<Long, Channel> component3() {
|
|
|
|
return this.guildChannels;
|
|
|
|
}
|
|
|
|
|
2021-08-24 07:28:10 +00:00
|
|
|
public final boolean component4() {
|
2021-08-10 10:47:20 +00:00
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
2021-08-24 07:28:10 +00:00
|
|
|
public final StoreState copy(List<GuildScheduledEvent> list, Map<Long, GuildScheduledEvent> map, Map<Long, Channel> map2, boolean z2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
|
|
|
m.checkNotNullParameter(map, "userGuildScheduledEvents");
|
2021-08-10 10:47:20 +00:00
|
|
|
m.checkNotNullParameter(map2, "guildChannels");
|
2021-08-24 07:28:10 +00:00
|
|
|
return new StoreState(list, map, map2, z2);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof StoreState)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
StoreState storeState = (StoreState) obj;
|
2021-08-24 07:28:10 +00:00
|
|
|
return m.areEqual(this.guildScheduledEvents, storeState.guildScheduledEvents) && m.areEqual(this.userGuildScheduledEvents, storeState.userGuildScheduledEvents) && m.areEqual(this.guildChannels, storeState.guildChannels) && this.canCreateEvents == storeState.canCreateEvents;
|
2021-08-10 10:47:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean getCanCreateEvents() {
|
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, Channel> getGuildChannels() {
|
|
|
|
return this.guildChannels;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> getGuildScheduledEvents() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, GuildScheduledEvent> getUserGuildScheduledEvents() {
|
|
|
|
return this.userGuildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
List<GuildScheduledEvent> list = this.guildScheduledEvents;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
|
|
|
Map<Long, GuildScheduledEvent> map = this.userGuildScheduledEvents;
|
2021-08-10 10:47:20 +00:00
|
|
|
int hashCode2 = (hashCode + (map != null ? map.hashCode() : 0)) * 31;
|
|
|
|
Map<Long, Channel> map2 = this.guildChannels;
|
2021-08-24 07:28:10 +00:00
|
|
|
if (map2 != null) {
|
|
|
|
i = map2.hashCode();
|
|
|
|
}
|
|
|
|
int i2 = (hashCode2 + i) * 31;
|
2021-08-10 10:47:20 +00:00
|
|
|
boolean z2 = this.canCreateEvents;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
2021-08-24 07:28:10 +00:00
|
|
|
int i5 = z2 ? 1 : 0;
|
|
|
|
return i2 + i3;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-08-18 07:29:27 +00:00
|
|
|
StringBuilder L = a.L("StoreState(guildScheduledEvents=");
|
|
|
|
L.append(this.guildScheduledEvents);
|
|
|
|
L.append(", userGuildScheduledEvents=");
|
|
|
|
L.append(this.userGuildScheduledEvents);
|
|
|
|
L.append(", guildChannels=");
|
|
|
|
L.append(this.guildChannels);
|
|
|
|
L.append(", canCreateEvents=");
|
2021-08-24 07:28:10 +00:00
|
|
|
return a.G(L, this.canCreateEvents, ")");
|
2021-08-09 22:50:52 +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 10:47:20 +00:00
|
|
|
private final boolean canCreateEvents;
|
2021-08-09 22:50:52 +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 10:47:20 +00:00
|
|
|
public Loaded(List<GuildScheduledEventListItem.Event> list, boolean z2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
super(null);
|
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
|
|
|
this.guildScheduledEvents = list;
|
2021-08-10 10:47:20 +00:00
|
|
|
this.canCreateEvents = z2;
|
2021-08-09 22:50:52 +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 10:47:20 +00:00
|
|
|
public static /* synthetic */ Loaded copy$default(Loaded loaded, List list, boolean z2, int i, Object obj) {
|
2021-08-09 22:50:52 +00:00
|
|
|
if ((i & 1) != 0) {
|
|
|
|
list = loaded.guildScheduledEvents;
|
|
|
|
}
|
2021-08-10 10:47:20 +00:00
|
|
|
if ((i & 2) != 0) {
|
|
|
|
z2 = loaded.canCreateEvents;
|
|
|
|
}
|
|
|
|
return loaded.copy(list, z2);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEventListItem.Event> component1() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
2021-08-10 10:47:20 +00:00
|
|
|
public final boolean component2() {
|
|
|
|
return this.canCreateEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Loaded copy(List<GuildScheduledEventListItem.Event> list, boolean z2) {
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullParameter(list, "guildScheduledEvents");
|
2021-08-10 10:47:20 +00:00
|
|
|
return new Loaded(list, z2);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
2021-08-10 10:47:20 +00:00
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
2021-08-10 10:47:20 +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-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEventListItem.Event> getGuildScheduledEvents() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
List<GuildScheduledEventListItem.Event> list = this.guildScheduledEvents;
|
2021-08-10 10:47:20 +00:00
|
|
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
|
|
|
boolean z2 = this.canCreateEvents;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
2021-08-10 10:47:20 +00:00
|
|
|
int i = z2 ? 1 : 0;
|
|
|
|
int i2 = z2 ? 1 : 0;
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
return hashCode + i;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-08-18 07:29:27 +00:00
|
|
|
StringBuilder L = a.L("Loaded(guildScheduledEvents=");
|
|
|
|
L.append(this.guildScheduledEvents);
|
|
|
|
L.append(", canCreateEvents=");
|
|
|
|
return a.G(L, this.canCreateEvents, ")");
|
2021-08-09 22:50:52 +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-08-18 07:29:27 +00:00
|
|
|
public GuildScheduledEventListViewModel(long j, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, Observable<StoreState> observable) {
|
2021-08-09 22:50:52 +00:00
|
|
|
super(ViewState.Initial.INSTANCE);
|
|
|
|
m.checkNotNullParameter(storeGuildScheduledEvents, "guildScheduledEventsStore");
|
2021-08-10 10:47:20 +00:00
|
|
|
m.checkNotNullParameter(storeChannels, "channelsStore");
|
|
|
|
m.checkNotNullParameter(storePermissions, "permissionsStore");
|
2021-08-18 07:29:27 +00:00
|
|
|
m.checkNotNullParameter(storeGuilds, "guildsStore");
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
|
|
this.guildId = j;
|
|
|
|
this.guildScheduledEventsStore = storeGuildScheduledEvents;
|
2021-08-10 10:47:20 +00:00
|
|
|
this.channelsStore = storeChannels;
|
|
|
|
this.permissionsStore = storePermissions;
|
2021-08-18 07:29:27 +00:00
|
|
|
this.guildsStore = storeGuilds;
|
|
|
|
storeGuildScheduledEvents.fetchGuildScheduledEventUserCounts(j);
|
|
|
|
storeGuildScheduledEvents.fetchUserGuildScheduledEvents();
|
2021-08-09 22:50:52 +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-08-18 07:29:27 +00:00
|
|
|
public /* synthetic */ GuildScheduledEventListViewModel(long j, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuilds storeGuilds, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(j, r4, r5, r6, r7, (i & 32) != 0 ? Companion.access$observeStores(Companion, j, r4, r5, r6, r7) : observable);
|
|
|
|
StoreGuildScheduledEvents guildScheduledEvents = (i & 2) != 0 ? StoreStream.Companion.getGuildScheduledEvents() : storeGuildScheduledEvents;
|
|
|
|
StoreChannels channels = (i & 4) != 0 ? StoreStream.Companion.getChannels() : storeChannels;
|
|
|
|
StorePermissions permissions = (i & 8) != 0 ? StoreStream.Companion.getPermissions() : storePermissions;
|
|
|
|
StoreGuilds guilds = (i & 16) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds;
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(GuildScheduledEventListViewModel guildScheduledEventListViewModel, StoreState storeState) {
|
|
|
|
guildScheduledEventListViewModel.handleStoreState(storeState);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleStoreState(StoreState storeState) {
|
|
|
|
if (!(getViewState() instanceof ViewState.Loaded)) {
|
|
|
|
AnalyticsTracker.INSTANCE.openGuildScheduledEventSheet(this.guildId, storeState.getGuildScheduledEvents().size());
|
|
|
|
}
|
2021-08-10 10:47:20 +00:00
|
|
|
List<GuildScheduledEvent> guildScheduledEvents = storeState.getGuildScheduledEvents();
|
|
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(guildScheduledEvents, 10));
|
|
|
|
for (GuildScheduledEvent guildScheduledEvent : guildScheduledEvents) {
|
2021-08-24 07:28:10 +00:00
|
|
|
Long b = guildScheduledEvent.b();
|
|
|
|
Long l = null;
|
|
|
|
Channel channel = b != null ? storeState.getGuildChannels().get(Long.valueOf(b.longValue())) : null;
|
|
|
|
boolean contains = storeState.getUserGuildScheduledEvents().keySet().contains(Long.valueOf(guildScheduledEvent.g()));
|
|
|
|
GuildScheduledEventUtilities.Companion companion = GuildScheduledEventUtilities.Companion;
|
|
|
|
boolean canStartEvent$default = GuildScheduledEventUtilities.Companion.canStartEvent$default(companion, channel != null ? Long.valueOf(channel.h()) : null, null, null, 6, null);
|
|
|
|
if (channel != null) {
|
|
|
|
l = Long.valueOf(channel.h());
|
|
|
|
}
|
|
|
|
arrayList.add(new GuildScheduledEventListItem.Event(guildScheduledEvent, channel, contains, canStartEvent$default, GuildScheduledEventUtilities.Companion.canShareEvent$default(companion, l, null, null, null, 14, null)));
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
2021-08-10 10:47:20 +00:00
|
|
|
updateViewState(new ViewState.Loaded(arrayList, storeState.getCanCreateEvents()));
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void toggleRsvp(GuildScheduledEvent guildScheduledEvent) {
|
|
|
|
m.checkNotNullParameter(guildScheduledEvent, "guildScheduledEvent");
|
|
|
|
this.guildScheduledEventsStore.toggleRsvpGuildScheduledEvent(guildScheduledEvent);
|
|
|
|
}
|
|
|
|
}
|