721 lines
32 KiB
Java
721 lines
32 KiB
Java
package com.discord.widgets.chat.list.sheet;
|
|
|
|
import android.content.Context;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.commands.ApplicationCommandData;
|
|
import com.discord.api.role.GuildRole;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.commands.Application;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.models.user.User;
|
|
import com.discord.stores.StoreApplicationCommands;
|
|
import com.discord.stores.StoreApplicationInteractions;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreGatewayConnection;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import d0.t.u;
|
|
import d0.z.d.k;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import j0.k.b;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public final class WidgetApplicationCommandBottomSheetViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final long applicationId;
|
|
private final long channelId;
|
|
private final Long guildId;
|
|
private final long interactionId;
|
|
private final long interactionUserId;
|
|
private final long messageId;
|
|
private final String messageNonce;
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.list.sheet.WidgetApplicationCommandBottomSheetViewModel$1 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass1 extends k implements Function1<StoreState, Unit> {
|
|
public AnonymousClass1(WidgetApplicationCommandBottomSheetViewModel widgetApplicationCommandBottomSheetViewModel) {
|
|
super(1, widgetApplicationCommandBottomSheetViewModel, WidgetApplicationCommandBottomSheetViewModel.class, "handleStoreState", "handleStoreState(Lcom/discord/widgets/chat/list/sheet/WidgetApplicationCommandBottomSheetViewModel$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");
|
|
WidgetApplicationCommandBottomSheetViewModel.access$handleStoreState((WidgetApplicationCommandBottomSheetViewModel) this.receiver, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.list.sheet.WidgetApplicationCommandBottomSheetViewModel$2 reason: invalid class name */
|
|
public static final class AnonymousClass2<T, R> implements b<StoreState, UserData> {
|
|
public static final AnonymousClass2 INSTANCE = new AnonymousClass2();
|
|
|
|
public final UserData call(StoreState storeState) {
|
|
return new UserData(storeState.getMentionedUsers(), storeState.getUsers());
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.list.sheet.WidgetApplicationCommandBottomSheetViewModel$3 reason: invalid class name */
|
|
public static final class AnonymousClass3 extends o implements Function1<UserData, Unit> {
|
|
public final /* synthetic */ WidgetApplicationCommandBottomSheetViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass3(WidgetApplicationCommandBottomSheetViewModel widgetApplicationCommandBottomSheetViewModel) {
|
|
super(1);
|
|
this.this$0 = widgetApplicationCommandBottomSheetViewModel;
|
|
}
|
|
|
|
/* 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(UserData userData) {
|
|
invoke(userData);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(UserData userData) {
|
|
if (this.this$0.getGuildId() != null) {
|
|
StoreGatewayConnection.requestGuildMembers$default(StoreStream.Companion.getGatewaySocket(), this.this$0.getGuildId().longValue(), null, u.toList(userData.getMentionedUserIds()), null, 10, null);
|
|
}
|
|
if (userData.getUsers().size() != userData.getMentionedUserIds().size()) {
|
|
StoreStream.Companion.getUsers().fetchUsers(u.toList(userData.getMentionedUserIds()));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStores(Companion companion, ObservationDeck observationDeck, long j, Long l, long j2, long j3, StoreGuilds storeGuilds, StoreChannels storeChannels, StoreUser storeUser, StoreApplicationInteractions storeApplicationInteractions, StoreApplicationCommands storeApplicationCommands) {
|
|
return companion.observeStores(observationDeck, j, l, j2, j3, storeGuilds, storeChannels, storeUser, storeApplicationInteractions, storeApplicationCommands);
|
|
}
|
|
|
|
private final Observable<StoreState> observeStores(ObservationDeck observationDeck, long j, Long l, long j2, long j3, StoreGuilds storeGuilds, StoreChannels storeChannels, StoreUser storeUser, StoreApplicationInteractions storeApplicationInteractions, StoreApplicationCommands storeApplicationCommands) {
|
|
return ObservationDeck.connectRx$default(observationDeck, new ObservationDeck.UpdateSource[]{storeApplicationCommands, storeChannels, storeApplicationInteractions, storeGuilds, storeUser}, false, null, null, new WidgetApplicationCommandBottomSheetViewModel$Companion$observeStores$1(storeApplicationInteractions, j, storeApplicationCommands, j3, j2, storeGuilds, l, storeUser, storeChannels), 14, null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class SlashCommandParam {
|
|
private final String copyText;
|
|
private final String name;
|
|
private final String value;
|
|
private final Integer valueColor;
|
|
|
|
public SlashCommandParam(String str, String str2, Integer num, String str3) {
|
|
a.i0(str, "name", str2, "value", str3, "copyText");
|
|
this.name = str;
|
|
this.value = str2;
|
|
this.valueColor = num;
|
|
this.copyText = str3;
|
|
}
|
|
|
|
public static /* synthetic */ SlashCommandParam copy$default(SlashCommandParam slashCommandParam, String str, String str2, Integer num, String str3, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = slashCommandParam.name;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
str2 = slashCommandParam.value;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
num = slashCommandParam.valueColor;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
str3 = slashCommandParam.copyText;
|
|
}
|
|
return slashCommandParam.copy(str, str2, num, str3);
|
|
}
|
|
|
|
public final String component1() {
|
|
return this.name;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.value;
|
|
}
|
|
|
|
public final Integer component3() {
|
|
return this.valueColor;
|
|
}
|
|
|
|
public final String component4() {
|
|
return this.copyText;
|
|
}
|
|
|
|
public final SlashCommandParam copy(String str, String str2, Integer num, String str3) {
|
|
m.checkNotNullParameter(str, "name");
|
|
m.checkNotNullParameter(str2, "value");
|
|
m.checkNotNullParameter(str3, "copyText");
|
|
return new SlashCommandParam(str, str2, num, str3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof SlashCommandParam)) {
|
|
return false;
|
|
}
|
|
SlashCommandParam slashCommandParam = (SlashCommandParam) obj;
|
|
return m.areEqual(this.name, slashCommandParam.name) && m.areEqual(this.value, slashCommandParam.value) && m.areEqual(this.valueColor, slashCommandParam.valueColor) && m.areEqual(this.copyText, slashCommandParam.copyText);
|
|
}
|
|
|
|
public final String getCopyText() {
|
|
return this.copyText;
|
|
}
|
|
|
|
public final String getName() {
|
|
return this.name;
|
|
}
|
|
|
|
public final String getValue() {
|
|
return this.value;
|
|
}
|
|
|
|
public final Integer getValueColor() {
|
|
return this.valueColor;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String str = this.name;
|
|
int i = 0;
|
|
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
|
String str2 = this.value;
|
|
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
|
|
Integer num = this.valueColor;
|
|
int hashCode3 = (hashCode2 + (num != null ? num.hashCode() : 0)) * 31;
|
|
String str3 = this.copyText;
|
|
if (str3 != null) {
|
|
i = str3.hashCode();
|
|
}
|
|
return hashCode3 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("SlashCommandParam(name=");
|
|
L.append(this.name);
|
|
L.append(", value=");
|
|
L.append(this.value);
|
|
L.append(", valueColor=");
|
|
L.append(this.valueColor);
|
|
L.append(", copyText=");
|
|
return a.D(L, this.copyText, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class StoreState {
|
|
private final Application application;
|
|
private final Map<Long, Channel> channels;
|
|
private final Map<String, SlashCommandParam> commandValues;
|
|
private final Map<Long, GuildMember> guildMembers;
|
|
private final Map<Long, GuildRole> guildRoles;
|
|
private final StoreApplicationInteractions.State interactionState;
|
|
private final GuildMember interactionUser;
|
|
private final Set<Long> mentionedUsers;
|
|
private final User user;
|
|
private final Map<Long, User> users;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public StoreState(User user, GuildMember guildMember, StoreApplicationInteractions.State state, Application application, Set<Long> set, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, ? extends User> map3, Map<Long, Channel> map4, Map<String, SlashCommandParam> map5) {
|
|
m.checkNotNullParameter(set, "mentionedUsers");
|
|
m.checkNotNullParameter(map3, "users");
|
|
m.checkNotNullParameter(map4, "channels");
|
|
m.checkNotNullParameter(map5, "commandValues");
|
|
this.user = user;
|
|
this.interactionUser = guildMember;
|
|
this.interactionState = state;
|
|
this.application = application;
|
|
this.mentionedUsers = set;
|
|
this.guildMembers = map;
|
|
this.guildRoles = map2;
|
|
this.users = map3;
|
|
this.channels = map4;
|
|
this.commandValues = map5;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ StoreState(User user, GuildMember guildMember, StoreApplicationInteractions.State state, Application application, Set set, Map map, Map map2, Map map3, Map map4, Map map5, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(user, (i & 2) != 0 ? null : guildMember, state, application, set, map, map2, map3, map4, map5);
|
|
}
|
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, User user, GuildMember guildMember, StoreApplicationInteractions.State state, Application application, Set set, Map map, Map map2, Map map3, Map map4, Map map5, int i, Object obj) {
|
|
return storeState.copy((i & 1) != 0 ? storeState.user : user, (i & 2) != 0 ? storeState.interactionUser : guildMember, (i & 4) != 0 ? storeState.interactionState : state, (i & 8) != 0 ? storeState.application : application, (i & 16) != 0 ? storeState.mentionedUsers : set, (i & 32) != 0 ? storeState.guildMembers : map, (i & 64) != 0 ? storeState.guildRoles : map2, (i & 128) != 0 ? storeState.users : map3, (i & 256) != 0 ? storeState.channels : map4, (i & 512) != 0 ? storeState.commandValues : map5);
|
|
}
|
|
|
|
public final User component1() {
|
|
return this.user;
|
|
}
|
|
|
|
public final Map<String, SlashCommandParam> component10() {
|
|
return this.commandValues;
|
|
}
|
|
|
|
public final GuildMember component2() {
|
|
return this.interactionUser;
|
|
}
|
|
|
|
public final StoreApplicationInteractions.State component3() {
|
|
return this.interactionState;
|
|
}
|
|
|
|
public final Application component4() {
|
|
return this.application;
|
|
}
|
|
|
|
public final Set<Long> component5() {
|
|
return this.mentionedUsers;
|
|
}
|
|
|
|
public final Map<Long, GuildMember> component6() {
|
|
return this.guildMembers;
|
|
}
|
|
|
|
public final Map<Long, GuildRole> component7() {
|
|
return this.guildRoles;
|
|
}
|
|
|
|
public final Map<Long, User> component8() {
|
|
return this.users;
|
|
}
|
|
|
|
public final Map<Long, Channel> component9() {
|
|
return this.channels;
|
|
}
|
|
|
|
public final StoreState copy(User user, GuildMember guildMember, StoreApplicationInteractions.State state, Application application, Set<Long> set, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, ? extends User> map3, Map<Long, Channel> map4, Map<String, SlashCommandParam> map5) {
|
|
m.checkNotNullParameter(set, "mentionedUsers");
|
|
m.checkNotNullParameter(map3, "users");
|
|
m.checkNotNullParameter(map4, "channels");
|
|
m.checkNotNullParameter(map5, "commandValues");
|
|
return new StoreState(user, guildMember, state, application, set, map, map2, map3, map4, map5);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.user, storeState.user) && m.areEqual(this.interactionUser, storeState.interactionUser) && m.areEqual(this.interactionState, storeState.interactionState) && m.areEqual(this.application, storeState.application) && m.areEqual(this.mentionedUsers, storeState.mentionedUsers) && m.areEqual(this.guildMembers, storeState.guildMembers) && m.areEqual(this.guildRoles, storeState.guildRoles) && m.areEqual(this.users, storeState.users) && m.areEqual(this.channels, storeState.channels) && m.areEqual(this.commandValues, storeState.commandValues);
|
|
}
|
|
|
|
public final Application getApplication() {
|
|
return this.application;
|
|
}
|
|
|
|
public final Map<Long, Channel> getChannels() {
|
|
return this.channels;
|
|
}
|
|
|
|
public final Map<String, SlashCommandParam> getCommandValues() {
|
|
return this.commandValues;
|
|
}
|
|
|
|
public final Map<Long, GuildMember> getGuildMembers() {
|
|
return this.guildMembers;
|
|
}
|
|
|
|
public final Map<Long, GuildRole> getGuildRoles() {
|
|
return this.guildRoles;
|
|
}
|
|
|
|
public final StoreApplicationInteractions.State getInteractionState() {
|
|
return this.interactionState;
|
|
}
|
|
|
|
public final GuildMember getInteractionUser() {
|
|
return this.interactionUser;
|
|
}
|
|
|
|
public final Set<Long> getMentionedUsers() {
|
|
return this.mentionedUsers;
|
|
}
|
|
|
|
public final User getUser() {
|
|
return this.user;
|
|
}
|
|
|
|
public final Map<Long, User> getUsers() {
|
|
return this.users;
|
|
}
|
|
|
|
public int hashCode() {
|
|
User user = this.user;
|
|
int i = 0;
|
|
int hashCode = (user != null ? user.hashCode() : 0) * 31;
|
|
GuildMember guildMember = this.interactionUser;
|
|
int hashCode2 = (hashCode + (guildMember != null ? guildMember.hashCode() : 0)) * 31;
|
|
StoreApplicationInteractions.State state = this.interactionState;
|
|
int hashCode3 = (hashCode2 + (state != null ? state.hashCode() : 0)) * 31;
|
|
Application application = this.application;
|
|
int hashCode4 = (hashCode3 + (application != null ? application.hashCode() : 0)) * 31;
|
|
Set<Long> set = this.mentionedUsers;
|
|
int hashCode5 = (hashCode4 + (set != null ? set.hashCode() : 0)) * 31;
|
|
Map<Long, GuildMember> map = this.guildMembers;
|
|
int hashCode6 = (hashCode5 + (map != null ? map.hashCode() : 0)) * 31;
|
|
Map<Long, GuildRole> map2 = this.guildRoles;
|
|
int hashCode7 = (hashCode6 + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
Map<Long, User> map3 = this.users;
|
|
int hashCode8 = (hashCode7 + (map3 != null ? map3.hashCode() : 0)) * 31;
|
|
Map<Long, Channel> map4 = this.channels;
|
|
int hashCode9 = (hashCode8 + (map4 != null ? map4.hashCode() : 0)) * 31;
|
|
Map<String, SlashCommandParam> map5 = this.commandValues;
|
|
if (map5 != null) {
|
|
i = map5.hashCode();
|
|
}
|
|
return hashCode9 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("StoreState(user=");
|
|
L.append(this.user);
|
|
L.append(", interactionUser=");
|
|
L.append(this.interactionUser);
|
|
L.append(", interactionState=");
|
|
L.append(this.interactionState);
|
|
L.append(", application=");
|
|
L.append(this.application);
|
|
L.append(", mentionedUsers=");
|
|
L.append(this.mentionedUsers);
|
|
L.append(", guildMembers=");
|
|
L.append(this.guildMembers);
|
|
L.append(", guildRoles=");
|
|
L.append(this.guildRoles);
|
|
L.append(", users=");
|
|
L.append(this.users);
|
|
L.append(", channels=");
|
|
L.append(this.channels);
|
|
L.append(", commandValues=");
|
|
return a.F(L, this.commandValues, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class UserData {
|
|
private final Set<Long> mentionedUserIds;
|
|
private final Map<Long, User> users;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public UserData(Set<Long> set, Map<Long, ? extends User> map) {
|
|
m.checkNotNullParameter(set, "mentionedUserIds");
|
|
m.checkNotNullParameter(map, "users");
|
|
this.mentionedUserIds = set;
|
|
this.users = map;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.chat.list.sheet.WidgetApplicationCommandBottomSheetViewModel$UserData */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ UserData copy$default(UserData userData, Set set, Map map, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
set = userData.mentionedUserIds;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
map = userData.users;
|
|
}
|
|
return userData.copy(set, map);
|
|
}
|
|
|
|
public final Set<Long> component1() {
|
|
return this.mentionedUserIds;
|
|
}
|
|
|
|
public final Map<Long, User> component2() {
|
|
return this.users;
|
|
}
|
|
|
|
public final UserData copy(Set<Long> set, Map<Long, ? extends User> map) {
|
|
m.checkNotNullParameter(set, "mentionedUserIds");
|
|
m.checkNotNullParameter(map, "users");
|
|
return new UserData(set, map);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof UserData)) {
|
|
return false;
|
|
}
|
|
UserData userData = (UserData) obj;
|
|
return m.areEqual(this.mentionedUserIds, userData.mentionedUserIds) && m.areEqual(this.users, userData.users);
|
|
}
|
|
|
|
public final Set<Long> getMentionedUserIds() {
|
|
return this.mentionedUserIds;
|
|
}
|
|
|
|
public final Map<Long, User> getUsers() {
|
|
return this.users;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Set<Long> set = this.mentionedUserIds;
|
|
int i = 0;
|
|
int hashCode = (set != null ? set.hashCode() : 0) * 31;
|
|
Map<Long, User> map = this.users;
|
|
if (map != null) {
|
|
i = map.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("UserData(mentionedUserIds=");
|
|
L.append(this.mentionedUserIds);
|
|
L.append(", users=");
|
|
return a.F(L, this.users, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static abstract class ViewState {
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class Failed extends ViewState {
|
|
public static final Failed INSTANCE = new Failed();
|
|
|
|
private Failed() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class Loaded extends ViewState {
|
|
private final Application application;
|
|
private final ApplicationCommandData applicationCommandData;
|
|
private final Long channelId;
|
|
private final Map<Long, Channel> channels;
|
|
private final Map<String, SlashCommandParam> commandValues;
|
|
private final Long guildId;
|
|
private final Map<Long, GuildMember> guildMembers;
|
|
private final Map<Long, GuildRole> guildRoles;
|
|
|
|
/* renamed from: id reason: collision with root package name */
|
|
private final long f2139id;
|
|
private final GuildMember interactionUser;
|
|
private final User user;
|
|
private final Map<Long, String> usernamesOrNicks;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loaded(long j, User user, GuildMember guildMember, Application application, ApplicationCommandData applicationCommandData, Long l, Long l2, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, Channel> map3, Map<Long, String> map4, Map<String, SlashCommandParam> map5) {
|
|
super(null);
|
|
m.checkNotNullParameter(applicationCommandData, "applicationCommandData");
|
|
m.checkNotNullParameter(map4, "usernamesOrNicks");
|
|
m.checkNotNullParameter(map5, "commandValues");
|
|
this.f2139id = j;
|
|
this.user = user;
|
|
this.interactionUser = guildMember;
|
|
this.application = application;
|
|
this.applicationCommandData = applicationCommandData;
|
|
this.guildId = l;
|
|
this.channelId = l2;
|
|
this.guildMembers = map;
|
|
this.guildRoles = map2;
|
|
this.channels = map3;
|
|
this.usernamesOrNicks = map4;
|
|
this.commandValues = map5;
|
|
}
|
|
|
|
public final Application getApplication() {
|
|
return this.application;
|
|
}
|
|
|
|
public final ApplicationCommandData getApplicationCommandData() {
|
|
return this.applicationCommandData;
|
|
}
|
|
|
|
public final Long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final Map<Long, Channel> getChannels() {
|
|
return this.channels;
|
|
}
|
|
|
|
public final Map<String, SlashCommandParam> getCommandValues() {
|
|
return this.commandValues;
|
|
}
|
|
|
|
public final Long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final Map<Long, GuildMember> getGuildMembers() {
|
|
return this.guildMembers;
|
|
}
|
|
|
|
public final Map<Long, GuildRole> getGuildRoles() {
|
|
return this.guildRoles;
|
|
}
|
|
|
|
public final long getId() {
|
|
return this.f2139id;
|
|
}
|
|
|
|
public final GuildMember getInteractionUser() {
|
|
return this.interactionUser;
|
|
}
|
|
|
|
public final User getUser() {
|
|
return this.user;
|
|
}
|
|
|
|
public final Map<Long, String> getUsernamesOrNicks() {
|
|
return this.usernamesOrNicks;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetApplicationCommandBottomSheetViewModel.kt */
|
|
public static final class Loading extends ViewState {
|
|
public static final Loading INSTANCE = new Loading();
|
|
|
|
private Loading() {
|
|
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 WidgetApplicationCommandBottomSheetViewModel(long j, long j2, long j3, Long l, long j4, long j5, String str, Observable<StoreState> observable) {
|
|
super(ViewState.Loading.INSTANCE);
|
|
m.checkNotNullParameter(observable, "storeObservable");
|
|
this.interactionId = j;
|
|
this.messageId = j2;
|
|
this.channelId = j3;
|
|
this.guildId = l;
|
|
this.interactionUserId = j4;
|
|
this.applicationId = j5;
|
|
this.messageNonce = str;
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), WidgetApplicationCommandBottomSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
requestInteractionData();
|
|
Observable r = ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null).F(AnonymousClass2.INSTANCE).r();
|
|
m.checkNotNullExpressionValue(r, "storeObservable.computat… .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(r, WidgetApplicationCommandBottomSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass3(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ WidgetApplicationCommandBottomSheetViewModel(long j, long j2, long j3, Long l, long j4, long j5, String str, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(j, j2, j3, l, j4, j5, str, r14);
|
|
Observable observable2;
|
|
if ((i & 128) != 0) {
|
|
Companion companion = Companion;
|
|
ObservationDeck observationDeck = ObservationDeckProvider.get();
|
|
StoreStream.Companion companion2 = StoreStream.Companion;
|
|
observable2 = Companion.access$observeStores(companion, observationDeck, j, l, j4, j5, companion2.getGuilds(), companion2.getChannels(), companion2.getUsers(), companion2.getInteractions(), companion2.getApplicationCommands());
|
|
} else {
|
|
observable2 = observable;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(WidgetApplicationCommandBottomSheetViewModel widgetApplicationCommandBottomSheetViewModel, StoreState storeState) {
|
|
widgetApplicationCommandBottomSheetViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
private final void handleStoreState(StoreState storeState) {
|
|
String str;
|
|
StoreApplicationInteractions.State interactionState = storeState.getInteractionState();
|
|
if (m.areEqual(interactionState, StoreApplicationInteractions.State.Failure.INSTANCE)) {
|
|
updateViewState(ViewState.Failed.INSTANCE);
|
|
} else if (m.areEqual(interactionState, StoreApplicationInteractions.State.Fetching.INSTANCE)) {
|
|
updateViewState(ViewState.Loading.INSTANCE);
|
|
} else if (interactionState instanceof StoreApplicationInteractions.State.Loaded) {
|
|
if (storeState.getMentionedUsers().size() == storeState.getUsers().size()) {
|
|
int size = storeState.getMentionedUsers().size();
|
|
Map<Long, GuildMember> guildMembers = storeState.getGuildMembers();
|
|
if (guildMembers != null && size == guildMembers.size()) {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
for (Number number : storeState.getMentionedUsers()) {
|
|
long longValue = number.longValue();
|
|
GuildMember guildMember = storeState.getGuildMembers().get(Long.valueOf(longValue));
|
|
if (guildMember == null || (str = guildMember.getNick()) == null) {
|
|
User user = storeState.getUsers().get(Long.valueOf(longValue));
|
|
str = user != null ? user.getUsername() : null;
|
|
}
|
|
if (str == null) {
|
|
str = "";
|
|
}
|
|
linkedHashMap.put(Long.valueOf(longValue), str);
|
|
}
|
|
updateViewState(new ViewState.Loaded(this.interactionId, storeState.getUser(), storeState.getInteractionUser(), storeState.getApplication(), ((StoreApplicationInteractions.State.Loaded) storeState.getInteractionState()).getCommandOptions(), this.guildId, Long.valueOf(this.channelId), storeState.getGuildMembers(), storeState.getGuildRoles(), storeState.getChannels(), linkedHashMap, storeState.getCommandValues()));
|
|
return;
|
|
}
|
|
}
|
|
updateViewState(ViewState.Loading.INSTANCE);
|
|
}
|
|
}
|
|
|
|
private final void requestInteractionData() {
|
|
StoreStream.Companion.getInteractions().fetchInteractionDataIfNonExisting(this.interactionId, this.channelId, this.messageId, this.messageNonce);
|
|
}
|
|
|
|
public final long getApplicationId() {
|
|
return this.applicationId;
|
|
}
|
|
|
|
public final long getChannelId() {
|
|
return this.channelId;
|
|
}
|
|
|
|
public final Long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final long getInteractionId() {
|
|
return this.interactionId;
|
|
}
|
|
|
|
public final long getInteractionUserId() {
|
|
return this.interactionUserId;
|
|
}
|
|
|
|
public final long getMessageId() {
|
|
return this.messageId;
|
|
}
|
|
|
|
public final String getMessageNonce() {
|
|
return this.messageNonce;
|
|
}
|
|
|
|
public final void retry() {
|
|
requestInteractionData();
|
|
}
|
|
}
|