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

193 lines
8.4 KiB
Java

package com.discord.widgets.guildscheduledevent;
import c.d.b.a.a;
import com.discord.api.channel.Channel;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
import com.discord.app.AppViewModel;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreStream;
import d0.z.d.m;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: WidgetGuildScheduledEventLocationSelectViewModal.kt */
public final class WidgetGuildScheduledEventLocationSelectViewModal extends AppViewModel<ViewState> {
public static final Companion Companion = new Companion(null);
private static final ViewState.Valid DEFAULT_VIEW_STATE = new ViewState.Valid(GuildScheduledEventEntityType.NONE, null, "");
private final StoreChannels channelsStore;
/* compiled from: WidgetGuildScheduledEventLocationSelectViewModal.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetGuildScheduledEventLocationSelectViewModal.kt */
public static abstract class ViewState {
/* compiled from: WidgetGuildScheduledEventLocationSelectViewModal.kt */
public static final class Invalid extends ViewState {
public static final Invalid INSTANCE = new Invalid();
private Invalid() {
super(null);
}
}
/* compiled from: WidgetGuildScheduledEventLocationSelectViewModal.kt */
public static final class Valid extends ViewState {
private final String externalLocation;
private final Channel selectedChannel;
private final GuildScheduledEventEntityType selectedLocationOption;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Valid(GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str) {
super(null);
m.checkNotNullParameter(guildScheduledEventEntityType, "selectedLocationOption");
m.checkNotNullParameter(str, "externalLocation");
this.selectedLocationOption = guildScheduledEventEntityType;
this.selectedChannel = channel;
this.externalLocation = str;
}
public static /* synthetic */ Valid copy$default(Valid valid, GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str, int i, Object obj) {
if ((i & 1) != 0) {
guildScheduledEventEntityType = valid.selectedLocationOption;
}
if ((i & 2) != 0) {
channel = valid.selectedChannel;
}
if ((i & 4) != 0) {
str = valid.externalLocation;
}
return valid.copy(guildScheduledEventEntityType, channel, str);
}
public final GuildScheduledEventEntityType component1() {
return this.selectedLocationOption;
}
public final Channel component2() {
return this.selectedChannel;
}
public final String component3() {
return this.externalLocation;
}
public final Valid copy(GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str) {
m.checkNotNullParameter(guildScheduledEventEntityType, "selectedLocationOption");
m.checkNotNullParameter(str, "externalLocation");
return new Valid(guildScheduledEventEntityType, channel, str);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Valid)) {
return false;
}
Valid valid = (Valid) obj;
return m.areEqual(this.selectedLocationOption, valid.selectedLocationOption) && m.areEqual(this.selectedChannel, valid.selectedChannel) && m.areEqual(this.externalLocation, valid.externalLocation);
}
public final String getExternalLocation() {
return this.externalLocation;
}
public final Channel getSelectedChannel() {
return this.selectedChannel;
}
public final GuildScheduledEventEntityType getSelectedLocationOption() {
return this.selectedLocationOption;
}
public int hashCode() {
GuildScheduledEventEntityType guildScheduledEventEntityType = this.selectedLocationOption;
int i = 0;
int hashCode = (guildScheduledEventEntityType != null ? guildScheduledEventEntityType.hashCode() : 0) * 31;
Channel channel = this.selectedChannel;
int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31;
String str = this.externalLocation;
if (str != null) {
i = str.hashCode();
}
return hashCode2 + i;
}
public String toString() {
StringBuilder L = a.L("Valid(selectedLocationOption=");
L.append(this.selectedLocationOption);
L.append(", selectedChannel=");
L.append(this.selectedChannel);
L.append(", externalLocation=");
return a.D(L, this.externalLocation, ")");
}
}
private ViewState() {
}
public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetGuildScheduledEventLocationSelectViewModal(long j, Long l, StoreChannels storeChannels) {
super(null, 1, null);
m.checkNotNullParameter(storeChannels, "channelsStore");
Channel channel = null;
this.channelsStore = storeChannels;
channel = l != null ? storeChannels.getChannel(l.longValue()) : channel;
if (channel != null) {
GuildScheduledEventEntityType entityTypeFromChannel = getEntityTypeFromChannel(channel);
if (entityTypeFromChannel == GuildScheduledEventEntityType.NONE) {
updateViewState(DEFAULT_VIEW_STATE);
} else {
updateViewState(new ViewState.Valid(entityTypeFromChannel, channel, ""));
}
} else {
updateViewState(DEFAULT_VIEW_STATE);
}
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetGuildScheduledEventLocationSelectViewModal(long j, Long l, StoreChannels storeChannels, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(j, l, (i & 4) != 0 ? StoreStream.Companion.getChannels() : storeChannels);
}
private final GuildScheduledEventEntityType getEntityTypeFromChannel(Channel channel) {
int A = channel.A();
return A != 2 ? A != 13 ? GuildScheduledEventEntityType.NONE : GuildScheduledEventEntityType.STAGE_INSTANCE : GuildScheduledEventEntityType.VOICE;
}
public final void selectChannel(long j) {
Channel channel;
ViewState viewState = getViewState();
if ((viewState instanceof ViewState.Valid) && (channel = this.channelsStore.getChannel(j)) != null) {
updateViewState(ViewState.Valid.copy$default((ViewState.Valid) viewState, null, channel, null, 5, null));
}
}
public final void selectLocationOption(GuildScheduledEventEntityType guildScheduledEventEntityType) {
m.checkNotNullParameter(guildScheduledEventEntityType, "locationOption");
ViewState viewState = getViewState();
if ((viewState instanceof ViewState.Valid) && guildScheduledEventEntityType != ((ViewState.Valid) viewState).getSelectedLocationOption()) {
updateViewState(new ViewState.Valid(guildScheduledEventEntityType, null, ""));
}
}
public final void setExternalLocation(String str) {
m.checkNotNullParameter(str, "newExternalLocation");
ViewState viewState = getViewState();
if (viewState instanceof ViewState.Valid) {
updateViewState(ViewState.Valid.copy$default((ViewState.Valid) viewState, null, null, str, 3, null));
}
}
}