discord-jadx/app/src/main/java/com/discord/widgets/guilds/profile/WidgetGuildProfileSheetView...

1527 lines
63 KiB
Java

package com.discord.widgets.guilds.profile;
import a0.a.a.b;
import android.content.Context;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import b.d.b.a.a;
import com.discord.R;
import com.discord.api.emoji.GuildEmoji;
import com.discord.api.guild.GuildFeature;
import com.discord.api.guild.preview.GuildPreview;
import com.discord.app.AppActivity;
import com.discord.app.AppViewModel;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.models.domain.emoji.Emoji;
import com.discord.models.domain.emoji.ModelEmojiCustom;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.user.MeUser;
import com.discord.restapi.RestAPIParams;
import com.discord.stores.StoreAnalytics;
import com.discord.stores.StoreEmoji;
import com.discord.stores.StoreGuildProfiles;
import com.discord.stores.StoreLurking;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreUser;
import com.discord.stores.StoreUserGuildSettings;
import com.discord.stores.StoreUserSettings;
import com.discord.utilities.channel.GuildChannelsInfo;
import com.discord.utilities.guilds.GuildUtilsKt;
import com.discord.utilities.permissions.ManageGuildContext;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.user.UserUtils;
import d0.t.n;
import d0.z.d.m;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
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: WidgetGuildProfileSheetViewModel.kt */
public final class WidgetGuildProfileSheetViewModel extends AppViewModel<ViewState> {
public static final Companion Companion = new Companion(null);
private final PublishSubject<Event> eventSubject;
private final long guildId;
private boolean isEmojiSectionExpanded;
private final RestAPI restAPI;
private final StoreLurking storeLurking;
private final StoreUserGuildSettings storeUserGuildSettings;
private final StoreUserSettings storeUserSettings;
private final boolean viewingGuild;
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
/* renamed from: com.discord.widgets.guilds.profile.WidgetGuildProfileSheetViewModel$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
public final /* synthetic */ WidgetGuildProfileSheetViewModel this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1(WidgetGuildProfileSheetViewModel widgetGuildProfileSheetViewModel) {
super(1);
this.this$0 = widgetGuildProfileSheetViewModel;
}
/* 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, "storeState");
WidgetGuildProfileSheetViewModel.access$handleStoreState(this.this$0, storeState);
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class Actions {
private final boolean canChangeNickname;
private final boolean canLeaveGuild;
private final boolean canManageChannels;
private final boolean canManageEvents;
private final boolean displayGuildIdentityRow;
private final String guildAvatar;
private final boolean hideMutedChannels;
private final boolean isAllowDMChecked;
private final boolean isDeveloper;
private final boolean isUnread;
private final String nick;
private final String username;
/* JADX WARNING: Code restructure failed: missing block: B:12:0x003a, code lost:
if ((r7 == null || r7.length() == 0) == false) goto L_0x003c;
*/
public Actions(boolean z2, boolean z3, boolean z4, boolean z5, String str, String str2, boolean z6, boolean z7, boolean z8, boolean z9, String str3) {
m.checkNotNullParameter(str3, "username");
this.isUnread = z2;
this.canManageChannels = z3;
this.canManageEvents = z4;
this.canChangeNickname = z5;
this.nick = str;
this.guildAvatar = str2;
this.isAllowDMChecked = z6;
this.hideMutedChannels = z7;
this.canLeaveGuild = z8;
this.isDeveloper = z9;
this.username = str3;
boolean z10 = false;
if (str == null || str.length() == 0) {
}
z10 = true;
this.displayGuildIdentityRow = z10;
}
public static /* synthetic */ Actions copy$default(Actions actions, boolean z2, boolean z3, boolean z4, boolean z5, String str, String str2, boolean z6, boolean z7, boolean z8, boolean z9, String str3, int i, Object obj) {
return actions.copy((i & 1) != 0 ? actions.isUnread : z2, (i & 2) != 0 ? actions.canManageChannels : z3, (i & 4) != 0 ? actions.canManageEvents : z4, (i & 8) != 0 ? actions.canChangeNickname : z5, (i & 16) != 0 ? actions.nick : str, (i & 32) != 0 ? actions.guildAvatar : str2, (i & 64) != 0 ? actions.isAllowDMChecked : z6, (i & 128) != 0 ? actions.hideMutedChannels : z7, (i & 256) != 0 ? actions.canLeaveGuild : z8, (i & 512) != 0 ? actions.isDeveloper : z9, (i & 1024) != 0 ? actions.username : str3);
}
public final boolean component1() {
return this.isUnread;
}
public final boolean component10() {
return this.isDeveloper;
}
public final String component11() {
return this.username;
}
public final boolean component2() {
return this.canManageChannels;
}
public final boolean component3() {
return this.canManageEvents;
}
public final boolean component4() {
return this.canChangeNickname;
}
public final String component5() {
return this.nick;
}
public final String component6() {
return this.guildAvatar;
}
public final boolean component7() {
return this.isAllowDMChecked;
}
public final boolean component8() {
return this.hideMutedChannels;
}
public final boolean component9() {
return this.canLeaveGuild;
}
public final Actions copy(boolean z2, boolean z3, boolean z4, boolean z5, String str, String str2, boolean z6, boolean z7, boolean z8, boolean z9, String str3) {
m.checkNotNullParameter(str3, "username");
return new Actions(z2, z3, z4, z5, str, str2, z6, z7, z8, z9, str3);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Actions)) {
return false;
}
Actions actions = (Actions) obj;
return this.isUnread == actions.isUnread && this.canManageChannels == actions.canManageChannels && this.canManageEvents == actions.canManageEvents && this.canChangeNickname == actions.canChangeNickname && m.areEqual(this.nick, actions.nick) && m.areEqual(this.guildAvatar, actions.guildAvatar) && this.isAllowDMChecked == actions.isAllowDMChecked && this.hideMutedChannels == actions.hideMutedChannels && this.canLeaveGuild == actions.canLeaveGuild && this.isDeveloper == actions.isDeveloper && m.areEqual(this.username, actions.username);
}
public final boolean getCanChangeNickname() {
return this.canChangeNickname;
}
public final boolean getCanLeaveGuild() {
return this.canLeaveGuild;
}
public final boolean getCanManageChannels() {
return this.canManageChannels;
}
public final boolean getCanManageEvents() {
return this.canManageEvents;
}
public final boolean getDisplayGuildIdentityRow() {
return this.displayGuildIdentityRow;
}
public final String getGuildAvatar() {
return this.guildAvatar;
}
public final boolean getHideMutedChannels() {
return this.hideMutedChannels;
}
public final String getNick() {
return this.nick;
}
public final String getUsername() {
return this.username;
}
public int hashCode() {
boolean z2 = this.isUnread;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = i2 * 31;
boolean z3 = this.canManageChannels;
if (z3) {
z3 = true;
}
int i6 = z3 ? 1 : 0;
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = (i5 + i6) * 31;
boolean z4 = this.canManageEvents;
if (z4) {
z4 = true;
}
int i10 = z4 ? 1 : 0;
int i11 = z4 ? 1 : 0;
int i12 = z4 ? 1 : 0;
int i13 = (i9 + i10) * 31;
boolean z5 = this.canChangeNickname;
if (z5) {
z5 = true;
}
int i14 = z5 ? 1 : 0;
int i15 = z5 ? 1 : 0;
int i16 = z5 ? 1 : 0;
int i17 = (i13 + i14) * 31;
String str = this.nick;
int i18 = 0;
int hashCode = (i17 + (str != null ? str.hashCode() : 0)) * 31;
String str2 = this.guildAvatar;
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
boolean z6 = this.isAllowDMChecked;
if (z6) {
z6 = true;
}
int i19 = z6 ? 1 : 0;
int i20 = z6 ? 1 : 0;
int i21 = z6 ? 1 : 0;
int i22 = (hashCode2 + i19) * 31;
boolean z7 = this.hideMutedChannels;
if (z7) {
z7 = true;
}
int i23 = z7 ? 1 : 0;
int i24 = z7 ? 1 : 0;
int i25 = z7 ? 1 : 0;
int i26 = (i22 + i23) * 31;
boolean z8 = this.canLeaveGuild;
if (z8) {
z8 = true;
}
int i27 = z8 ? 1 : 0;
int i28 = z8 ? 1 : 0;
int i29 = z8 ? 1 : 0;
int i30 = (i26 + i27) * 31;
boolean z9 = this.isDeveloper;
if (!z9) {
i = z9 ? 1 : 0;
}
int i31 = (i30 + i) * 31;
String str3 = this.username;
if (str3 != null) {
i18 = str3.hashCode();
}
return i31 + i18;
}
public final boolean isAllowDMChecked() {
return this.isAllowDMChecked;
}
public final boolean isDeveloper() {
return this.isDeveloper;
}
public final boolean isUnread() {
return this.isUnread;
}
public String toString() {
StringBuilder R = a.R("Actions(isUnread=");
R.append(this.isUnread);
R.append(", canManageChannels=");
R.append(this.canManageChannels);
R.append(", canManageEvents=");
R.append(this.canManageEvents);
R.append(", canChangeNickname=");
R.append(this.canChangeNickname);
R.append(", nick=");
R.append(this.nick);
R.append(", guildAvatar=");
R.append(this.guildAvatar);
R.append(", isAllowDMChecked=");
R.append(this.isAllowDMChecked);
R.append(", hideMutedChannels=");
R.append(this.hideMutedChannels);
R.append(", canLeaveGuild=");
R.append(this.canLeaveGuild);
R.append(", isDeveloper=");
R.append(this.isDeveloper);
R.append(", username=");
return a.H(R, this.username, ")");
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class Banner {
private final long guildId;
private final String hash;
private final Type type;
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public enum Type {
BANNER,
SPLASH
}
public Banner(long j, String str, Type type) {
m.checkNotNullParameter(type, "type");
this.guildId = j;
this.hash = str;
this.type = type;
}
public static /* synthetic */ Banner copy$default(Banner banner, long j, String str, Type type, int i, Object obj) {
if ((i & 1) != 0) {
j = banner.guildId;
}
if ((i & 2) != 0) {
str = banner.hash;
}
if ((i & 4) != 0) {
type = banner.type;
}
return banner.copy(j, str, type);
}
public final long component1() {
return this.guildId;
}
public final String component2() {
return this.hash;
}
public final Type component3() {
return this.type;
}
public final Banner copy(long j, String str, Type type) {
m.checkNotNullParameter(type, "type");
return new Banner(j, str, type);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Banner)) {
return false;
}
Banner banner = (Banner) obj;
return this.guildId == banner.guildId && m.areEqual(this.hash, banner.hash) && m.areEqual(this.type, banner.type);
}
public final long getGuildId() {
return this.guildId;
}
public final String getHash() {
return this.hash;
}
public final Type getType() {
return this.type;
}
public int hashCode() {
int a = b.a(this.guildId) * 31;
String str = this.hash;
int i = 0;
int hashCode = (a + (str != null ? str.hashCode() : 0)) * 31;
Type type = this.type;
if (type != null) {
i = type.hashCode();
}
return hashCode + i;
}
public String toString() {
StringBuilder R = a.R("Banner(guildId=");
R.append(this.guildId);
R.append(", hash=");
R.append(this.hash);
R.append(", type=");
R.append(this.type);
R.append(")");
return R.toString();
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class BottomActions {
private final boolean showJoinServer;
private final boolean showUploadEmoji;
private final boolean showViewServer;
public BottomActions(boolean z2, boolean z3, boolean z4) {
this.showUploadEmoji = z2;
this.showJoinServer = z3;
this.showViewServer = z4;
}
public static /* synthetic */ BottomActions copy$default(BottomActions bottomActions, boolean z2, boolean z3, boolean z4, int i, Object obj) {
if ((i & 1) != 0) {
z2 = bottomActions.showUploadEmoji;
}
if ((i & 2) != 0) {
z3 = bottomActions.showJoinServer;
}
if ((i & 4) != 0) {
z4 = bottomActions.showViewServer;
}
return bottomActions.copy(z2, z3, z4);
}
public final boolean component1() {
return this.showUploadEmoji;
}
public final boolean component2() {
return this.showJoinServer;
}
public final boolean component3() {
return this.showViewServer;
}
public final BottomActions copy(boolean z2, boolean z3, boolean z4) {
return new BottomActions(z2, z3, z4);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof BottomActions)) {
return false;
}
BottomActions bottomActions = (BottomActions) obj;
return this.showUploadEmoji == bottomActions.showUploadEmoji && this.showJoinServer == bottomActions.showJoinServer && this.showViewServer == bottomActions.showViewServer;
}
public final boolean getShowJoinServer() {
return this.showJoinServer;
}
public final boolean getShowUploadEmoji() {
return this.showUploadEmoji;
}
public final boolean getShowViewServer() {
return this.showViewServer;
}
public int hashCode() {
boolean z2 = this.showUploadEmoji;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = i2 * 31;
boolean z3 = this.showJoinServer;
if (z3) {
z3 = true;
}
int i6 = z3 ? 1 : 0;
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = (i5 + i6) * 31;
boolean z4 = this.showViewServer;
if (!z4) {
i = z4 ? 1 : 0;
}
return i9 + i;
}
public String toString() {
StringBuilder R = a.R("BottomActions(showUploadEmoji=");
R.append(this.showUploadEmoji);
R.append(", showJoinServer=");
R.append(this.showJoinServer);
R.append(", showViewServer=");
return a.M(R, this.showViewServer, ")");
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Observable<StoreState> observeStores(long j) {
StoreStream.Companion companion = StoreStream.Companion;
Observable<StoreState> c = Observable.c(companion.getGuilds().observeGuild(j), companion.getGuildProfiles().observeGuildProfile(j), companion.getReadStates().getIsUnread(j), StoreUser.observeMe$default(companion.getUsers(), false, 1, null), StoreUser.observeMe$default(companion.getUsers(), false, 1, null).Y(new WidgetGuildProfileSheetViewModel$Companion$observeStores$1(j)), companion.getUserSettings().observeRestrictedGuildIds(), companion.getEmojis().getEmojiSet(new StoreEmoji.EmojiContext.GuildProfile(j), true, false).F(new WidgetGuildProfileSheetViewModel$Companion$observeStores$2(j)), companion.getLurking().isLurkingObs(j), GuildChannelsInfo.Companion.get(j), WidgetGuildProfileSheetViewModel$Companion$observeStores$3.INSTANCE);
m.checkNotNullExpressionValue(c, "Observable.combineLatest…ead\n )\n }");
return c;
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class EmojisData {
private final List<Emoji> emojis;
private final boolean isExpanded;
private final boolean isPremium;
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.List<? extends com.discord.models.domain.emoji.Emoji> */
/* JADX WARN: Multi-variable type inference failed */
public EmojisData(boolean z2, boolean z3, List<? extends Emoji> list) {
m.checkNotNullParameter(list, "emojis");
this.isPremium = z2;
this.isExpanded = z3;
this.emojis = list;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.guilds.profile.WidgetGuildProfileSheetViewModel$EmojisData */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ EmojisData copy$default(EmojisData emojisData, boolean z2, boolean z3, List list, int i, Object obj) {
if ((i & 1) != 0) {
z2 = emojisData.isPremium;
}
if ((i & 2) != 0) {
z3 = emojisData.isExpanded;
}
if ((i & 4) != 0) {
list = emojisData.emojis;
}
return emojisData.copy(z2, z3, list);
}
public final boolean component1() {
return this.isPremium;
}
public final boolean component2() {
return this.isExpanded;
}
public final List<Emoji> component3() {
return this.emojis;
}
public final EmojisData copy(boolean z2, boolean z3, List<? extends Emoji> list) {
m.checkNotNullParameter(list, "emojis");
return new EmojisData(z2, z3, list);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof EmojisData)) {
return false;
}
EmojisData emojisData = (EmojisData) obj;
return this.isPremium == emojisData.isPremium && this.isExpanded == emojisData.isExpanded && m.areEqual(this.emojis, emojisData.emojis);
}
public final List<Emoji> getEmojis() {
return this.emojis;
}
public int hashCode() {
boolean z2 = this.isPremium;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = i2 * 31;
boolean z3 = this.isExpanded;
if (!z3) {
i = z3 ? 1 : 0;
}
int i6 = (i5 + i) * 31;
List<Emoji> list = this.emojis;
return i6 + (list != null ? list.hashCode() : 0);
}
public final boolean isExpanded() {
return this.isExpanded;
}
public final boolean isPremium() {
return this.isPremium;
}
public String toString() {
StringBuilder R = a.R("EmojisData(isPremium=");
R.append(this.isPremium);
R.append(", isExpanded=");
R.append(this.isExpanded);
R.append(", emojis=");
return a.K(R, this.emojis, ")");
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static abstract class Event {
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class DismissAndShowToast extends Event {
private final int stringRes;
public DismissAndShowToast(@StringRes int i) {
super(null);
this.stringRes = i;
}
public static /* synthetic */ DismissAndShowToast copy$default(DismissAndShowToast dismissAndShowToast, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = dismissAndShowToast.stringRes;
}
return dismissAndShowToast.copy(i);
}
public final int component1() {
return this.stringRes;
}
public final DismissAndShowToast copy(@StringRes int i) {
return new DismissAndShowToast(i);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof DismissAndShowToast) && this.stringRes == ((DismissAndShowToast) obj).stringRes;
}
return true;
}
public final int getStringRes() {
return this.stringRes;
}
public int hashCode() {
return this.stringRes;
}
public String toString() {
return a.A(a.R("DismissAndShowToast(stringRes="), this.stringRes, ")");
}
}
private Event() {
}
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class StoreState {
private final GuildMember computedMe;
private final List<Emoji> emojis;
private final Guild guild;
private final GuildChannelsInfo guildChannelsInfo;
private final StoreGuildProfiles.GuildProfileData guildProfile;
private final boolean isDeveloper;
private final boolean isLurking;
private final boolean isUnread;
/* renamed from: me reason: collision with root package name */
private final MeUser f2832me;
private final List<Long> restrictedGuildIds;
/* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.List<? extends com.discord.models.domain.emoji.Emoji> */
/* JADX WARN: Multi-variable type inference failed */
public StoreState(Guild guild, StoreGuildProfiles.GuildProfileData guildProfileData, GuildChannelsInfo guildChannelsInfo, MeUser meUser, GuildMember guildMember, List<Long> list, boolean z2, List<? extends Emoji> list2, boolean z3, boolean z4) {
m.checkNotNullParameter(guildChannelsInfo, "guildChannelsInfo");
m.checkNotNullParameter(meUser, "me");
m.checkNotNullParameter(list, "restrictedGuildIds");
m.checkNotNullParameter(list2, "emojis");
this.guild = guild;
this.guildProfile = guildProfileData;
this.guildChannelsInfo = guildChannelsInfo;
this.f2832me = meUser;
this.computedMe = guildMember;
this.restrictedGuildIds = list;
this.isDeveloper = z2;
this.emojis = list2;
this.isLurking = z3;
this.isUnread = z4;
}
public static /* synthetic */ StoreState copy$default(StoreState storeState, Guild guild, StoreGuildProfiles.GuildProfileData guildProfileData, GuildChannelsInfo guildChannelsInfo, MeUser meUser, GuildMember guildMember, List list, boolean z2, List list2, boolean z3, boolean z4, int i, Object obj) {
return storeState.copy((i & 1) != 0 ? storeState.guild : guild, (i & 2) != 0 ? storeState.guildProfile : guildProfileData, (i & 4) != 0 ? storeState.guildChannelsInfo : guildChannelsInfo, (i & 8) != 0 ? storeState.f2832me : meUser, (i & 16) != 0 ? storeState.computedMe : guildMember, (i & 32) != 0 ? storeState.restrictedGuildIds : list, (i & 64) != 0 ? storeState.isDeveloper : z2, (i & 128) != 0 ? storeState.emojis : list2, (i & 256) != 0 ? storeState.isLurking : z3, (i & 512) != 0 ? storeState.isUnread : z4);
}
public final Guild component1() {
return this.guild;
}
public final boolean component10() {
return this.isUnread;
}
public final StoreGuildProfiles.GuildProfileData component2() {
return this.guildProfile;
}
public final GuildChannelsInfo component3() {
return this.guildChannelsInfo;
}
public final MeUser component4() {
return this.f2832me;
}
public final GuildMember component5() {
return this.computedMe;
}
public final List<Long> component6() {
return this.restrictedGuildIds;
}
public final boolean component7() {
return this.isDeveloper;
}
public final List<Emoji> component8() {
return this.emojis;
}
public final boolean component9() {
return this.isLurking;
}
public final StoreState copy(Guild guild, StoreGuildProfiles.GuildProfileData guildProfileData, GuildChannelsInfo guildChannelsInfo, MeUser meUser, GuildMember guildMember, List<Long> list, boolean z2, List<? extends Emoji> list2, boolean z3, boolean z4) {
m.checkNotNullParameter(guildChannelsInfo, "guildChannelsInfo");
m.checkNotNullParameter(meUser, "me");
m.checkNotNullParameter(list, "restrictedGuildIds");
m.checkNotNullParameter(list2, "emojis");
return new StoreState(guild, guildProfileData, guildChannelsInfo, meUser, guildMember, list, z2, list2, z3, z4);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof StoreState)) {
return false;
}
StoreState storeState = (StoreState) obj;
return m.areEqual(this.guild, storeState.guild) && m.areEqual(this.guildProfile, storeState.guildProfile) && m.areEqual(this.guildChannelsInfo, storeState.guildChannelsInfo) && m.areEqual(this.f2832me, storeState.f2832me) && m.areEqual(this.computedMe, storeState.computedMe) && m.areEqual(this.restrictedGuildIds, storeState.restrictedGuildIds) && this.isDeveloper == storeState.isDeveloper && m.areEqual(this.emojis, storeState.emojis) && this.isLurking == storeState.isLurking && this.isUnread == storeState.isUnread;
}
public final GuildMember getComputedMe() {
return this.computedMe;
}
public final List<Emoji> getEmojis() {
return this.emojis;
}
public final Guild getGuild() {
return this.guild;
}
public final GuildChannelsInfo getGuildChannelsInfo() {
return this.guildChannelsInfo;
}
public final StoreGuildProfiles.GuildProfileData getGuildProfile() {
return this.guildProfile;
}
public final MeUser getMe() {
return this.f2832me;
}
public final List<Long> getRestrictedGuildIds() {
return this.restrictedGuildIds;
}
public int hashCode() {
Guild guild = this.guild;
int i = 0;
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
StoreGuildProfiles.GuildProfileData guildProfileData = this.guildProfile;
int hashCode2 = (hashCode + (guildProfileData != null ? guildProfileData.hashCode() : 0)) * 31;
GuildChannelsInfo guildChannelsInfo = this.guildChannelsInfo;
int hashCode3 = (hashCode2 + (guildChannelsInfo != null ? guildChannelsInfo.hashCode() : 0)) * 31;
MeUser meUser = this.f2832me;
int hashCode4 = (hashCode3 + (meUser != null ? meUser.hashCode() : 0)) * 31;
GuildMember guildMember = this.computedMe;
int hashCode5 = (hashCode4 + (guildMember != null ? guildMember.hashCode() : 0)) * 31;
List<Long> list = this.restrictedGuildIds;
int hashCode6 = (hashCode5 + (list != null ? list.hashCode() : 0)) * 31;
boolean z2 = this.isDeveloper;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode6 + i3) * 31;
List<Emoji> list2 = this.emojis;
if (list2 != null) {
i = list2.hashCode();
}
int i7 = (i6 + i) * 31;
boolean z3 = this.isLurking;
if (z3) {
z3 = true;
}
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = z3 ? 1 : 0;
int i11 = (i7 + i8) * 31;
boolean z4 = this.isUnread;
if (!z4) {
i2 = z4 ? 1 : 0;
}
return i11 + i2;
}
public final boolean isDeveloper() {
return this.isDeveloper;
}
public final boolean isLurking() {
return this.isLurking;
}
public final boolean isUnread() {
return this.isUnread;
}
public String toString() {
StringBuilder R = a.R("StoreState(guild=");
R.append(this.guild);
R.append(", guildProfile=");
R.append(this.guildProfile);
R.append(", guildChannelsInfo=");
R.append(this.guildChannelsInfo);
R.append(", me=");
R.append(this.f2832me);
R.append(", computedMe=");
R.append(this.computedMe);
R.append(", restrictedGuildIds=");
R.append(this.restrictedGuildIds);
R.append(", isDeveloper=");
R.append(this.isDeveloper);
R.append(", emojis=");
R.append(this.emojis);
R.append(", isLurking=");
R.append(this.isLurking);
R.append(", isUnread=");
return a.M(R, this.isUnread, ")");
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class TabItems {
private final boolean ableToInstantInvite;
private final boolean canAccessSettings;
private final int premiumSubscriptionCount;
public TabItems(boolean z2, boolean z3, int i) {
this.canAccessSettings = z2;
this.ableToInstantInvite = z3;
this.premiumSubscriptionCount = i;
}
public static /* synthetic */ TabItems copy$default(TabItems tabItems, boolean z2, boolean z3, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
z2 = tabItems.canAccessSettings;
}
if ((i2 & 2) != 0) {
z3 = tabItems.ableToInstantInvite;
}
if ((i2 & 4) != 0) {
i = tabItems.premiumSubscriptionCount;
}
return tabItems.copy(z2, z3, i);
}
public final boolean component1() {
return this.canAccessSettings;
}
public final boolean component2() {
return this.ableToInstantInvite;
}
public final int component3() {
return this.premiumSubscriptionCount;
}
public final TabItems copy(boolean z2, boolean z3, int i) {
return new TabItems(z2, z3, i);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof TabItems)) {
return false;
}
TabItems tabItems = (TabItems) obj;
return this.canAccessSettings == tabItems.canAccessSettings && this.ableToInstantInvite == tabItems.ableToInstantInvite && this.premiumSubscriptionCount == tabItems.premiumSubscriptionCount;
}
public final boolean getAbleToInstantInvite() {
return this.ableToInstantInvite;
}
public final boolean getCanAccessSettings() {
return this.canAccessSettings;
}
public final int getPremiumSubscriptionCount() {
return this.premiumSubscriptionCount;
}
public int hashCode() {
boolean z2 = this.canAccessSettings;
int i = 1;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = i2 * 31;
boolean z3 = this.ableToInstantInvite;
if (!z3) {
i = z3 ? 1 : 0;
}
return ((i5 + i) * 31) + this.premiumSubscriptionCount;
}
public String toString() {
StringBuilder R = a.R("TabItems(canAccessSettings=");
R.append(this.canAccessSettings);
R.append(", ableToInstantInvite=");
R.append(this.ableToInstantInvite);
R.append(", premiumSubscriptionCount=");
return a.A(R, this.premiumSubscriptionCount, ")");
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static abstract class ViewState {
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class Invalid extends ViewState {
public static final Invalid INSTANCE = new Invalid();
private Invalid() {
super(null);
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.kt */
public static final class Loaded extends ViewState {
private final Actions actions;
private final Banner banner;
private final BottomActions bottomActions;
private final EmojisData emojisData;
private final String guildDescription;
private final String guildIcon;
private final long guildId;
private final String guildName;
private final String guildShortName;
private final boolean isGuildHub;
private final MeUser meUser;
private final Integer memberCount;
private final Integer onlineCount;
private final TabItems tabItems;
private final Integer verifiedPartneredIconRes;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Loaded(long j, String str, String str2, String str3, String str4, Integer num, Banner banner, Integer num2, Integer num3, TabItems tabItems, Actions actions, EmojisData emojisData, BottomActions bottomActions, boolean z2, MeUser meUser) {
super(null);
m.checkNotNullParameter(str, "guildName");
m.checkNotNullParameter(str2, "guildShortName");
m.checkNotNullParameter(banner, "banner");
m.checkNotNullParameter(emojisData, "emojisData");
m.checkNotNullParameter(bottomActions, "bottomActions");
m.checkNotNullParameter(meUser, "meUser");
this.guildId = j;
this.guildName = str;
this.guildShortName = str2;
this.guildIcon = str3;
this.guildDescription = str4;
this.verifiedPartneredIconRes = num;
this.banner = banner;
this.onlineCount = num2;
this.memberCount = num3;
this.tabItems = tabItems;
this.actions = actions;
this.emojisData = emojisData;
this.bottomActions = bottomActions;
this.isGuildHub = z2;
this.meUser = meUser;
}
public static /* synthetic */ Loaded copy$default(Loaded loaded, long j, String str, String str2, String str3, String str4, Integer num, Banner banner, Integer num2, Integer num3, TabItems tabItems, Actions actions, EmojisData emojisData, BottomActions bottomActions, boolean z2, MeUser meUser, int i, Object obj) {
return loaded.copy((i & 1) != 0 ? loaded.guildId : j, (i & 2) != 0 ? loaded.guildName : str, (i & 4) != 0 ? loaded.guildShortName : str2, (i & 8) != 0 ? loaded.guildIcon : str3, (i & 16) != 0 ? loaded.guildDescription : str4, (i & 32) != 0 ? loaded.verifiedPartneredIconRes : num, (i & 64) != 0 ? loaded.banner : banner, (i & 128) != 0 ? loaded.onlineCount : num2, (i & 256) != 0 ? loaded.memberCount : num3, (i & 512) != 0 ? loaded.tabItems : tabItems, (i & 1024) != 0 ? loaded.actions : actions, (i & 2048) != 0 ? loaded.emojisData : emojisData, (i & 4096) != 0 ? loaded.bottomActions : bottomActions, (i & 8192) != 0 ? loaded.isGuildHub : z2, (i & 16384) != 0 ? loaded.meUser : meUser);
}
public final long component1() {
return this.guildId;
}
public final TabItems component10() {
return this.tabItems;
}
public final Actions component11() {
return this.actions;
}
public final EmojisData component12() {
return this.emojisData;
}
public final BottomActions component13() {
return this.bottomActions;
}
public final boolean component14() {
return this.isGuildHub;
}
public final MeUser component15() {
return this.meUser;
}
public final String component2() {
return this.guildName;
}
public final String component3() {
return this.guildShortName;
}
public final String component4() {
return this.guildIcon;
}
public final String component5() {
return this.guildDescription;
}
public final Integer component6() {
return this.verifiedPartneredIconRes;
}
public final Banner component7() {
return this.banner;
}
public final Integer component8() {
return this.onlineCount;
}
public final Integer component9() {
return this.memberCount;
}
public final Loaded copy(long j, String str, String str2, String str3, String str4, Integer num, Banner banner, Integer num2, Integer num3, TabItems tabItems, Actions actions, EmojisData emojisData, BottomActions bottomActions, boolean z2, MeUser meUser) {
m.checkNotNullParameter(str, "guildName");
m.checkNotNullParameter(str2, "guildShortName");
m.checkNotNullParameter(banner, "banner");
m.checkNotNullParameter(emojisData, "emojisData");
m.checkNotNullParameter(bottomActions, "bottomActions");
m.checkNotNullParameter(meUser, "meUser");
return new Loaded(j, str, str2, str3, str4, num, banner, num2, num3, tabItems, actions, emojisData, bottomActions, z2, meUser);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Loaded)) {
return false;
}
Loaded loaded = (Loaded) obj;
return this.guildId == loaded.guildId && m.areEqual(this.guildName, loaded.guildName) && m.areEqual(this.guildShortName, loaded.guildShortName) && m.areEqual(this.guildIcon, loaded.guildIcon) && m.areEqual(this.guildDescription, loaded.guildDescription) && m.areEqual(this.verifiedPartneredIconRes, loaded.verifiedPartneredIconRes) && m.areEqual(this.banner, loaded.banner) && m.areEqual(this.onlineCount, loaded.onlineCount) && m.areEqual(this.memberCount, loaded.memberCount) && m.areEqual(this.tabItems, loaded.tabItems) && m.areEqual(this.actions, loaded.actions) && m.areEqual(this.emojisData, loaded.emojisData) && m.areEqual(this.bottomActions, loaded.bottomActions) && this.isGuildHub == loaded.isGuildHub && m.areEqual(this.meUser, loaded.meUser);
}
public final Actions getActions() {
return this.actions;
}
public final Banner getBanner() {
return this.banner;
}
public final BottomActions getBottomActions() {
return this.bottomActions;
}
public final EmojisData getEmojisData() {
return this.emojisData;
}
public final String getGuildDescription() {
return this.guildDescription;
}
public final String getGuildIcon() {
return this.guildIcon;
}
public final long getGuildId() {
return this.guildId;
}
public final String getGuildName() {
return this.guildName;
}
public final String getGuildShortName() {
return this.guildShortName;
}
public final MeUser getMeUser() {
return this.meUser;
}
public final Integer getMemberCount() {
return this.memberCount;
}
public final Integer getOnlineCount() {
return this.onlineCount;
}
public final TabItems getTabItems() {
return this.tabItems;
}
public final Integer getVerifiedPartneredIconRes() {
return this.verifiedPartneredIconRes;
}
public int hashCode() {
int a = b.a(this.guildId) * 31;
String str = this.guildName;
int i = 0;
int hashCode = (a + (str != null ? str.hashCode() : 0)) * 31;
String str2 = this.guildShortName;
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
String str3 = this.guildIcon;
int hashCode3 = (hashCode2 + (str3 != null ? str3.hashCode() : 0)) * 31;
String str4 = this.guildDescription;
int hashCode4 = (hashCode3 + (str4 != null ? str4.hashCode() : 0)) * 31;
Integer num = this.verifiedPartneredIconRes;
int hashCode5 = (hashCode4 + (num != null ? num.hashCode() : 0)) * 31;
Banner banner = this.banner;
int hashCode6 = (hashCode5 + (banner != null ? banner.hashCode() : 0)) * 31;
Integer num2 = this.onlineCount;
int hashCode7 = (hashCode6 + (num2 != null ? num2.hashCode() : 0)) * 31;
Integer num3 = this.memberCount;
int hashCode8 = (hashCode7 + (num3 != null ? num3.hashCode() : 0)) * 31;
TabItems tabItems = this.tabItems;
int hashCode9 = (hashCode8 + (tabItems != null ? tabItems.hashCode() : 0)) * 31;
Actions actions = this.actions;
int hashCode10 = (hashCode9 + (actions != null ? actions.hashCode() : 0)) * 31;
EmojisData emojisData = this.emojisData;
int hashCode11 = (hashCode10 + (emojisData != null ? emojisData.hashCode() : 0)) * 31;
BottomActions bottomActions = this.bottomActions;
int hashCode12 = (hashCode11 + (bottomActions != null ? bottomActions.hashCode() : 0)) * 31;
boolean z2 = this.isGuildHub;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = (hashCode12 + i2) * 31;
MeUser meUser = this.meUser;
if (meUser != null) {
i = meUser.hashCode();
}
return i5 + i;
}
public final boolean isGuildHub() {
return this.isGuildHub;
}
public String toString() {
StringBuilder R = a.R("Loaded(guildId=");
R.append(this.guildId);
R.append(", guildName=");
R.append(this.guildName);
R.append(", guildShortName=");
R.append(this.guildShortName);
R.append(", guildIcon=");
R.append(this.guildIcon);
R.append(", guildDescription=");
R.append(this.guildDescription);
R.append(", verifiedPartneredIconRes=");
R.append(this.verifiedPartneredIconRes);
R.append(", banner=");
R.append(this.banner);
R.append(", onlineCount=");
R.append(this.onlineCount);
R.append(", memberCount=");
R.append(this.memberCount);
R.append(", tabItems=");
R.append(this.tabItems);
R.append(", actions=");
R.append(this.actions);
R.append(", emojisData=");
R.append(this.emojisData);
R.append(", bottomActions=");
R.append(this.bottomActions);
R.append(", isGuildHub=");
R.append(this.isGuildHub);
R.append(", meUser=");
R.append(this.meUser);
R.append(")");
return R.toString();
}
}
/* compiled from: WidgetGuildProfileSheetViewModel.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 WidgetGuildProfileSheetViewModel(StoreUserSettings storeUserSettings, StoreUserGuildSettings storeUserGuildSettings, boolean z2, RestAPI restAPI, StoreLurking storeLurking, StoreAnalytics storeAnalytics, long j, Observable<StoreState> observable) {
super(ViewState.Loading.INSTANCE);
m.checkNotNullParameter(storeUserSettings, "storeUserSettings");
m.checkNotNullParameter(storeUserGuildSettings, "storeUserGuildSettings");
m.checkNotNullParameter(restAPI, "restAPI");
m.checkNotNullParameter(storeLurking, "storeLurking");
m.checkNotNullParameter(storeAnalytics, "storeAnalytics");
m.checkNotNullParameter(observable, "storeObservable");
this.storeUserSettings = storeUserSettings;
this.storeUserGuildSettings = storeUserGuildSettings;
this.viewingGuild = z2;
this.restAPI = restAPI;
this.storeLurking = storeLurking;
this.guildId = j;
this.eventSubject = PublishSubject.k0();
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), WidgetGuildProfileSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
storeAnalytics.trackGuildProfileOpened(j);
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetGuildProfileSheetViewModel(StoreUserSettings storeUserSettings, StoreUserGuildSettings storeUserGuildSettings, boolean z2, RestAPI restAPI, StoreLurking storeLurking, StoreAnalytics storeAnalytics, long j, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? StoreStream.Companion.getUserSettings() : storeUserSettings, (i & 2) != 0 ? StoreStream.Companion.getUserGuildSettings() : storeUserGuildSettings, z2, (i & 8) != 0 ? RestAPI.Companion.getApi() : restAPI, (i & 16) != 0 ? StoreStream.Companion.getLurking() : storeLurking, (i & 32) != 0 ? StoreStream.Companion.getAnalytics() : storeAnalytics, j, (i & 128) != 0 ? Companion.observeStores(j) : observable);
}
public static final /* synthetic */ PublishSubject access$getEventSubject$p(WidgetGuildProfileSheetViewModel widgetGuildProfileSheetViewModel) {
return widgetGuildProfileSheetViewModel.eventSubject;
}
public static final /* synthetic */ void access$handleStoreState(WidgetGuildProfileSheetViewModel widgetGuildProfileSheetViewModel, StoreState storeState) {
widgetGuildProfileSheetViewModel.handleStoreState(storeState);
}
/* JADX WARNING: Removed duplicated region for block: B:10:0x0044 */
/* JADX WARNING: Removed duplicated region for block: B:11:0x0057 */
/* JADX WARNING: Removed duplicated region for block: B:14:0x005b */
/* JADX WARNING: Removed duplicated region for block: B:23:0x00ad */
/* JADX WARNING: Removed duplicated region for block: B:25:0x00b3 */
/* JADX WARNING: Removed duplicated region for block: B:33:0x00e5 */
/* JADX WARNING: Removed duplicated region for block: B:42:0x0112 */
/* JADX WARNING: Removed duplicated region for block: B:43:0x0119 */
/* JADX WARNING: Removed duplicated region for block: B:45:0x011d */
/* JADX WARNING: Removed duplicated region for block: B:48:0x0132 */
private final void handleLoadedGuild(Guild guild, GuildPreview guildPreview, GuildChannelsInfo guildChannelsInfo, MeUser meUser, GuildMember guildMember, List<Long> list, boolean z2, List<? extends Emoji> list2, boolean z3, boolean z4) {
Integer num;
List<? extends Emoji> list3;
List<GuildEmoji> d;
Integer valueOf;
Integer num2 = null;
if (guild.getFeatures().contains(GuildFeature.VERIFIED)) {
valueOf = Integer.valueOf((int) R.drawable.ic_verified_badge);
} else if (guild.getFeatures().contains(GuildFeature.PARTNERED)) {
valueOf = Integer.valueOf((int) R.drawable.ic_partnered_badge);
} else {
num = null;
Banner banner = new Banner(guild.getId(), guild.getBanner(), Banner.Type.BANNER);
ManageGuildContext manageGuildContext = guildChannelsInfo.getManageGuildContext();
TabItems tabItems = z3 ? new TabItems(manageGuildContext.canManage(), guildChannelsInfo.getAbleToInstantInvite(), guild.getPremiumSubscriptionCount()) : null;
Actions actions = z3 ? new Actions(z4, manageGuildContext.getCanManageChannels(), manageGuildContext.getCanManageEvents(), guildChannelsInfo.getCanChangeNickname(), guildMember != null ? guildMember.getNick() : null, guildMember != null ? guildMember.getAvatarHash() : null, !list.contains(Long.valueOf(guild.getId())), guildChannelsInfo.getHideMutedChannels(), !guild.isOwner(meUser.getId()), z2, meUser.getUsername()) : null;
if (z3) {
list3 = list2;
} else if (guildPreview == null || (d = guildPreview.d()) == null) {
list3 = null;
} else {
list3 = new ArrayList<>(d0.t.o.collectionSizeOrDefault(d, 10));
for (GuildEmoji guildEmoji : d) {
list3.add(new ModelEmojiCustom(guildEmoji, guildPreview.h()));
}
}
BottomActions bottomActions = new BottomActions(z3 && manageGuildContext.getCanManageEmojisAndStickers(), z3, true ^ this.viewingGuild);
long id2 = guild.getId();
String name = guild.getName();
String shortName = guild.getShortName();
String icon = guild.getIcon();
String description = guild.getDescription();
Integer b2 = guildPreview == null ? guildPreview.b() : null;
if (guildPreview != null) {
num2 = guildPreview.a();
}
boolean isPremium = UserUtils.INSTANCE.isPremium(meUser);
boolean z5 = this.isEmojiSectionExpanded;
if (list3 == null) {
list3 = n.emptyList();
}
updateViewState(new ViewState.Loaded(id2, name, shortName, icon, description, num, banner, b2, num2, tabItems, actions, new EmojisData(isPremium, z5, list3), bottomActions, guild.isHub(), meUser));
}
num = valueOf;
Banner banner = new Banner(guild.getId(), guild.getBanner(), Banner.Type.BANNER);
ManageGuildContext manageGuildContext = guildChannelsInfo.getManageGuildContext();
if (z3) {
}
if (z3) {
}
if (z3) {
}
BottomActions bottomActions = new BottomActions(z3 && manageGuildContext.getCanManageEmojisAndStickers(), z3, true ^ this.viewingGuild);
long id2 = guild.getId();
String name = guild.getName();
String shortName = guild.getShortName();
String icon = guild.getIcon();
String description = guild.getDescription();
if (guildPreview == null) {
}
if (guildPreview != null) {
}
boolean isPremium = UserUtils.INSTANCE.isPremium(meUser);
boolean z5 = this.isEmojiSectionExpanded;
if (list3 == null) {
}
updateViewState(new ViewState.Loaded(id2, name, shortName, icon, description, num, banner, b2, num2, tabItems, actions, new EmojisData(isPremium, z5, list3), bottomActions, guild.isHub(), meUser));
}
private final void handleLoadedGuildPreview(GuildPreview guildPreview, MeUser meUser) {
Integer valueOf = guildPreview.f().contains(GuildFeature.VERIFIED) ? Integer.valueOf((int) R.drawable.ic_verified_badge) : guildPreview.f().contains(GuildFeature.PARTNERED) ? Integer.valueOf((int) R.drawable.ic_partnered_badge) : null;
Banner banner = new Banner(guildPreview.h(), guildPreview.j(), Banner.Type.SPLASH);
BottomActions bottomActions = new BottomActions(false, true, !this.viewingGuild);
long h = guildPreview.h();
String i = guildPreview.i();
String computeShortName = GuildUtilsKt.computeShortName(guildPreview.i());
String g = guildPreview.g();
String c = guildPreview.c();
Integer b2 = guildPreview.b();
Integer a = guildPreview.a();
boolean isPremium = UserUtils.INSTANCE.isPremium(meUser);
boolean z2 = this.isEmojiSectionExpanded;
List<GuildEmoji> d = guildPreview.d();
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(d, 10));
Iterator it = d.iterator();
while (it.hasNext()) {
arrayList.add(new ModelEmojiCustom((GuildEmoji) it.next(), guildPreview.h()));
it = it;
b2 = b2;
a = a;
}
updateViewState(new ViewState.Loaded(h, i, computeShortName, g, c, valueOf, banner, b2, a, null, null, new EmojisData(isPremium, z2, arrayList), bottomActions, guildPreview.f().contains(GuildFeature.HUB), meUser));
}
private final void handleStoreState(StoreState storeState) {
Guild component1 = storeState.component1();
StoreGuildProfiles.GuildProfileData component2 = storeState.component2();
GuildChannelsInfo component3 = storeState.component3();
MeUser component4 = storeState.component4();
GuildMember component5 = storeState.component5();
List<Long> component6 = storeState.component6();
boolean component7 = storeState.component7();
List<Emoji> component8 = storeState.component8();
boolean component9 = storeState.component9();
boolean component10 = storeState.component10();
StoreGuildProfiles.FetchStates fetchStates = null;
GuildPreview guildPreview = null;
if (component1 != null) {
if (component2 != null) {
guildPreview = component2.getData();
}
handleLoadedGuild(component1, guildPreview, component3, component4, component5, component6, component7, component8, component9, component10);
return;
}
StoreGuildProfiles.FetchStates fetchState = component2 != null ? component2.getFetchState() : null;
StoreGuildProfiles.FetchStates fetchStates2 = StoreGuildProfiles.FetchStates.SUCCEEDED;
if (fetchState != fetchStates2 || component2.getData() == null) {
if ((component2 != null ? component2.getFetchState() : null) != StoreGuildProfiles.FetchStates.FAILED) {
if (component2 != null) {
fetchStates = component2.getFetchState();
}
if (!(fetchStates == fetchStates2 && component2.getData() == null)) {
updateViewState(ViewState.Loading.INSTANCE);
return;
}
}
updateViewState(ViewState.Invalid.INSTANCE);
return;
}
handleLoadedGuildPreview(component2.getData(), component4);
}
public final Observable<Event> observeEvents() {
PublishSubject<Event> publishSubject = this.eventSubject;
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
return publishSubject;
}
public final void onClickEmoji() {
ViewState viewState = getViewState();
if (!(viewState instanceof ViewState.Loaded)) {
viewState = null;
}
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
if (loaded != null && !this.isEmojiSectionExpanded) {
this.isEmojiSectionExpanded = true;
updateViewState(ViewState.Loaded.copy$default(loaded, 0, null, null, null, null, null, null, null, null, null, null, EmojisData.copy$default(loaded.getEmojisData(), false, this.isEmojiSectionExpanded, null, 5, null), null, false, null, 30719, null));
}
}
public final void onClickJoinServer(long j, Fragment fragment) {
m.checkNotNullParameter(fragment, "fragment");
Context context = fragment.getContext();
if (context != null) {
StoreLurking storeLurking = this.storeLurking;
m.checkNotNullExpressionValue(context, "it");
storeLurking.postJoinGuildAsMember(j, context);
}
}
public final void onClickLeaveServer(long j, Function0<Unit> function0) {
m.checkNotNullParameter(function0, "onSuccess");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.leaveGuild(j), false, 1, null), this, null, 2, null), WidgetGuildProfileSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheetViewModel$onClickLeaveServer$1(function0), 62, (Object) null);
}
public final void onClickMarkAsRead(long j) {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.ackGuild(j), false, 1, null), this, null, 2, null), WidgetGuildProfileSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheetViewModel$onClickMarkAsRead$1(this), 62, (Object) null);
}
public final void onClickResetNickname(long j, Function0<Unit> function0) {
m.checkNotNullParameter(function0, "onSuccess");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.changeGuildNickname(j, new RestAPIParams.Nick("")), false, 1, null), this, null, 2, null), WidgetGuildProfileSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheetViewModel$onClickResetNickname$1(function0), 62, (Object) null);
}
public final void onClickSaveNickname(long j, String str, Function0<Unit> function0) {
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_NICK);
m.checkNotNullParameter(function0, "onSuccess");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.changeGuildNickname(j, new RestAPIParams.Nick(str)), false, 1, null), this, null, 2, null), WidgetGuildProfileSheetViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildProfileSheetViewModel$onClickSaveNickname$1(function0), 62, (Object) null);
}
public final void onClickViewServer(long j, Long l) {
StoreLurking.startLurkingAndNavigate$default(this.storeLurking, j, l, null, 4, null);
}
public final void setAllowDM(AppActivity appActivity, long j, boolean z2) {
this.storeUserSettings.setRestrictedGuildId(appActivity, j, !z2);
}
public final void setHideMutedChannels(long j, boolean z2) {
this.storeUserGuildSettings.setHideMutedChannels(j, z2);
}
}