discord-jadx/app/src/main/java/com/discord/widgets/user/usersheet/WidgetUserSheetViewModel.java

2160 lines
103 KiB
Java

package com.discord.widgets.user.usersheet;
import a0.a.a.b;
import android.content.Context;
import androidx.annotation.MainThread;
import androidx.annotation.StringRes;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.api.role.GuildRole;
import com.discord.api.voice.state.StageRequestToSpeakState;
import com.discord.api.voice.state.VoiceState;
import com.discord.app.AppViewModel;
import com.discord.models.domain.ModelApplicationStream;
import com.discord.models.domain.ModelConnectedAccount;
import com.discord.models.domain.ModelUserNote;
import com.discord.models.domain.ModelUserProfile;
import com.discord.models.domain.ModelUserRelationship;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.presence.Presence;
import com.discord.models.user.MeUser;
import com.discord.models.user.User;
import com.discord.restapi.RestAPIParams;
import com.discord.simpleast.core.node.Node;
import com.discord.simpleast.core.parser.Parser;
import com.discord.stores.StoreApplicationStreamPreviews;
import com.discord.stores.StoreApplicationStreaming;
import com.discord.stores.StoreMediaSettings;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreUserNotes;
import com.discord.utilities.guilds.RoleUtils;
import com.discord.utilities.permissions.ManageUserContext;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.streams.StreamContext;
import com.discord.utilities.textprocessing.DiscordParser;
import com.discord.utilities.textprocessing.MessageParseState;
import com.discord.utilities.textprocessing.MessagePreprocessor;
import com.discord.utilities.textprocessing.MessageRenderContext;
import com.discord.utilities.textprocessing.node.SpoilerNode;
import com.discord.utilities.voice.PerceptualVolumeUtils;
import com.discord.widgets.stage.StageChannelAPI;
import com.discord.widgets.stage.StageRoles;
import com.discord.widgets.stage.usersheet.UserProfileStageActionsView;
import com.discord.widgets.user.presence.ModelRichPresence;
import com.discord.widgets.user.profile.UserProfileAdminView;
import com.discord.widgets.user.profile.UserProfileConnectionsView;
import com.discord.widgets.user.usersheet.UserProfileVoiceSettingsView;
import com.discord.widgets.user.usersheet.WidgetUserSheet;
import d0.g0.t;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
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;
import rx.subjects.PublishSubject;
/* compiled from: WidgetUserSheetViewModel.kt */
public final class WidgetUserSheetViewModel extends AppViewModel<ViewState> {
public static final Companion Companion = new Companion(null);
public static final String LOCATION = "User Profile";
private final Parser<MessageRenderContext, Node<MessageRenderContext>, MessageParseState> bioParser;
private final long channelId;
private final PublishSubject<Event> eventSubject;
private Set<String> fetchedPreviews;
private final String friendToken;
private final boolean isVoiceContext;
private StoreState mostRecentStoreState;
private final RestAPI restAPI;
private final RestAPI restAPISerializeNulls;
private final Set<Integer> revealedBioIndices;
private final StoreApplicationStreamPreviews storeApplicationStreamPreviews;
private final StoreApplicationStreaming storeApplicationStreaming;
private final StoreMediaSettings storeMediaSettings;
private final StoreUserNotes storeUserNotes;
private final WidgetUserSheet.StreamPreviewClickBehavior streamPreviewClickBehavior;
private final long userId;
/* compiled from: WidgetUserSheetViewModel.kt */
/* renamed from: com.discord.widgets.user.usersheet.WidgetUserSheetViewModel$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
public final /* synthetic */ WidgetUserSheetViewModel this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1(WidgetUserSheetViewModel widgetUserSheetViewModel) {
super(1);
this.this$0 = widgetUserSheetViewModel;
}
/* 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) {
WidgetUserSheetViewModel.access$handleStoreState(this.this$0, storeState);
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static abstract class Event {
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class DismissSheet extends Event {
public static final DismissSheet INSTANCE = new DismissSheet();
private DismissSheet() {
super(null);
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchBanUser extends Event {
private final long guildId;
private final long userId;
private final String username;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public LaunchBanUser(String str, long j, long j2) {
super(null);
m.checkNotNullParameter(str, "username");
this.username = str;
this.guildId = j;
this.userId = j2;
}
public static /* synthetic */ LaunchBanUser copy$default(LaunchBanUser launchBanUser, String str, long j, long j2, int i, Object obj) {
if ((i & 1) != 0) {
str = launchBanUser.username;
}
if ((i & 2) != 0) {
j = launchBanUser.guildId;
}
if ((i & 4) != 0) {
j2 = launchBanUser.userId;
}
return launchBanUser.copy(str, j, j2);
}
public final String component1() {
return this.username;
}
public final long component2() {
return this.guildId;
}
public final long component3() {
return this.userId;
}
public final LaunchBanUser copy(String str, long j, long j2) {
m.checkNotNullParameter(str, "username");
return new LaunchBanUser(str, j, j2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LaunchBanUser)) {
return false;
}
LaunchBanUser launchBanUser = (LaunchBanUser) obj;
return m.areEqual(this.username, launchBanUser.username) && this.guildId == launchBanUser.guildId && this.userId == launchBanUser.userId;
}
public final long getGuildId() {
return this.guildId;
}
public final long getUserId() {
return this.userId;
}
public final String getUsername() {
return this.username;
}
public int hashCode() {
String str = this.username;
int hashCode = str != null ? str.hashCode() : 0;
return b.a(this.userId) + ((b.a(this.guildId) + (hashCode * 31)) * 31);
}
public String toString() {
StringBuilder L = a.L("LaunchBanUser(username=");
L.append(this.username);
L.append(", guildId=");
L.append(this.guildId);
L.append(", userId=");
return a.A(L, this.userId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchEditMember extends Event {
private final long guildId;
private final long userId;
public LaunchEditMember(long j, long j2) {
super(null);
this.guildId = j;
this.userId = j2;
}
public static /* synthetic */ LaunchEditMember copy$default(LaunchEditMember launchEditMember, long j, long j2, int i, Object obj) {
if ((i & 1) != 0) {
j = launchEditMember.guildId;
}
if ((i & 2) != 0) {
j2 = launchEditMember.userId;
}
return launchEditMember.copy(j, j2);
}
public final long component1() {
return this.guildId;
}
public final long component2() {
return this.userId;
}
public final LaunchEditMember copy(long j, long j2) {
return new LaunchEditMember(j, j2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LaunchEditMember)) {
return false;
}
LaunchEditMember launchEditMember = (LaunchEditMember) obj;
return this.guildId == launchEditMember.guildId && this.userId == launchEditMember.userId;
}
public final long getGuildId() {
return this.guildId;
}
public final long getUserId() {
return this.userId;
}
public int hashCode() {
return b.a(this.userId) + (b.a(this.guildId) * 31);
}
public String toString() {
StringBuilder L = a.L("LaunchEditMember(guildId=");
L.append(this.guildId);
L.append(", userId=");
return a.A(L, this.userId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchKickUser extends Event {
private final long guildId;
private final long userId;
private final String username;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public LaunchKickUser(String str, long j, long j2) {
super(null);
m.checkNotNullParameter(str, "username");
this.username = str;
this.guildId = j;
this.userId = j2;
}
public static /* synthetic */ LaunchKickUser copy$default(LaunchKickUser launchKickUser, String str, long j, long j2, int i, Object obj) {
if ((i & 1) != 0) {
str = launchKickUser.username;
}
if ((i & 2) != 0) {
j = launchKickUser.guildId;
}
if ((i & 4) != 0) {
j2 = launchKickUser.userId;
}
return launchKickUser.copy(str, j, j2);
}
public final String component1() {
return this.username;
}
public final long component2() {
return this.guildId;
}
public final long component3() {
return this.userId;
}
public final LaunchKickUser copy(String str, long j, long j2) {
m.checkNotNullParameter(str, "username");
return new LaunchKickUser(str, j, j2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LaunchKickUser)) {
return false;
}
LaunchKickUser launchKickUser = (LaunchKickUser) obj;
return m.areEqual(this.username, launchKickUser.username) && this.guildId == launchKickUser.guildId && this.userId == launchKickUser.userId;
}
public final long getGuildId() {
return this.guildId;
}
public final long getUserId() {
return this.userId;
}
public final String getUsername() {
return this.username;
}
public int hashCode() {
String str = this.username;
int hashCode = str != null ? str.hashCode() : 0;
return b.a(this.userId) + ((b.a(this.guildId) + (hashCode * 31)) * 31);
}
public String toString() {
StringBuilder L = a.L("LaunchKickUser(username=");
L.append(this.username);
L.append(", guildId=");
L.append(this.guildId);
L.append(", userId=");
return a.A(L, this.userId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchMoveUser extends Event {
private final long guildId;
public LaunchMoveUser(long j) {
super(null);
this.guildId = j;
}
public static /* synthetic */ LaunchMoveUser copy$default(LaunchMoveUser launchMoveUser, long j, int i, Object obj) {
if ((i & 1) != 0) {
j = launchMoveUser.guildId;
}
return launchMoveUser.copy(j);
}
public final long component1() {
return this.guildId;
}
public final LaunchMoveUser copy(long j) {
return new LaunchMoveUser(j);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof LaunchMoveUser) && this.guildId == ((LaunchMoveUser) obj).guildId;
}
return true;
}
public final long getGuildId() {
return this.guildId;
}
public int hashCode() {
return b.a(this.guildId);
}
public String toString() {
return a.A(a.L("LaunchMoveUser(guildId="), this.guildId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchSpectate extends Event {
private final ModelApplicationStream stream;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public LaunchSpectate(ModelApplicationStream modelApplicationStream) {
super(null);
m.checkNotNullParameter(modelApplicationStream, "stream");
this.stream = modelApplicationStream;
}
public static /* synthetic */ LaunchSpectate copy$default(LaunchSpectate launchSpectate, ModelApplicationStream modelApplicationStream, int i, Object obj) {
if ((i & 1) != 0) {
modelApplicationStream = launchSpectate.stream;
}
return launchSpectate.copy(modelApplicationStream);
}
public final ModelApplicationStream component1() {
return this.stream;
}
public final LaunchSpectate copy(ModelApplicationStream modelApplicationStream) {
m.checkNotNullParameter(modelApplicationStream, "stream");
return new LaunchSpectate(modelApplicationStream);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof LaunchSpectate) && m.areEqual(this.stream, ((LaunchSpectate) obj).stream);
}
return true;
}
public final ModelApplicationStream getStream() {
return this.stream;
}
public int hashCode() {
ModelApplicationStream modelApplicationStream = this.stream;
if (modelApplicationStream != null) {
return modelApplicationStream.hashCode();
}
return 0;
}
public String toString() {
StringBuilder L = a.L("LaunchSpectate(stream=");
L.append(this.stream);
L.append(")");
return L.toString();
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchVideoCall extends Event {
private final long channelId;
public LaunchVideoCall(long j) {
super(null);
this.channelId = j;
}
public static /* synthetic */ LaunchVideoCall copy$default(LaunchVideoCall launchVideoCall, long j, int i, Object obj) {
if ((i & 1) != 0) {
j = launchVideoCall.channelId;
}
return launchVideoCall.copy(j);
}
public final long component1() {
return this.channelId;
}
public final LaunchVideoCall copy(long j) {
return new LaunchVideoCall(j);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof LaunchVideoCall) && this.channelId == ((LaunchVideoCall) obj).channelId;
}
return true;
}
public final long getChannelId() {
return this.channelId;
}
public int hashCode() {
return b.a(this.channelId);
}
public String toString() {
return a.A(a.L("LaunchVideoCall(channelId="), this.channelId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class LaunchVoiceCall extends Event {
private final long channelId;
public LaunchVoiceCall(long j) {
super(null);
this.channelId = j;
}
public static /* synthetic */ LaunchVoiceCall copy$default(LaunchVoiceCall launchVoiceCall, long j, int i, Object obj) {
if ((i & 1) != 0) {
j = launchVoiceCall.channelId;
}
return launchVoiceCall.copy(j);
}
public final long component1() {
return this.channelId;
}
public final LaunchVoiceCall copy(long j) {
return new LaunchVoiceCall(j);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof LaunchVoiceCall) && this.channelId == ((LaunchVoiceCall) obj).channelId;
}
return true;
}
public final long getChannelId() {
return this.channelId;
}
public int hashCode() {
return b.a(this.channelId);
}
public String toString() {
return a.A(a.L("LaunchVoiceCall(channelId="), this.channelId, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class RequestPermissionsForSpectateStream extends Event {
private final ModelApplicationStream stream;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public RequestPermissionsForSpectateStream(ModelApplicationStream modelApplicationStream) {
super(null);
m.checkNotNullParameter(modelApplicationStream, "stream");
this.stream = modelApplicationStream;
}
public static /* synthetic */ RequestPermissionsForSpectateStream copy$default(RequestPermissionsForSpectateStream requestPermissionsForSpectateStream, ModelApplicationStream modelApplicationStream, int i, Object obj) {
if ((i & 1) != 0) {
modelApplicationStream = requestPermissionsForSpectateStream.stream;
}
return requestPermissionsForSpectateStream.copy(modelApplicationStream);
}
public final ModelApplicationStream component1() {
return this.stream;
}
public final RequestPermissionsForSpectateStream copy(ModelApplicationStream modelApplicationStream) {
m.checkNotNullParameter(modelApplicationStream, "stream");
return new RequestPermissionsForSpectateStream(modelApplicationStream);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof RequestPermissionsForSpectateStream) && m.areEqual(this.stream, ((RequestPermissionsForSpectateStream) obj).stream);
}
return true;
}
public final ModelApplicationStream getStream() {
return this.stream;
}
public int hashCode() {
ModelApplicationStream modelApplicationStream = this.stream;
if (modelApplicationStream != null) {
return modelApplicationStream.hashCode();
}
return 0;
}
public String toString() {
StringBuilder L = a.L("RequestPermissionsForSpectateStream(stream=");
L.append(this.stream);
L.append(")");
return L.toString();
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class ShowFriendRequestErrorToast extends Event {
private final int abortCode;
private final String username;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public ShowFriendRequestErrorToast(int i, String str) {
super(null);
m.checkNotNullParameter(str, "username");
this.abortCode = i;
this.username = str;
}
public static /* synthetic */ ShowFriendRequestErrorToast copy$default(ShowFriendRequestErrorToast showFriendRequestErrorToast, int i, String str, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = showFriendRequestErrorToast.abortCode;
}
if ((i2 & 2) != 0) {
str = showFriendRequestErrorToast.username;
}
return showFriendRequestErrorToast.copy(i, str);
}
public final int component1() {
return this.abortCode;
}
public final String component2() {
return this.username;
}
public final ShowFriendRequestErrorToast copy(int i, String str) {
m.checkNotNullParameter(str, "username");
return new ShowFriendRequestErrorToast(i, str);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ShowFriendRequestErrorToast)) {
return false;
}
ShowFriendRequestErrorToast showFriendRequestErrorToast = (ShowFriendRequestErrorToast) obj;
return this.abortCode == showFriendRequestErrorToast.abortCode && m.areEqual(this.username, showFriendRequestErrorToast.username);
}
public final int getAbortCode() {
return this.abortCode;
}
public final String getUsername() {
return this.username;
}
public int hashCode() {
int i = this.abortCode * 31;
String str = this.username;
return i + (str != null ? str.hashCode() : 0);
}
public String toString() {
StringBuilder L = a.L("ShowFriendRequestErrorToast(abortCode=");
L.append(this.abortCode);
L.append(", username=");
return a.D(L, this.username, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class ShowToast extends Event {
private final int stringRes;
public ShowToast(int i) {
super(null);
this.stringRes = i;
}
public static /* synthetic */ ShowToast copy$default(ShowToast showToast, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = showToast.stringRes;
}
return showToast.copy(i);
}
public final int component1() {
return this.stringRes;
}
public final ShowToast copy(int i) {
return new ShowToast(i);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof ShowToast) && this.stringRes == ((ShowToast) obj).stringRes;
}
return true;
}
public final int getStringRes() {
return this.stringRes;
}
public int hashCode() {
return this.stringRes;
}
public String toString() {
return a.z(a.L("ShowToast(stringRes="), this.stringRes, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class UserNotFound extends Event {
public static final UserNotFound INSTANCE = new UserNotFound();
private UserNotFound() {
super(null);
}
}
private Event() {
}
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class StoreState {
private final Channel channel;
private final Map<Long, GuildMember> computedMembers;
private final Map<Long, VoiceState> currentChannelVoiceStates;
private final Guild guild;
private final Map<Long, GuildRole> guildRoles;
/* renamed from: me reason: collision with root package name */
private final MeUser f2154me;
private final boolean muted;
private final Map<Long, VoiceState> mySelectedVoiceChannelVoiceStates;
private final StageRoles myStageRoles;
private final float outputVolume;
private final Long permissions;
private final ModelRichPresence richPresence;
private final boolean selfDeafened;
private final boolean selfMuted;
private final Channel stageChannel;
private final StreamContext streamContext;
private final User user;
private final StoreUserNotes.UserNoteState userNoteFetchState;
private final ModelUserProfile userProfile;
private final Integer userRelationshipType;
private final StageRequestToSpeakState userRequestToSpeakState;
private final StageRoles userStageRoles;
private StoreState(User user, MeUser meUser, Channel channel, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, VoiceState> map3, Map<Long, VoiceState> map4, boolean z2, boolean z3, boolean z4, float f, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, ModelUserProfile modelUserProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, Channel channel2, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2) {
this.user = user;
this.f2154me = meUser;
this.channel = channel;
this.computedMembers = map;
this.guildRoles = map2;
this.mySelectedVoiceChannelVoiceStates = map3;
this.currentChannelVoiceStates = map4;
this.muted = z2;
this.selfMuted = z3;
this.selfDeafened = z4;
this.outputVolume = f;
this.richPresence = modelRichPresence;
this.guild = guild;
this.permissions = l;
this.streamContext = streamContext;
this.userProfile = modelUserProfile;
this.userRelationshipType = num;
this.userNoteFetchState = userNoteState;
this.stageChannel = channel2;
this.userStageRoles = stageRoles;
this.userRequestToSpeakState = stageRequestToSpeakState;
this.myStageRoles = stageRoles2;
}
public /* synthetic */ StoreState(User user, MeUser meUser, Channel channel, Map map, Map map2, Map map3, Map map4, boolean z2, boolean z3, boolean z4, float f, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, ModelUserProfile modelUserProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, Channel channel2, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2, DefaultConstructorMarker defaultConstructorMarker) {
this(user, meUser, channel, map, map2, map3, map4, z2, z3, z4, f, modelRichPresence, guild, l, streamContext, modelUserProfile, num, userNoteState, channel2, stageRoles, stageRequestToSpeakState, stageRoles2);
}
/* renamed from: copy-1YV1AGg$default reason: not valid java name */
public static /* synthetic */ StoreState m54copy1YV1AGg$default(StoreState storeState, User user, MeUser meUser, Channel channel, Map map, Map map2, Map map3, Map map4, boolean z2, boolean z3, boolean z4, float f, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, ModelUserProfile modelUserProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, Channel channel2, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2, int i, Object obj) {
return storeState.m57copy1YV1AGg((i & 1) != 0 ? storeState.user : user, (i & 2) != 0 ? storeState.f2154me : meUser, (i & 4) != 0 ? storeState.channel : channel, (i & 8) != 0 ? storeState.computedMembers : map, (i & 16) != 0 ? storeState.guildRoles : map2, (i & 32) != 0 ? storeState.mySelectedVoiceChannelVoiceStates : map3, (i & 64) != 0 ? storeState.currentChannelVoiceStates : map4, (i & 128) != 0 ? storeState.muted : z2, (i & 256) != 0 ? storeState.selfMuted : z3, (i & 512) != 0 ? storeState.selfDeafened : z4, (i & 1024) != 0 ? storeState.outputVolume : f, (i & 2048) != 0 ? storeState.richPresence : modelRichPresence, (i & 4096) != 0 ? storeState.guild : guild, (i & 8192) != 0 ? storeState.permissions : l, (i & 16384) != 0 ? storeState.streamContext : streamContext, (i & 32768) != 0 ? storeState.userProfile : modelUserProfile, (i & 65536) != 0 ? storeState.userRelationshipType : num, (i & 131072) != 0 ? storeState.userNoteFetchState : userNoteState, (i & 262144) != 0 ? storeState.stageChannel : channel2, (i & 524288) != 0 ? storeState.userStageRoles : stageRoles, (i & 1048576) != 0 ? storeState.userRequestToSpeakState : stageRequestToSpeakState, (i & 2097152) != 0 ? storeState.myStageRoles : stageRoles2);
}
public final User component1() {
return this.user;
}
public final boolean component10() {
return this.selfDeafened;
}
public final float component11() {
return this.outputVolume;
}
public final ModelRichPresence component12() {
return this.richPresence;
}
public final Guild component13() {
return this.guild;
}
public final Long component14() {
return this.permissions;
}
public final StreamContext component15() {
return this.streamContext;
}
public final ModelUserProfile component16() {
return this.userProfile;
}
public final Integer component17() {
return this.userRelationshipType;
}
public final StoreUserNotes.UserNoteState component18() {
return this.userNoteFetchState;
}
public final Channel component19() {
return this.stageChannel;
}
public final MeUser component2() {
return this.f2154me;
}
/* renamed from: component20-twRsX-0 reason: not valid java name */
public final StageRoles m55component20twRsX0() {
return this.userStageRoles;
}
public final StageRequestToSpeakState component21() {
return this.userRequestToSpeakState;
}
/* renamed from: component22-twRsX-0 reason: not valid java name */
public final StageRoles m56component22twRsX0() {
return this.myStageRoles;
}
public final Channel component3() {
return this.channel;
}
public final Map<Long, GuildMember> component4() {
return this.computedMembers;
}
public final Map<Long, GuildRole> component5() {
return this.guildRoles;
}
public final Map<Long, VoiceState> component6() {
return this.mySelectedVoiceChannelVoiceStates;
}
public final Map<Long, VoiceState> component7() {
return this.currentChannelVoiceStates;
}
public final boolean component8() {
return this.muted;
}
public final boolean component9() {
return this.selfMuted;
}
/* renamed from: copy-1YV1AGg reason: not valid java name */
public final StoreState m57copy1YV1AGg(User user, MeUser meUser, Channel channel, Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, VoiceState> map3, Map<Long, VoiceState> map4, boolean z2, boolean z3, boolean z4, float f, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, ModelUserProfile modelUserProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, Channel channel2, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2) {
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(meUser, "me");
m.checkNotNullParameter(map, "computedMembers");
m.checkNotNullParameter(map2, "guildRoles");
m.checkNotNullParameter(map3, "mySelectedVoiceChannelVoiceStates");
m.checkNotNullParameter(map4, "currentChannelVoiceStates");
m.checkNotNullParameter(modelUserProfile, "userProfile");
m.checkNotNullParameter(userNoteState, "userNoteFetchState");
m.checkNotNullParameter(stageRequestToSpeakState, "userRequestToSpeakState");
return new StoreState(user, meUser, channel, map, map2, map3, map4, z2, z3, z4, f, modelRichPresence, guild, l, streamContext, modelUserProfile, num, userNoteState, channel2, stageRoles, stageRequestToSpeakState, stageRoles2);
}
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.f2154me, storeState.f2154me) && m.areEqual(this.channel, storeState.channel) && m.areEqual(this.computedMembers, storeState.computedMembers) && m.areEqual(this.guildRoles, storeState.guildRoles) && m.areEqual(this.mySelectedVoiceChannelVoiceStates, storeState.mySelectedVoiceChannelVoiceStates) && m.areEqual(this.currentChannelVoiceStates, storeState.currentChannelVoiceStates) && this.muted == storeState.muted && this.selfMuted == storeState.selfMuted && this.selfDeafened == storeState.selfDeafened && Float.compare(this.outputVolume, storeState.outputVolume) == 0 && m.areEqual(this.richPresence, storeState.richPresence) && m.areEqual(this.guild, storeState.guild) && m.areEqual(this.permissions, storeState.permissions) && m.areEqual(this.streamContext, storeState.streamContext) && m.areEqual(this.userProfile, storeState.userProfile) && m.areEqual(this.userRelationshipType, storeState.userRelationshipType) && m.areEqual(this.userNoteFetchState, storeState.userNoteFetchState) && m.areEqual(this.stageChannel, storeState.stageChannel) && m.areEqual(this.userStageRoles, storeState.userStageRoles) && m.areEqual(this.userRequestToSpeakState, storeState.userRequestToSpeakState) && m.areEqual(this.myStageRoles, storeState.myStageRoles);
}
public final Channel getChannel() {
return this.channel;
}
public final Map<Long, GuildMember> getComputedMembers() {
return this.computedMembers;
}
public final Map<Long, VoiceState> getCurrentChannelVoiceStates() {
return this.currentChannelVoiceStates;
}
public final Guild getGuild() {
return this.guild;
}
public final Map<Long, GuildRole> getGuildRoles() {
return this.guildRoles;
}
public final MeUser getMe() {
return this.f2154me;
}
public final boolean getMuted() {
return this.muted;
}
public final Map<Long, VoiceState> getMySelectedVoiceChannelVoiceStates() {
return this.mySelectedVoiceChannelVoiceStates;
}
/* renamed from: getMyStageRoles-twRsX-0 reason: not valid java name */
public final StageRoles m58getMyStageRolestwRsX0() {
return this.myStageRoles;
}
public final float getOutputVolume() {
return this.outputVolume;
}
public final Long getPermissions() {
return this.permissions;
}
public final ModelRichPresence getRichPresence() {
return this.richPresence;
}
public final boolean getSelfDeafened() {
return this.selfDeafened;
}
public final boolean getSelfMuted() {
return this.selfMuted;
}
public final Channel getStageChannel() {
return this.stageChannel;
}
public final StreamContext getStreamContext() {
return this.streamContext;
}
public final User getUser() {
return this.user;
}
public final StoreUserNotes.UserNoteState getUserNoteFetchState() {
return this.userNoteFetchState;
}
public final ModelUserProfile getUserProfile() {
return this.userProfile;
}
public final Integer getUserRelationshipType() {
return this.userRelationshipType;
}
public final StageRequestToSpeakState getUserRequestToSpeakState() {
return this.userRequestToSpeakState;
}
/* renamed from: getUserStageRoles-twRsX-0 reason: not valid java name */
public final StageRoles m59getUserStageRolestwRsX0() {
return this.userStageRoles;
}
public int hashCode() {
User user = this.user;
int i = 0;
int hashCode = (user != null ? user.hashCode() : 0) * 31;
MeUser meUser = this.f2154me;
int hashCode2 = (hashCode + (meUser != null ? meUser.hashCode() : 0)) * 31;
Channel channel = this.channel;
int hashCode3 = (hashCode2 + (channel != null ? channel.hashCode() : 0)) * 31;
Map<Long, GuildMember> map = this.computedMembers;
int hashCode4 = (hashCode3 + (map != null ? map.hashCode() : 0)) * 31;
Map<Long, GuildRole> map2 = this.guildRoles;
int hashCode5 = (hashCode4 + (map2 != null ? map2.hashCode() : 0)) * 31;
Map<Long, VoiceState> map3 = this.mySelectedVoiceChannelVoiceStates;
int hashCode6 = (hashCode5 + (map3 != null ? map3.hashCode() : 0)) * 31;
Map<Long, VoiceState> map4 = this.currentChannelVoiceStates;
int hashCode7 = (hashCode6 + (map4 != null ? map4.hashCode() : 0)) * 31;
boolean z2 = this.muted;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode7 + i3) * 31;
boolean z3 = this.selfMuted;
if (z3) {
z3 = true;
}
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = (i6 + i7) * 31;
boolean z4 = this.selfDeafened;
if (!z4) {
i2 = z4 ? 1 : 0;
}
int b = a.b(this.outputVolume, (i10 + i2) * 31, 31);
ModelRichPresence modelRichPresence = this.richPresence;
int hashCode8 = (b + (modelRichPresence != null ? modelRichPresence.hashCode() : 0)) * 31;
Guild guild = this.guild;
int hashCode9 = (hashCode8 + (guild != null ? guild.hashCode() : 0)) * 31;
Long l = this.permissions;
int hashCode10 = (hashCode9 + (l != null ? l.hashCode() : 0)) * 31;
StreamContext streamContext = this.streamContext;
int hashCode11 = (hashCode10 + (streamContext != null ? streamContext.hashCode() : 0)) * 31;
ModelUserProfile modelUserProfile = this.userProfile;
int hashCode12 = (hashCode11 + (modelUserProfile != null ? modelUserProfile.hashCode() : 0)) * 31;
Integer num = this.userRelationshipType;
int hashCode13 = (hashCode12 + (num != null ? num.hashCode() : 0)) * 31;
StoreUserNotes.UserNoteState userNoteState = this.userNoteFetchState;
int hashCode14 = (hashCode13 + (userNoteState != null ? userNoteState.hashCode() : 0)) * 31;
Channel channel2 = this.stageChannel;
int hashCode15 = (hashCode14 + (channel2 != null ? channel2.hashCode() : 0)) * 31;
StageRoles stageRoles = this.userStageRoles;
int hashCode16 = (hashCode15 + (stageRoles != null ? stageRoles.hashCode() : 0)) * 31;
StageRequestToSpeakState stageRequestToSpeakState = this.userRequestToSpeakState;
int hashCode17 = (hashCode16 + (stageRequestToSpeakState != null ? stageRequestToSpeakState.hashCode() : 0)) * 31;
StageRoles stageRoles2 = this.myStageRoles;
if (stageRoles2 != null) {
i = stageRoles2.hashCode();
}
return hashCode17 + i;
}
public String toString() {
StringBuilder L = a.L("StoreState(user=");
L.append(this.user);
L.append(", me=");
L.append(this.f2154me);
L.append(", channel=");
L.append(this.channel);
L.append(", computedMembers=");
L.append(this.computedMembers);
L.append(", guildRoles=");
L.append(this.guildRoles);
L.append(", mySelectedVoiceChannelVoiceStates=");
L.append(this.mySelectedVoiceChannelVoiceStates);
L.append(", currentChannelVoiceStates=");
L.append(this.currentChannelVoiceStates);
L.append(", muted=");
L.append(this.muted);
L.append(", selfMuted=");
L.append(this.selfMuted);
L.append(", selfDeafened=");
L.append(this.selfDeafened);
L.append(", outputVolume=");
L.append(this.outputVolume);
L.append(", richPresence=");
L.append(this.richPresence);
L.append(", guild=");
L.append(this.guild);
L.append(", permissions=");
L.append(this.permissions);
L.append(", streamContext=");
L.append(this.streamContext);
L.append(", userProfile=");
L.append(this.userProfile);
L.append(", userRelationshipType=");
L.append(this.userRelationshipType);
L.append(", userNoteFetchState=");
L.append(this.userNoteFetchState);
L.append(", stageChannel=");
L.append(this.stageChannel);
L.append(", userStageRoles=");
L.append(this.userStageRoles);
L.append(", userRequestToSpeakState=");
L.append(this.userRequestToSpeakState);
L.append(", myStageRoles=");
L.append(this.myStageRoles);
L.append(")");
return L.toString();
}
}
/* compiled from: WidgetUserSheetViewModel.kt */
public static abstract class ViewState {
/* compiled from: WidgetUserSheetViewModel.kt */
public static final class Loaded extends ViewState {
private final UserProfileAdminView.ViewState adminViewState;
private final List<Node<MessageRenderContext>> bioAst;
private final Channel channel;
private final VoiceState channelVoiceState;
private final UserProfileConnectionsView.ViewState connectionsViewState;
private final String guildName;
private final String guildSectionHeaderText;
private final boolean isMe;
private final ModelRichPresence richPresence;
private final List<GuildRole> roleItems;
private final boolean showVoiceSettings;
private final UserProfileStageActionsView.ViewState stageViewState;
private final StreamContext streamContext;
private final User user;
private final boolean userInSameVoiceChannel;
private final String userNote;
private final StoreUserNotes.UserNoteState userNoteFetchState;
private final int userRelationshipType;
private final UserProfileVoiceSettingsView.ViewState voiceSettingsViewState;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Loaded(User user, boolean z2, boolean z3, UserProfileVoiceSettingsView.ViewState viewState, VoiceState voiceState, ModelRichPresence modelRichPresence, String str, List<GuildRole> list, UserProfileAdminView.ViewState viewState2, UserProfileStageActionsView.ViewState viewState3, Channel channel, StreamContext streamContext, String str2, int i, UserProfileConnectionsView.ViewState viewState4, StoreUserNotes.UserNoteState userNoteState, String str3, boolean z4, List<Node<MessageRenderContext>> list2) {
super(null);
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(viewState, "voiceSettingsViewState");
m.checkNotNullParameter(list, "roleItems");
m.checkNotNullParameter(viewState3, "stageViewState");
m.checkNotNullParameter(viewState4, "connectionsViewState");
m.checkNotNullParameter(userNoteState, "userNoteFetchState");
m.checkNotNullParameter(str3, "userNote");
this.user = user;
this.isMe = z2;
this.showVoiceSettings = z3;
this.voiceSettingsViewState = viewState;
this.channelVoiceState = voiceState;
this.richPresence = modelRichPresence;
this.guildSectionHeaderText = str;
this.roleItems = list;
this.adminViewState = viewState2;
this.stageViewState = viewState3;
this.channel = channel;
this.streamContext = streamContext;
this.guildName = str2;
this.userRelationshipType = i;
this.connectionsViewState = viewState4;
this.userNoteFetchState = userNoteState;
this.userNote = str3;
this.userInSameVoiceChannel = z4;
this.bioAst = list2;
}
public static /* synthetic */ Loaded copy$default(Loaded loaded, User user, boolean z2, boolean z3, UserProfileVoiceSettingsView.ViewState viewState, VoiceState voiceState, ModelRichPresence modelRichPresence, String str, List list, UserProfileAdminView.ViewState viewState2, UserProfileStageActionsView.ViewState viewState3, Channel channel, StreamContext streamContext, String str2, int i, UserProfileConnectionsView.ViewState viewState4, StoreUserNotes.UserNoteState userNoteState, String str3, boolean z4, List list2, int i2, Object obj) {
return loaded.copy((i2 & 1) != 0 ? loaded.user : user, (i2 & 2) != 0 ? loaded.isMe : z2, (i2 & 4) != 0 ? loaded.showVoiceSettings : z3, (i2 & 8) != 0 ? loaded.voiceSettingsViewState : viewState, (i2 & 16) != 0 ? loaded.channelVoiceState : voiceState, (i2 & 32) != 0 ? loaded.richPresence : modelRichPresence, (i2 & 64) != 0 ? loaded.guildSectionHeaderText : str, (i2 & 128) != 0 ? loaded.roleItems : list, (i2 & 256) != 0 ? loaded.adminViewState : viewState2, (i2 & 512) != 0 ? loaded.stageViewState : viewState3, (i2 & 1024) != 0 ? loaded.channel : channel, (i2 & 2048) != 0 ? loaded.streamContext : streamContext, (i2 & 4096) != 0 ? loaded.guildName : str2, (i2 & 8192) != 0 ? loaded.userRelationshipType : i, (i2 & 16384) != 0 ? loaded.connectionsViewState : viewState4, (i2 & 32768) != 0 ? loaded.userNoteFetchState : userNoteState, (i2 & 65536) != 0 ? loaded.userNote : str3, (i2 & 131072) != 0 ? loaded.userInSameVoiceChannel : z4, (i2 & 262144) != 0 ? loaded.bioAst : list2);
}
public final User component1() {
return this.user;
}
public final UserProfileStageActionsView.ViewState component10() {
return this.stageViewState;
}
public final Channel component11() {
return this.channel;
}
public final StreamContext component12() {
return this.streamContext;
}
public final String component13() {
return this.guildName;
}
public final int component14() {
return this.userRelationshipType;
}
public final UserProfileConnectionsView.ViewState component15() {
return this.connectionsViewState;
}
public final StoreUserNotes.UserNoteState component16() {
return this.userNoteFetchState;
}
public final String component17() {
return this.userNote;
}
public final boolean component18() {
return this.userInSameVoiceChannel;
}
public final List<Node<MessageRenderContext>> component19() {
return this.bioAst;
}
public final boolean component2() {
return this.isMe;
}
public final boolean component3() {
return this.showVoiceSettings;
}
public final UserProfileVoiceSettingsView.ViewState component4() {
return this.voiceSettingsViewState;
}
public final VoiceState component5() {
return this.channelVoiceState;
}
public final ModelRichPresence component6() {
return this.richPresence;
}
public final String component7() {
return this.guildSectionHeaderText;
}
public final List<GuildRole> component8() {
return this.roleItems;
}
public final UserProfileAdminView.ViewState component9() {
return this.adminViewState;
}
public final Loaded copy(User user, boolean z2, boolean z3, UserProfileVoiceSettingsView.ViewState viewState, VoiceState voiceState, ModelRichPresence modelRichPresence, String str, List<GuildRole> list, UserProfileAdminView.ViewState viewState2, UserProfileStageActionsView.ViewState viewState3, Channel channel, StreamContext streamContext, String str2, int i, UserProfileConnectionsView.ViewState viewState4, StoreUserNotes.UserNoteState userNoteState, String str3, boolean z4, List<Node<MessageRenderContext>> list2) {
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(viewState, "voiceSettingsViewState");
m.checkNotNullParameter(list, "roleItems");
m.checkNotNullParameter(viewState3, "stageViewState");
m.checkNotNullParameter(viewState4, "connectionsViewState");
m.checkNotNullParameter(userNoteState, "userNoteFetchState");
m.checkNotNullParameter(str3, "userNote");
return new Loaded(user, z2, z3, viewState, voiceState, modelRichPresence, str, list, viewState2, viewState3, channel, streamContext, str2, i, viewState4, userNoteState, str3, z4, list2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Loaded)) {
return false;
}
Loaded loaded = (Loaded) obj;
return m.areEqual(this.user, loaded.user) && this.isMe == loaded.isMe && this.showVoiceSettings == loaded.showVoiceSettings && m.areEqual(this.voiceSettingsViewState, loaded.voiceSettingsViewState) && m.areEqual(this.channelVoiceState, loaded.channelVoiceState) && m.areEqual(this.richPresence, loaded.richPresence) && m.areEqual(this.guildSectionHeaderText, loaded.guildSectionHeaderText) && m.areEqual(this.roleItems, loaded.roleItems) && m.areEqual(this.adminViewState, loaded.adminViewState) && m.areEqual(this.stageViewState, loaded.stageViewState) && m.areEqual(this.channel, loaded.channel) && m.areEqual(this.streamContext, loaded.streamContext) && m.areEqual(this.guildName, loaded.guildName) && this.userRelationshipType == loaded.userRelationshipType && m.areEqual(this.connectionsViewState, loaded.connectionsViewState) && m.areEqual(this.userNoteFetchState, loaded.userNoteFetchState) && m.areEqual(this.userNote, loaded.userNote) && this.userInSameVoiceChannel == loaded.userInSameVoiceChannel && m.areEqual(this.bioAst, loaded.bioAst);
}
public final UserProfileAdminView.ViewState getAdminViewState() {
return this.adminViewState;
}
public final List<Node<MessageRenderContext>> getBioAst() {
return this.bioAst;
}
public final Channel getChannel() {
return this.channel;
}
public final VoiceState getChannelVoiceState() {
return this.channelVoiceState;
}
public final UserProfileConnectionsView.ViewState getConnectionsViewState() {
return this.connectionsViewState;
}
public final String getGuildName() {
return this.guildName;
}
public final String getGuildSectionHeaderText() {
return this.guildSectionHeaderText;
}
public final Presence getPresence() {
ModelRichPresence modelRichPresence = this.richPresence;
if (modelRichPresence != null) {
return modelRichPresence.getPresence();
}
return null;
}
public final ModelRichPresence getRichPresence() {
return this.richPresence;
}
public final List<GuildRole> getRoleItems() {
return this.roleItems;
}
public final boolean getShowVoiceSettings() {
return this.showVoiceSettings;
}
public final UserProfileStageActionsView.ViewState getStageViewState() {
return this.stageViewState;
}
public final StreamContext getStreamContext() {
return this.streamContext;
}
public final User getUser() {
return this.user;
}
public final boolean getUserInSameVoiceChannel() {
return this.userInSameVoiceChannel;
}
public final String getUserNote() {
return this.userNote;
}
public final StoreUserNotes.UserNoteState getUserNoteFetchState() {
return this.userNoteFetchState;
}
public final int getUserRelationshipType() {
return this.userRelationshipType;
}
public final UserProfileVoiceSettingsView.ViewState getVoiceSettingsViewState() {
return this.voiceSettingsViewState;
}
public int hashCode() {
User user = this.user;
int i = 0;
int hashCode = (user != null ? user.hashCode() : 0) * 31;
boolean z2 = this.isMe;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode + i3) * 31;
boolean z3 = this.showVoiceSettings;
if (z3) {
z3 = true;
}
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = (i6 + i7) * 31;
UserProfileVoiceSettingsView.ViewState viewState = this.voiceSettingsViewState;
int hashCode2 = (i10 + (viewState != null ? viewState.hashCode() : 0)) * 31;
VoiceState voiceState = this.channelVoiceState;
int hashCode3 = (hashCode2 + (voiceState != null ? voiceState.hashCode() : 0)) * 31;
ModelRichPresence modelRichPresence = this.richPresence;
int hashCode4 = (hashCode3 + (modelRichPresence != null ? modelRichPresence.hashCode() : 0)) * 31;
String str = this.guildSectionHeaderText;
int hashCode5 = (hashCode4 + (str != null ? str.hashCode() : 0)) * 31;
List<GuildRole> list = this.roleItems;
int hashCode6 = (hashCode5 + (list != null ? list.hashCode() : 0)) * 31;
UserProfileAdminView.ViewState viewState2 = this.adminViewState;
int hashCode7 = (hashCode6 + (viewState2 != null ? viewState2.hashCode() : 0)) * 31;
UserProfileStageActionsView.ViewState viewState3 = this.stageViewState;
int hashCode8 = (hashCode7 + (viewState3 != null ? viewState3.hashCode() : 0)) * 31;
Channel channel = this.channel;
int hashCode9 = (hashCode8 + (channel != null ? channel.hashCode() : 0)) * 31;
StreamContext streamContext = this.streamContext;
int hashCode10 = (hashCode9 + (streamContext != null ? streamContext.hashCode() : 0)) * 31;
String str2 = this.guildName;
int hashCode11 = (((hashCode10 + (str2 != null ? str2.hashCode() : 0)) * 31) + this.userRelationshipType) * 31;
UserProfileConnectionsView.ViewState viewState4 = this.connectionsViewState;
int hashCode12 = (hashCode11 + (viewState4 != null ? viewState4.hashCode() : 0)) * 31;
StoreUserNotes.UserNoteState userNoteState = this.userNoteFetchState;
int hashCode13 = (hashCode12 + (userNoteState != null ? userNoteState.hashCode() : 0)) * 31;
String str3 = this.userNote;
int hashCode14 = (hashCode13 + (str3 != null ? str3.hashCode() : 0)) * 31;
boolean z4 = this.userInSameVoiceChannel;
if (!z4) {
i2 = z4 ? 1 : 0;
}
int i11 = (hashCode14 + i2) * 31;
List<Node<MessageRenderContext>> list2 = this.bioAst;
if (list2 != null) {
i = list2.hashCode();
}
return i11 + i;
}
public final boolean isMe() {
return this.isMe;
}
public String toString() {
StringBuilder L = a.L("Loaded(user=");
L.append(this.user);
L.append(", isMe=");
L.append(this.isMe);
L.append(", showVoiceSettings=");
L.append(this.showVoiceSettings);
L.append(", voiceSettingsViewState=");
L.append(this.voiceSettingsViewState);
L.append(", channelVoiceState=");
L.append(this.channelVoiceState);
L.append(", richPresence=");
L.append(this.richPresence);
L.append(", guildSectionHeaderText=");
L.append(this.guildSectionHeaderText);
L.append(", roleItems=");
L.append(this.roleItems);
L.append(", adminViewState=");
L.append(this.adminViewState);
L.append(", stageViewState=");
L.append(this.stageViewState);
L.append(", channel=");
L.append(this.channel);
L.append(", streamContext=");
L.append(this.streamContext);
L.append(", guildName=");
L.append(this.guildName);
L.append(", userRelationshipType=");
L.append(this.userRelationshipType);
L.append(", connectionsViewState=");
L.append(this.connectionsViewState);
L.append(", userNoteFetchState=");
L.append(this.userNoteFetchState);
L.append(", userNote=");
L.append(this.userNote);
L.append(", userInSameVoiceChannel=");
L.append(this.userInSameVoiceChannel);
L.append(", bioAst=");
return a.E(L, this.bioAst, ")");
}
}
/* compiled from: WidgetUserSheetViewModel.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();
}
}
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
static {
StoreMediaSettings.SelfMuteFailure.values();
int[] iArr = new int[1];
$EnumSwitchMapping$0 = iArr;
iArr[StoreMediaSettings.SelfMuteFailure.CANNOT_USE_VAD.ordinal()] = 1;
WidgetUserSheet.StreamPreviewClickBehavior.values();
int[] iArr2 = new int[2];
$EnumSwitchMapping$1 = iArr2;
iArr2[WidgetUserSheet.StreamPreviewClickBehavior.TARGET_AND_LAUNCH_SPECTATE.ordinal()] = 1;
iArr2[WidgetUserSheet.StreamPreviewClickBehavior.TARGET_AND_DISMISS.ordinal()] = 2;
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetUserSheetViewModel(long j, long j2, String str, boolean z2, Observable<StoreState> observable, WidgetUserSheet.StreamPreviewClickBehavior streamPreviewClickBehavior, StoreMediaSettings storeMediaSettings, StoreApplicationStreaming storeApplicationStreaming, StoreUserNotes storeUserNotes, RestAPI restAPI, RestAPI restAPI2, StoreApplicationStreamPreviews storeApplicationStreamPreviews, Parser<MessageRenderContext, Node<MessageRenderContext>, MessageParseState> parser) {
super(ViewState.Uninitialized.INSTANCE);
m.checkNotNullParameter(observable, "storeObservable");
m.checkNotNullParameter(streamPreviewClickBehavior, "streamPreviewClickBehavior");
m.checkNotNullParameter(storeMediaSettings, "storeMediaSettings");
m.checkNotNullParameter(storeApplicationStreaming, "storeApplicationStreaming");
m.checkNotNullParameter(storeUserNotes, "storeUserNotes");
m.checkNotNullParameter(restAPI, "restAPI");
m.checkNotNullParameter(restAPI2, "restAPISerializeNulls");
m.checkNotNullParameter(storeApplicationStreamPreviews, "storeApplicationStreamPreviews");
m.checkNotNullParameter(parser, "bioParser");
this.userId = j;
this.channelId = j2;
this.friendToken = str;
this.isVoiceContext = z2;
this.streamPreviewClickBehavior = streamPreviewClickBehavior;
this.storeMediaSettings = storeMediaSettings;
this.storeApplicationStreaming = storeApplicationStreaming;
this.storeUserNotes = storeUserNotes;
this.restAPI = restAPI;
this.restAPISerializeNulls = restAPI2;
this.storeApplicationStreamPreviews = storeApplicationStreamPreviews;
this.bioParser = parser;
this.eventSubject = PublishSubject.l0();
this.fetchedPreviews = new LinkedHashSet();
this.revealedBioIndices = new LinkedHashSet();
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
storeUserNotes.loadNote(j);
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetUserSheetViewModel(long j, long j2, String str, boolean z2, Observable observable, WidgetUserSheet.StreamPreviewClickBehavior streamPreviewClickBehavior, StoreMediaSettings storeMediaSettings, StoreApplicationStreaming storeApplicationStreaming, StoreUserNotes storeUserNotes, RestAPI restAPI, RestAPI restAPI2, StoreApplicationStreamPreviews storeApplicationStreamPreviews, Parser parser, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(j, j2, str, z2, (i & 16) != 0 ? WidgetUserSheetViewModelStoreState.observeStoreState$default(WidgetUserSheetViewModelStoreState.INSTANCE, j, Long.valueOf(j2), null, null, null, null, null, null, null, null, null, null, null, null, null, null, 65532, null) : observable, streamPreviewClickBehavior, (i & 64) != 0 ? StoreStream.Companion.getMediaSettings() : storeMediaSettings, (i & 128) != 0 ? StoreStream.Companion.getApplicationStreaming() : storeApplicationStreaming, (i & 256) != 0 ? StoreStream.Companion.getUsersNotes() : storeUserNotes, (i & 512) != 0 ? RestAPI.Companion.getApi() : restAPI, (i & 1024) != 0 ? RestAPI.Companion.getApiSerializeNulls() : restAPI2, (i & 2048) != 0 ? StoreStream.Companion.getApplicationStreamPreviews() : storeApplicationStreamPreviews, (i & 4096) != 0 ? DiscordParser.createParser$default(false, false, false, 4, null) : parser);
}
public static final /* synthetic */ void access$emitDismissSheetEvent(WidgetUserSheetViewModel widgetUserSheetViewModel) {
widgetUserSheetViewModel.emitDismissSheetEvent();
}
public static final /* synthetic */ void access$emitLaunchVideoCallEvent(WidgetUserSheetViewModel widgetUserSheetViewModel, long j) {
widgetUserSheetViewModel.emitLaunchVideoCallEvent(j);
}
public static final /* synthetic */ void access$emitLaunchVoiceCallEvent(WidgetUserSheetViewModel widgetUserSheetViewModel, long j) {
widgetUserSheetViewModel.emitLaunchVoiceCallEvent(j);
}
public static final /* synthetic */ void access$emitShowFriendRequestAbortToast(WidgetUserSheetViewModel widgetUserSheetViewModel, int i, String str) {
widgetUserSheetViewModel.emitShowFriendRequestAbortToast(i, str);
}
public static final /* synthetic */ void access$emitShowToastEvent(WidgetUserSheetViewModel widgetUserSheetViewModel, int i) {
widgetUserSheetViewModel.emitShowToastEvent(i);
}
public static final /* synthetic */ ViewState access$getViewState$p(WidgetUserSheetViewModel widgetUserSheetViewModel) {
return widgetUserSheetViewModel.getViewState();
}
public static final /* synthetic */ void access$handleStoreState(WidgetUserSheetViewModel widgetUserSheetViewModel, StoreState storeState) {
widgetUserSheetViewModel.handleStoreState(storeState);
}
public static final /* synthetic */ void access$updateViewState(WidgetUserSheetViewModel widgetUserSheetViewModel, ViewState viewState) {
widgetUserSheetViewModel.updateViewState(viewState);
}
private final UserProfileAdminView.ViewState createAdminViewState(Channel channel, boolean z2, boolean z3, ManageUserContext manageUserContext, VoiceState voiceState) {
boolean z4;
boolean z5;
if (channel == null) {
return null;
}
if (manageUserContext != null) {
z4 = manageUserContext.getCanChangeNickname() || manageUserContext.getCanManageRoles();
} else {
z4 = false;
}
boolean z6 = !AnimatableValueParser.p1(channel) ? !(manageUserContext == null || !manageUserContext.getCanKick()) : !(AnimatableValueParser.o1(channel) || !z2 || z3);
boolean p1 = AnimatableValueParser.p1(channel);
boolean z7 = manageUserContext != null && manageUserContext.getCanBan();
boolean z8 = voiceState != null && manageUserContext != null && manageUserContext.getCanMute() && !AnimatableValueParser.u1(channel);
boolean z9 = voiceState != null && voiceState.e();
boolean z10 = (voiceState == null || manageUserContext == null || !manageUserContext.getCanDeafen()) ? false : true;
boolean z11 = voiceState != null && voiceState.b();
boolean z12 = (voiceState == null || manageUserContext == null || !manageUserContext.getCanMove()) ? false : true;
Boolean[] boolArr = {Boolean.valueOf(z4), Boolean.valueOf(z6), Boolean.valueOf(z7), Boolean.valueOf(z8), Boolean.valueOf(z10), Boolean.valueOf(z12)};
int i = 0;
while (true) {
if (i >= 6) {
z5 = false;
break;
} else if (boolArr[i].booleanValue()) {
z5 = true;
break;
} else {
i++;
}
}
return new UserProfileAdminView.ViewState(z4, z6, p1, z7, z8, z9, z10, z11, z12, z5, z3);
}
private final List<Node<MessageRenderContext>> createAndProcessBioAstFromText(String str) {
if (str == null || t.isBlank(str)) {
return null;
}
List<Node<MessageRenderContext>> generateAst = generateAst(str);
createMessagePreprocessor().process(generateAst);
return generateAst;
}
private final UserProfileConnectionsView.ViewState createConnectionsViewState(ModelUserProfile modelUserProfile, boolean z2, boolean z3) {
List<ModelConnectedAccount> connectedAccounts = modelUserProfile.getConnectedAccounts();
m.checkNotNullExpressionValue(connectedAccounts, "userProfile.connectedAccounts");
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(connectedAccounts, 10));
for (ModelConnectedAccount modelConnectedAccount : connectedAccounts) {
m.checkNotNullExpressionValue(modelConnectedAccount, "connectedAccount");
arrayList.add(new UserProfileConnectionsView.ConnectedAccountItem(modelConnectedAccount));
}
boolean z4 = false;
boolean z5 = !z2 && !z3;
if (z5 || (!arrayList.isEmpty())) {
z4 = true;
}
return new UserProfileConnectionsView.ViewState(z4, z5, arrayList);
}
private final MessagePreprocessor createMessagePreprocessor() {
return new MessagePreprocessor(-1, this.revealedBioIndices, null, false, null, 28, null);
}
private final Observable<Channel> createPrivateChannelWithUser(long j) {
return this.restAPI.createOrFetchDM(j);
}
public static /* synthetic */ void disconnectUser$default(WidgetUserSheetViewModel widgetUserSheetViewModel, Channel channel, int i, Object obj) {
if ((i & 1) != 0) {
channel = null;
}
widgetUserSheetViewModel.disconnectUser(channel);
}
private final void emitDismissSheetEvent() {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(Event.DismissSheet.INSTANCE);
}
private final void emitLaunchSpectateEvent(ModelApplicationStream modelApplicationStream) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.LaunchSpectate(modelApplicationStream));
}
private final void emitLaunchVideoCallEvent(long j) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.LaunchVideoCall(j));
}
private final void emitLaunchVoiceCallEvent(long j) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.LaunchVoiceCall(j));
}
private final void emitRequestStreamPermissionsEvent(ModelApplicationStream modelApplicationStream) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.RequestPermissionsForSpectateStream(modelApplicationStream));
}
private final void emitShowFriendRequestAbortToast(int i, String str) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.ShowFriendRequestErrorToast(i, str));
}
private final void emitShowToastEvent(@StringRes int i) {
PublishSubject<Event> publishSubject = this.eventSubject;
publishSubject.j.onNext(new Event.ShowToast(i));
}
private final List<Node<MessageRenderContext>> generateAst(CharSequence charSequence) {
return Parser.parse$default(this.bioParser, charSequence, MessageParseState.Companion.getInitialState(), null, 4, null);
}
/* JADX DEBUG: Multi-variable search result rejected for r14v1, resolved type: java.lang.Boolean */
/* JADX DEBUG: Multi-variable search result rejected for r1v7, resolved type: java.lang.Float */
/* JADX DEBUG: Multi-variable search result rejected for r1v23, resolved type: java.lang.Float */
/* JADX DEBUG: Multi-variable search result rejected for r14v4, resolved type: java.lang.Boolean */
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Code restructure failed: missing block: B:105:0x022a, code lost:
if ((r5 == null || r5.length() == 0) == false) goto L_0x022f;
*/
/* JADX WARNING: Code restructure failed: missing block: B:19:0x008c, code lost:
if (r8 != null) goto L_0x0093;
*/
/* JADX WARNING: Removed duplicated region for block: B:100:0x021e */
/* JADX WARNING: Removed duplicated region for block: B:113:0x023d */
/* JADX WARNING: Removed duplicated region for block: B:117:0x024a */
/* JADX WARNING: Removed duplicated region for block: B:118:0x024f */
/* JADX WARNING: Removed duplicated region for block: B:68:0x01c6 */
/* JADX WARNING: Removed duplicated region for block: B:69:0x01cb */
/* JADX WARNING: Removed duplicated region for block: B:72:0x01d6 */
/* JADX WARNING: Removed duplicated region for block: B:75:0x01db */
/* JADX WARNING: Removed duplicated region for block: B:76:0x01e0 */
/* JADX WARNING: Removed duplicated region for block: B:79:0x01e9 */
/* JADX WARNING: Removed duplicated region for block: B:88:0x0202 */
/* JADX WARNING: Removed duplicated region for block: B:91:0x0207 */
/* JADX WARNING: Removed duplicated region for block: B:92:0x020c */
private final void handleStoreState(StoreState storeState) {
List list;
ManageUserContext manageUserContext;
String str;
boolean z2;
Float f;
String str2;
StreamContext streamContext;
String encodedStreamKey;
ViewState viewState;
String userNote;
StoreUserNotes.UserNoteState userNoteFetchState;
String note;
ViewState viewState2;
boolean z3;
String str3;
ModelUserNote note2;
ModelApplicationStream stream;
String str4;
List<Long> roles;
if (storeState == null) {
this.eventSubject.j.onNext(Event.UserNotFound.INSTANCE);
return;
}
User user = storeState.getUser();
MeUser me2 = storeState.getMe();
Channel channel = storeState.getChannel();
Map<Long, GuildMember> computedMembers = storeState.getComputedMembers();
Map<Long, GuildRole> guildRoles = storeState.getGuildRoles();
Guild guild = storeState.getGuild();
boolean z4 = true;
boolean z5 = me2.getId() == user.getId();
boolean isSystemUser = user.isSystemUser();
GuildMember guildMember = (GuildMember) a.e(user, computedMembers);
GuildMember guildMember2 = computedMembers.get(Long.valueOf(me2.getId()));
if (!(guildMember == null || (roles = guildMember.getRoles()) == null)) {
ArrayList arrayList = new ArrayList();
for (Number number : roles) {
GuildRole guildRole = guildRoles.get(Long.valueOf(number.longValue()));
if (guildRole != null) {
arrayList.add(guildRole);
}
}
list = u.sortedWith(arrayList, RoleUtils.getROLE_COMPARATOR());
}
list = n.emptyList();
if (guildMember == null || guildMember2 == null || guild == null) {
str = null;
manageUserContext = null;
} else {
str = null;
manageUserContext = ManageUserContext.Companion.from(guild, me2, user, guildMember2.getRoles(), guildMember.getRoles(), storeState.getPermissions(), guildRoles);
}
boolean z6 = channel != null && channel.p() == me2.getId();
int type = ModelUserRelationship.getType(storeState.getUserRelationshipType());
VoiceState voiceState = (VoiceState) a.e(user, storeState.getMySelectedVoiceChannelVoiceStates());
VoiceState voiceState2 = storeState.getMySelectedVoiceChannelVoiceStates().get(Long.valueOf(me2.getId()));
boolean isInSameVoiceChannel = isInSameVoiceChannel(voiceState2, voiceState);
boolean z7 = this.isVoiceContext || isInSameVoiceChannel;
boolean selfMuted = z5 ? storeState.getSelfMuted() : storeState.getMuted();
Boolean valueOf = z5 ? Boolean.valueOf(storeState.getSelfDeafened()) : str;
if (!z5) {
z2 = isSystemUser;
f = Float.valueOf(PerceptualVolumeUtils.amplitudeToPerceptual$default(PerceptualVolumeUtils.INSTANCE, storeState.getOutputVolume(), 0.0f, 2, str));
} else {
z2 = isSystemUser;
f = str;
}
UserProfileVoiceSettingsView.ViewState viewState3 = new UserProfileVoiceSettingsView.ViewState(selfMuted, valueOf, f);
VoiceState voiceState3 = (VoiceState) a.e(user, storeState.getCurrentChannelVoiceStates());
if (channel != null) {
if (AnimatableValueParser.p1(channel)) {
str4 = AnimatableValueParser.y0(channel);
} else if (guild != null) {
str4 = guild.getName();
}
str2 = str4;
UserProfileAdminView.ViewState createAdminViewState = createAdminViewState(channel, z6, z5, manageUserContext, voiceState3);
ModelUserProfile userProfile = storeState.getUserProfile();
UserProfileConnectionsView.ViewState createConnectionsViewState = createConnectionsViewState(userProfile, z5, z2);
streamContext = storeState.getStreamContext();
encodedStreamKey = (streamContext != null || (stream = streamContext.getStream()) == null) ? null : stream.getEncodedStreamKey();
if (encodedStreamKey != null && !this.fetchedPreviews.contains(encodedStreamKey)) {
this.storeApplicationStreamPreviews.fetchStreamPreviewIfNotFetching(streamContext);
this.fetchedPreviews.add(encodedStreamKey);
}
UserProfileStageActionsView.ViewState viewState4 = new UserProfileStageActionsView.ViewState(z5, storeState.getStageChannel(), storeState.m58getMyStageRolestwRsX0(), storeState.m59getUserStageRolestwRsX0(), storeState.getUserRequestToSpeakState(), isInSameVoiceChannel(voiceState2, voiceState), false, false, 192, null);
String d = userProfile.getUser().d();
List<Node<MessageRenderContext>> createAndProcessBioAstFromText = d == null ? createAndProcessBioAstFromText(d) : null;
viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
userNote = loaded == null ? loaded.getUserNote() : null;
userNoteFetchState = storeState.getUserNoteFetchState();
if (!(userNoteFetchState instanceof StoreUserNotes.UserNoteState.Loaded)) {
userNoteFetchState = null;
}
StoreUserNotes.UserNoteState.Loaded loaded2 = (StoreUserNotes.UserNoteState.Loaded) userNoteFetchState;
note = (loaded2 != null || (note2 = loaded2.getNote()) == null) ? null : note2.getNote();
viewState2 = getViewState();
if (!(viewState2 instanceof ViewState.Loaded)) {
viewState2 = null;
}
ViewState.Loaded loaded3 = (ViewState.Loaded) viewState2;
z3 = !((loaded3 == null ? loaded3.getUserNoteFetchState() : null) instanceof StoreUserNotes.UserNoteState.Loading) && !(storeState.getUserNoteFetchState() instanceof StoreUserNotes.UserNoteState.Loading);
if (userNote == null) {
}
z4 = false;
if (!z3 || z4) {
if (note != null) {
str3 = note;
updateViewState(new ViewState.Loaded(user, z5, z7, viewState3, voiceState3, storeState.getRichPresence(), str2, list, createAdminViewState, viewState4, channel, streamContext, guild == null ? guild.getName() : null, type, createConnectionsViewState, storeState.getUserNoteFetchState(), str3, isInSameVoiceChannel, createAndProcessBioAstFromText));
this.mostRecentStoreState = storeState;
}
} else if (userNote != null) {
str3 = userNote;
updateViewState(new ViewState.Loaded(user, z5, z7, viewState3, voiceState3, storeState.getRichPresence(), str2, list, createAdminViewState, viewState4, channel, streamContext, guild == null ? guild.getName() : null, type, createConnectionsViewState, storeState.getUserNoteFetchState(), str3, isInSameVoiceChannel, createAndProcessBioAstFromText));
this.mostRecentStoreState = storeState;
}
str3 = "";
updateViewState(new ViewState.Loaded(user, z5, z7, viewState3, voiceState3, storeState.getRichPresence(), str2, list, createAdminViewState, viewState4, channel, streamContext, guild == null ? guild.getName() : null, type, createConnectionsViewState, storeState.getUserNoteFetchState(), str3, isInSameVoiceChannel, createAndProcessBioAstFromText));
this.mostRecentStoreState = storeState;
}
str2 = str;
UserProfileAdminView.ViewState createAdminViewState = createAdminViewState(channel, z6, z5, manageUserContext, voiceState3);
ModelUserProfile userProfile = storeState.getUserProfile();
UserProfileConnectionsView.ViewState createConnectionsViewState = createConnectionsViewState(userProfile, z5, z2);
streamContext = storeState.getStreamContext();
if (streamContext != null) {
}
this.storeApplicationStreamPreviews.fetchStreamPreviewIfNotFetching(streamContext);
this.fetchedPreviews.add(encodedStreamKey);
UserProfileStageActionsView.ViewState viewState4 = new UserProfileStageActionsView.ViewState(z5, storeState.getStageChannel(), storeState.m58getMyStageRolestwRsX0(), storeState.m59getUserStageRolestwRsX0(), storeState.getUserRequestToSpeakState(), isInSameVoiceChannel(voiceState2, voiceState), false, false, 192, null);
String d = userProfile.getUser().d();
if (d == null) {
}
viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded == null) {
}
userNoteFetchState = storeState.getUserNoteFetchState();
if (!(userNoteFetchState instanceof StoreUserNotes.UserNoteState.Loaded)) {
}
StoreUserNotes.UserNoteState.Loaded loaded2 = (StoreUserNotes.UserNoteState.Loaded) userNoteFetchState;
if (loaded2 != null) {
}
viewState2 = getViewState();
if (!(viewState2 instanceof ViewState.Loaded)) {
}
ViewState.Loaded loaded3 = (ViewState.Loaded) viewState2;
if (!((loaded3 == null ? loaded3.getUserNoteFetchState() : null) instanceof StoreUserNotes.UserNoteState.Loading)) {
}
if (userNote == null) {
}
z4 = false;
if (!z3) {
}
if (note != null) {
}
str3 = "";
updateViewState(new ViewState.Loaded(user, z5, z7, viewState3, voiceState3, storeState.getRichPresence(), str2, list, createAdminViewState, viewState4, channel, streamContext, guild == null ? guild.getName() : null, type, createConnectionsViewState, storeState.getUserNoteFetchState(), str3, isInSameVoiceChannel, createAndProcessBioAstFromText));
this.mostRecentStoreState = storeState;
}
private final boolean isInSameVoiceChannel(VoiceState voiceState, VoiceState voiceState2) {
Long l = null;
Long a = voiceState2 != null ? voiceState2.a() : null;
if (voiceState != null) {
l = voiceState.a();
}
if (a == null || l == null) {
return false;
}
return m.areEqual(a, l);
}
public final void addRelationship(Integer num, String str, @StringRes int i) {
m.checkNotNullParameter(str, "username");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.addRelationship("User Profile", this.userId, num, this.friendToken), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$addRelationship$2(this, str), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$addRelationship$1(this, i), 54, (Object) null);
}
public final void banUser() {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getChannel()) != null) {
User user = loaded.getUser();
this.eventSubject.j.onNext(new Event.LaunchBanUser(user.getUsername(), channel.e(), user.getId()));
}
}
public final void disconnectUser(Channel channel) {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null) {
if (channel == null) {
channel = loaded.getChannel();
}
if (channel != null) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPISerializeNulls.disconnectGuildMember(channel.e(), loaded.getUser().getId(), new RestAPIParams.GuildMemberDisconnect(null, 1, null)), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$disconnectUser$2(this), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$disconnectUser$1(this), 54, (Object) null);
}
}
}
public final void editMember() {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getChannel()) != null) {
this.eventSubject.j.onNext(new Event.LaunchEditMember(channel.e(), this.userId));
}
}
public final void guildDeafenUser() {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null) {
Channel channel = loaded.getChannel();
User user = loaded.getUser();
UserProfileAdminView.ViewState adminViewState = loaded.getAdminViewState();
if (channel != null && adminViewState != null) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.changeGuildMember(channel.e(), user.getId(), RestAPIParams.GuildMember.Companion.createWithDeaf(!adminViewState.isServerDeafened())), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$guildDeafenUser$2(this), (Function0) null, (Function0) null, WidgetUserSheetViewModel$guildDeafenUser$1.INSTANCE, 54, (Object) null);
}
}
}
public final void guildMoveForUser() {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getChannel()) != null) {
this.eventSubject.j.onNext(new Event.LaunchMoveUser(channel.e()));
}
}
public final void guildMuteUser() {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null) {
Channel channel = loaded.getChannel();
UserProfileAdminView.ViewState adminViewState = loaded.getAdminViewState();
User user = loaded.getUser();
if (channel != null && adminViewState != null) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.changeGuildMember(channel.e(), user.getId(), RestAPIParams.GuildMember.Companion.createWithMute(!loaded.getAdminViewState().isServerMuted())), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$guildMuteUser$2(this), (Function0) null, (Function0) null, WidgetUserSheetViewModel$guildMuteUser$1.INSTANCE, 54, (Object) null);
}
}
}
@MainThread
public final void handleBioIndexClicked(SpoilerNode<?> spoilerNode) {
StoreState storeState;
ModelUserProfile userProfile;
com.discord.api.user.User user;
String d;
m.checkNotNullParameter(spoilerNode, "spoilerNode");
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (storeState = this.mostRecentStoreState) != null && (userProfile = storeState.getUserProfile()) != null && (user = userProfile.getUser()) != null && (d = user.d()) != null) {
this.revealedBioIndices.add(Integer.valueOf(spoilerNode.getId()));
updateViewState(ViewState.Loaded.copy$default(loaded, null, false, false, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, false, createAndProcessBioAstFromText(d), 262143, null));
}
}
public final void inviteUserToSpeak() {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getStageViewState().getChannel()) != null) {
long id2 = loaded.getUser().getId();
updateViewState(ViewState.Loaded.copy$default(loaded, null, false, false, null, null, null, null, null, null, UserProfileStageActionsView.ViewState.m48copypGLTHTc$default(loaded.getStageViewState(), false, null, null, null, null, false, false, true, 127, null), null, null, null, 0, null, null, null, false, null, 523775, null));
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(StageChannelAPI.setUserSuppressedInChannel$default(StageChannelAPI.INSTANCE, channel, id2, false, 0, 8, null), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetUserSheetViewModel$inviteUserToSpeak$1(this), 62, (Object) null);
}
}
public final void kickUser() {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getChannel()) != null) {
User user = loaded.getUser();
if (AnimatableValueParser.p1(channel)) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().removeChannelRecipient(channel.g(), user.getId()), false, 1, null), 0, false, 1, null), this, null, 2, null), (Context) null, "REST: remove group member", (Function1) null, new WidgetUserSheetViewModel$kickUser$1(this), (Function1) null, (Function0) null, (Function0) null, 117, (Object) null);
return;
}
this.eventSubject.j.onNext(new Event.LaunchKickUser(user.getUsername(), channel.e(), user.getId()));
}
}
public final void launchVideoCall() {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(createPrivateChannelWithUser(this.userId), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$launchVideoCall$2(this), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$launchVideoCall$1(this), 54, (Object) null);
}
public final void launchVoiceCall() {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(createPrivateChannelWithUser(this.userId), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$launchVoiceCall$2(this), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$launchVoiceCall$1(this), 54, (Object) null);
}
public final void moveUserToChannel(long j) {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null) {
Channel channel = loaded.getChannel();
User user = loaded.getUser();
if (channel != null) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.changeGuildMember(channel.e(), user.getId(), RestAPIParams.GuildMember.Companion.createWithChannelId(j)), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$moveUserToChannel$2(this), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$moveUserToChannel$1(this), 54, (Object) null);
}
}
}
public final Observable<Event> observeEvents() {
PublishSubject<Event> publishSubject = this.eventSubject;
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
return publishSubject;
}
public final void onActivityCustomButtonClicked(Context context, long j, String str, long j2, int i) {
m.checkNotNullParameter(context, "applicationContext");
m.checkNotNullParameter(str, "sessionId");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.getActivityMetadata(j, str, j2), false, 1, null), this, null, 2, null), (Context) null, "REST: Custom Button GetActivityMetadata", (Function1) null, new WidgetUserSheetViewModel$onActivityCustomButtonClicked$1(i, context), (Function1) null, (Function0) null, (Function0) null, 117, (Object) null);
}
@MainThread
public final void onSpectatePermissionsGranted(ModelApplicationStream modelApplicationStream) {
m.checkNotNullParameter(modelApplicationStream, "stream");
StoreApplicationStreaming.targetStream$default(this.storeApplicationStreaming, modelApplicationStream.getEncodedStreamKey(), false, 2, null);
int ordinal = this.streamPreviewClickBehavior.ordinal();
if (ordinal == 0) {
emitLaunchSpectateEvent(modelApplicationStream);
} else if (ordinal == 1) {
emitDismissSheetEvent();
}
}
public final void onStreamPreviewClicked(StreamContext streamContext) {
m.checkNotNullParameter(streamContext, "streamContext");
if (streamContext.getJoinability() == StreamContext.Joinability.MISSING_PERMISSIONS) {
emitShowToastEvent(2131887273);
} else {
emitRequestStreamPermissionsEvent(streamContext.getStream());
}
}
public final void removeRelationship(@StringRes int i) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.removeRelationship("User Profile", this.userId), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, new WidgetUserSheetViewModel$removeRelationship$2(this), (Function0) null, (Function0) null, new WidgetUserSheetViewModel$removeRelationship$1(this, i), 54, (Object) null);
}
public final void saveUserNote(Context context, String str) {
m.checkNotNullParameter(str, "noteText");
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null) {
boolean z2 = true;
if ((!(loaded.getUserNoteFetchState() instanceof StoreUserNotes.UserNoteState.Empty) || !(!m.areEqual(str, ""))) && (!(loaded.getUserNoteFetchState() instanceof StoreUserNotes.UserNoteState.Loaded) || !(!m.areEqual(((StoreUserNotes.UserNoteState.Loaded) loaded.getUserNoteFetchState()).getNote().getNote(), str)))) {
z2 = false;
}
if (z2) {
this.storeUserNotes.saveNote(context, this.userId, str);
}
}
}
public final void setUserOutputVolume(float f) {
this.storeMediaSettings.setUserOutputVolume(this.userId, PerceptualVolumeUtils.perceptualToAmplitude$default(PerceptualVolumeUtils.INSTANCE, f, 0.0f, 2, null));
}
public final void setUserSuppressedInChannel(boolean z2) {
Channel channel;
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && (channel = loaded.getStageViewState().getChannel()) != null) {
long id2 = loaded.getUser().getId();
updateViewState(ViewState.Loaded.copy$default(loaded, null, false, false, null, null, null, null, null, null, UserProfileStageActionsView.ViewState.m48copypGLTHTc$default(loaded.getStageViewState(), false, null, null, null, null, false, true, false, 191, null), null, null, null, 0, null, null, null, false, null, 523775, null));
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(StageChannelAPI.setUserSuppressedInChannel$default(StageChannelAPI.INSTANCE, channel, id2, z2, 0, 8, null), false, 1, null), this, null, 2, null), WidgetUserSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetUserSheetViewModel$setUserSuppressedInChannel$1(this), 62, (Object) null);
}
}
public final void toggleDeafen(boolean z2) {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && loaded.isMe() && (!m.areEqual(loaded.getVoiceSettingsViewState().isDeafened(), Boolean.valueOf(z2)))) {
this.storeMediaSettings.toggleSelfDeafened();
}
}
public final void toggleMute(boolean z2) {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && loaded.getVoiceSettingsViewState().isMuted() != z2) {
if (loaded.isMe()) {
StoreMediaSettings.SelfMuteFailure selfMuteFailure = this.storeMediaSettings.toggleSelfMuted();
if (selfMuteFailure != null && selfMuteFailure.ordinal() == 0) {
emitShowToastEvent(2131894415);
return;
}
return;
}
this.storeMediaSettings.toggleUserMuted(this.userId);
}
}
public final void updateUserNote(String str) {
m.checkNotNullParameter(str, "noteText");
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded == null) {
return;
}
if ((!m.areEqual(loaded.getUserNote(), str)) && !(loaded.getUserNoteFetchState() instanceof StoreUserNotes.UserNoteState.Loading)) {
updateViewState(ViewState.Loaded.copy$default(loaded, null, false, false, null, null, null, null, null, null, null, null, null, null, 0, null, null, str, false, null, 458751, null));
}
}
}