forked from Juby210/discord-jadx
301 lines
16 KiB
Java
301 lines
16 KiB
Java
package com.discord.widgets.guildscheduledevent;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import c.d.b.a.a;
|
|
import c0.z.d.k;
|
|
import c0.z.d.m;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.domain.ModelInvite;
|
|
import com.discord.models.experiments.domain.Experiment;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreGuildScheduledEvents;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StoreInstantInvites;
|
|
import com.discord.stores.StoreInviteSettings;
|
|
import com.discord.stores.StoreStageInstances;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.rx.ObservableCombineLatestOverloadsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.guilds.invite.InviteGenerator;
|
|
import com.discord.widgets.guilds.invite.WidgetInviteModel;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.functions.Action1;
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
public final class WidgetGuildScheduledEventCreateSuccessViewModel extends AppViewModel<ViewState> {
|
|
private final Long channelId;
|
|
private final long guildId;
|
|
private final long guildScheduledEventId;
|
|
private final InviteGenerator inviteGenerator;
|
|
private final Resources resources;
|
|
private final StoreChannels storeChannels;
|
|
private final StoreGuildScheduledEvents storeGuildScheduledEvents;
|
|
private final StoreGuilds storeGuilds;
|
|
private final StoreInstantInvites storeInstantInvites;
|
|
private final StoreInviteSettings storeInviteSettings;
|
|
private final StoreStageInstances storeStageInstances;
|
|
private final StoreUser storeUser;
|
|
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
/* renamed from: com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventCreateSuccessViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1<T> implements Action1<ViewState.Loaded> {
|
|
public final /* synthetic */ WidgetGuildScheduledEventCreateSuccessViewModel this$0;
|
|
|
|
public AnonymousClass1(WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel) {
|
|
this.this$0 = widgetGuildScheduledEventCreateSuccessViewModel;
|
|
}
|
|
|
|
public final void call(ViewState.Loaded loaded) {
|
|
WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel = this.this$0;
|
|
m.checkNotNullExpressionValue(loaded, "viewState");
|
|
WidgetGuildScheduledEventCreateSuccessViewModel.access$generateInviteLinkFromViewState(widgetGuildScheduledEventCreateSuccessViewModel, loaded);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
/* renamed from: com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventCreateSuccessViewModel$2 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass2 extends k implements Function1<ViewState, Unit> {
|
|
public AnonymousClass2(WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel) {
|
|
super(1, widgetGuildScheduledEventCreateSuccessViewModel, WidgetGuildScheduledEventCreateSuccessViewModel.class, "updateViewState", "updateViewState(Ljava/lang/Object;)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(ViewState viewState) {
|
|
invoke(viewState);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(ViewState viewState) {
|
|
m.checkNotNullParameter(viewState, "p1");
|
|
WidgetGuildScheduledEventCreateSuccessViewModel.access$updateViewState((WidgetGuildScheduledEventCreateSuccessViewModel) this.receiver, viewState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
public static abstract class ViewState {
|
|
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
public static final class Loaded extends ViewState {
|
|
private final boolean showInviteSettings;
|
|
private final WidgetInviteModel widgetInviteModel;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loaded(WidgetInviteModel widgetInviteModel, boolean z2) {
|
|
super(null);
|
|
m.checkNotNullParameter(widgetInviteModel, "widgetInviteModel");
|
|
this.widgetInviteModel = widgetInviteModel;
|
|
this.showInviteSettings = z2;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ Loaded(WidgetInviteModel widgetInviteModel, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(widgetInviteModel, (i & 2) != 0 ? true : z2);
|
|
}
|
|
|
|
public static /* synthetic */ Loaded copy$default(Loaded loaded, WidgetInviteModel widgetInviteModel, boolean z2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
widgetInviteModel = loaded.widgetInviteModel;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
z2 = loaded.showInviteSettings;
|
|
}
|
|
return loaded.copy(widgetInviteModel, z2);
|
|
}
|
|
|
|
public final WidgetInviteModel component1() {
|
|
return this.widgetInviteModel;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.showInviteSettings;
|
|
}
|
|
|
|
public final Loaded copy(WidgetInviteModel widgetInviteModel, boolean z2) {
|
|
m.checkNotNullParameter(widgetInviteModel, "widgetInviteModel");
|
|
return new Loaded(widgetInviteModel, z2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Loaded)) {
|
|
return false;
|
|
}
|
|
Loaded loaded = (Loaded) obj;
|
|
return m.areEqual(this.widgetInviteModel, loaded.widgetInviteModel) && this.showInviteSettings == loaded.showInviteSettings;
|
|
}
|
|
|
|
public final boolean getShowInviteSettings() {
|
|
return this.showInviteSettings;
|
|
}
|
|
|
|
public final WidgetInviteModel getWidgetInviteModel() {
|
|
return this.widgetInviteModel;
|
|
}
|
|
|
|
public int hashCode() {
|
|
WidgetInviteModel widgetInviteModel = this.widgetInviteModel;
|
|
int hashCode = (widgetInviteModel != null ? widgetInviteModel.hashCode() : 0) * 31;
|
|
boolean z2 = this.showInviteSettings;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i = z2 ? 1 : 0;
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder O = a.O("Loaded(widgetInviteModel=");
|
|
O.append(this.widgetInviteModel);
|
|
O.append(", showInviteSettings=");
|
|
return a.K(O, this.showInviteSettings, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildScheduledEventCreateSuccessViewModel.kt */
|
|
public static final class Uninitialized extends ViewState {
|
|
public static final Uninitialized INSTANCE = new Uninitialized();
|
|
|
|
private Uninitialized() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private ViewState() {
|
|
}
|
|
|
|
public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public WidgetGuildScheduledEventCreateSuccessViewModel(Long l, long j, long j2, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreInviteSettings storeInviteSettings, StoreUser storeUser, StoreStageInstances storeStageInstances, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreInstantInvites storeInstantInvites, InviteGenerator inviteGenerator, Resources resources) {
|
|
super(ViewState.Uninitialized.INSTANCE);
|
|
m.checkNotNullParameter(storeChannels, "storeChannels");
|
|
m.checkNotNullParameter(storeGuilds, "storeGuilds");
|
|
m.checkNotNullParameter(storeInviteSettings, "storeInviteSettings");
|
|
m.checkNotNullParameter(storeUser, "storeUser");
|
|
m.checkNotNullParameter(storeStageInstances, "storeStageInstances");
|
|
m.checkNotNullParameter(storeGuildScheduledEvents, "storeGuildScheduledEvents");
|
|
m.checkNotNullParameter(storeInstantInvites, "storeInstantInvites");
|
|
m.checkNotNullParameter(inviteGenerator, "inviteGenerator");
|
|
m.checkNotNullParameter(resources, "resources");
|
|
this.channelId = l;
|
|
this.guildId = j;
|
|
this.guildScheduledEventId = j2;
|
|
this.storeChannels = storeChannels;
|
|
this.storeGuilds = storeGuilds;
|
|
this.storeInviteSettings = storeInviteSettings;
|
|
this.storeUser = storeUser;
|
|
this.storeStageInstances = storeStageInstances;
|
|
this.storeGuildScheduledEvents = storeGuildScheduledEvents;
|
|
this.storeInstantInvites = storeInstantInvites;
|
|
this.inviteGenerator = inviteGenerator;
|
|
this.resources = resources;
|
|
Observable<ViewState.Loaded> t = observeInvite(j, Long.valueOf(j2), null).t(new AnonymousClass1(this));
|
|
m.checkNotNullExpressionValue(t, "observeInvite(guildId, g…romViewState(viewState) }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(t), this, null, 2, null), WidgetGuildScheduledEventCreateSuccessViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ WidgetGuildScheduledEventCreateSuccessViewModel(Long l, long j, long j2, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreInviteSettings storeInviteSettings, StoreUser storeUser, StoreStageInstances storeStageInstances, StoreGuildScheduledEvents storeGuildScheduledEvents, StoreInstantInvites storeInstantInvites, InviteGenerator inviteGenerator, Resources resources, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(l, j, j2, (i & 8) != 0 ? StoreStream.Companion.getChannels() : storeChannels, (i & 16) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds, (i & 32) != 0 ? StoreStream.Companion.getInviteSettings() : storeInviteSettings, (i & 64) != 0 ? StoreStream.Companion.getUsers() : storeUser, (i & 128) != 0 ? StoreStream.Companion.getStageInstances() : storeStageInstances, (i & 256) != 0 ? StoreStream.Companion.getGuildScheduledEvents() : storeGuildScheduledEvents, (i & 512) != 0 ? StoreStream.Companion.getInstantInvites() : storeInstantInvites, (i & 1024) != 0 ? new InviteGenerator() : inviteGenerator, resources);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$generateInviteLinkFromViewState(WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel, ViewState.Loaded loaded) {
|
|
widgetGuildScheduledEventCreateSuccessViewModel.generateInviteLinkFromViewState(loaded);
|
|
}
|
|
|
|
public static final /* synthetic */ InviteGenerator access$getInviteGenerator$p(WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel) {
|
|
return widgetGuildScheduledEventCreateSuccessViewModel.inviteGenerator;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$updateViewState(WidgetGuildScheduledEventCreateSuccessViewModel widgetGuildScheduledEventCreateSuccessViewModel, ViewState viewState) {
|
|
widgetGuildScheduledEventCreateSuccessViewModel.updateViewState(viewState);
|
|
}
|
|
|
|
private final void generateInviteLinkFromViewState(ViewState.Loaded loaded) {
|
|
WidgetInviteModel widgetInviteModel = loaded.getWidgetInviteModel();
|
|
if (!widgetInviteModel.isValidInvite() && !widgetInviteModel.isGeneratingInvite() && widgetInviteModel.getTargetChannel() != null) {
|
|
this.inviteGenerator.generateForAppComponent(this, widgetInviteModel.getTargetChannel().h());
|
|
}
|
|
}
|
|
|
|
private final Observable<ViewState.Loaded> observeInvite(long j, Long l, String str) {
|
|
Observable<ViewState.Loaded> q = ObservableExtensionsKt.computationLatest(ObservableCombineLatestOverloadsKt.combineLatest(this.storeInviteSettings.getInviteSettings(), this.storeInviteSettings.getInvitableChannels(j), this.inviteGenerator.getGenerationState(), StoreUser.observeMe$default(this.storeUser, false, 1, null), this.storeChannels.observeDMs(), this.storeGuilds.observeGuild(j), this.storeStageInstances.observeStageInstancesForGuild(j), this.storeGuildScheduledEvents.observeGuildScheduledEvent(l, Long.valueOf(j)), this.storeInstantInvites.observeInvite(str), this.storeChannels.observeDefaultChannel(j), WidgetGuildScheduledEventCreateSuccessViewModel$observeInvite$1.INSTANCE)).q();
|
|
m.checkNotNullExpressionValue(q, "combineLatest(\n s… .distinctUntilChanged()");
|
|
return q;
|
|
}
|
|
|
|
public final void generateInviteLink(Long l) {
|
|
Observable<Channel> y2 = this.storeChannels.observeDefaultChannel(this.guildId).y();
|
|
m.checkNotNullExpressionValue(y2, "storeChannels.observeDef…tChannel(guildId).first()");
|
|
ObservableExtensionsKt.appSubscribe$default(y2, WidgetGuildScheduledEventCreateSuccessViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildScheduledEventCreateSuccessViewModel$generateInviteLink$1(this, l), 62, (Object) null);
|
|
}
|
|
|
|
public final Long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final Experiment getDefaultInviteExperiment() {
|
|
return this.storeInviteSettings.getInviteGuildExperiment(this.guildId, true);
|
|
}
|
|
|
|
public final long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final long getGuildScheduledEventId() {
|
|
return this.guildScheduledEventId;
|
|
}
|
|
|
|
public final Resources getResources() {
|
|
return this.resources;
|
|
}
|
|
|
|
public final StoreChannels getStoreChannels() {
|
|
return this.storeChannels;
|
|
}
|
|
|
|
public final StoreGuildScheduledEvents getStoreGuildScheduledEvents() {
|
|
return this.storeGuildScheduledEvents;
|
|
}
|
|
|
|
public final StoreGuilds getStoreGuilds() {
|
|
return this.storeGuilds;
|
|
}
|
|
|
|
public final StoreInstantInvites getStoreInstantInvites() {
|
|
return this.storeInstantInvites;
|
|
}
|
|
|
|
public final StoreInviteSettings getStoreInviteSettings() {
|
|
return this.storeInviteSettings;
|
|
}
|
|
|
|
public final StoreStageInstances getStoreStageInstances() {
|
|
return this.storeStageInstances;
|
|
}
|
|
|
|
public final StoreUser getStoreUser() {
|
|
return this.storeUser;
|
|
}
|
|
|
|
public final void updateInviteSettings(ModelInvite.Settings settings) {
|
|
m.checkNotNullParameter(settings, "settings");
|
|
this.storeInviteSettings.setInviteSettings(settings);
|
|
}
|
|
}
|