discord-jadx/app/src/main/java/com/discord/widgets/home/WidgetHomeModel.java

250 lines
9.8 KiB
Java

package com.discord.widgets.home;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.api.user.NsfwAllowance;
import com.discord.models.presence.Presence;
import com.discord.stores.StoreChannelsSelected;
import com.discord.stores.StoreStream;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.m;
import j0.l.e.j;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
/* compiled from: WidgetHomeModel.kt */
public final class WidgetHomeModel {
public static final Companion Companion = new Companion(null);
private final Channel channel;
private final long channelId;
private final Presence dmPresence;
private final boolean isCallConnected;
private final boolean isFriend;
private final NsfwAllowance nsfwAllowed;
private final Channel parentChannel;
private final StoreChannelsSelected.ResolvedSelectedChannel selectedChannel;
private final int threadCount;
private final boolean threadExperimentEnabled;
private final int unreadCount;
/* compiled from: WidgetHomeModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Observable<WidgetHomeModel> get() {
StoreStream.Companion companion = StoreStream.Companion;
Observable Y = Observable.j(companion.getGuildSelected().observeSelectedGuildId(), companion.getChannelsSelected().observeResolvedSelectedChannel(), WidgetHomeModel$Companion$get$1.INSTANCE).Y(WidgetHomeModel$Companion$get$2.INSTANCE);
m.checkNotNullExpressionValue(Y, "Observable.combineLatest… )\n }");
Observable<WidgetHomeModel> r = ObservableExtensionsKt.computationLatest(Y).r();
m.checkNotNullExpressionValue(r, "Observable.combineLatest… .distinctUntilChanged()");
return r;
}
public final Observable<Boolean> getInitialized() {
Observable<Boolean> q = StoreStream.Companion.isInitializedObservable().q(150, TimeUnit.MILLISECONDS);
m.checkNotNullExpressionValue(q, "StoreStream\n .i…0, TimeUnit.MILLISECONDS)");
return q;
}
public final Observable<Channel> getParentChannelObservable(Channel channel) {
if (channel == null || AnimatableValueParser.A1(channel)) {
if ((channel != null ? Long.valueOf(channel.r()) : null) != null) {
return StoreStream.Companion.getChannels().observeChannel(channel.r());
}
}
j jVar = new j(null);
m.checkNotNullExpressionValue(jVar, "Observable.just(null)");
return jVar;
}
}
public WidgetHomeModel(StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel, Channel channel, Presence presence, int i, boolean z2, boolean z3, NsfwAllowance nsfwAllowance, int i2, boolean z4) {
m.checkNotNullParameter(resolvedSelectedChannel, "selectedChannel");
this.selectedChannel = resolvedSelectedChannel;
this.parentChannel = channel;
this.dmPresence = presence;
this.unreadCount = i;
this.isFriend = z2;
this.isCallConnected = z3;
this.nsfwAllowed = nsfwAllowance;
this.threadCount = i2;
this.threadExperimentEnabled = z4;
this.channel = resolvedSelectedChannel.getMaybeChannel();
Channel maybeChannel = resolvedSelectedChannel.getMaybeChannel();
this.channelId = maybeChannel != null ? maybeChannel.h() : 0;
}
public static /* synthetic */ WidgetHomeModel copy$default(WidgetHomeModel widgetHomeModel, StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel, Channel channel, Presence presence, int i, boolean z2, boolean z3, NsfwAllowance nsfwAllowance, int i2, boolean z4, int i3, Object obj) {
return widgetHomeModel.copy((i3 & 1) != 0 ? widgetHomeModel.selectedChannel : resolvedSelectedChannel, (i3 & 2) != 0 ? widgetHomeModel.parentChannel : channel, (i3 & 4) != 0 ? widgetHomeModel.dmPresence : presence, (i3 & 8) != 0 ? widgetHomeModel.unreadCount : i, (i3 & 16) != 0 ? widgetHomeModel.isFriend : z2, (i3 & 32) != 0 ? widgetHomeModel.isCallConnected : z3, (i3 & 64) != 0 ? widgetHomeModel.nsfwAllowed : nsfwAllowance, (i3 & 128) != 0 ? widgetHomeModel.threadCount : i2, (i3 & 256) != 0 ? widgetHomeModel.threadExperimentEnabled : z4);
}
public final StoreChannelsSelected.ResolvedSelectedChannel component1() {
return this.selectedChannel;
}
public final Channel component2() {
return this.parentChannel;
}
public final Presence component3() {
return this.dmPresence;
}
public final int component4() {
return this.unreadCount;
}
public final boolean component5() {
return this.isFriend;
}
public final boolean component6() {
return this.isCallConnected;
}
public final NsfwAllowance component7() {
return this.nsfwAllowed;
}
public final int component8() {
return this.threadCount;
}
public final boolean component9() {
return this.threadExperimentEnabled;
}
public final WidgetHomeModel copy(StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel, Channel channel, Presence presence, int i, boolean z2, boolean z3, NsfwAllowance nsfwAllowance, int i2, boolean z4) {
m.checkNotNullParameter(resolvedSelectedChannel, "selectedChannel");
return new WidgetHomeModel(resolvedSelectedChannel, channel, presence, i, z2, z3, nsfwAllowance, i2, z4);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WidgetHomeModel)) {
return false;
}
WidgetHomeModel widgetHomeModel = (WidgetHomeModel) obj;
return m.areEqual(this.selectedChannel, widgetHomeModel.selectedChannel) && m.areEqual(this.parentChannel, widgetHomeModel.parentChannel) && m.areEqual(this.dmPresence, widgetHomeModel.dmPresence) && this.unreadCount == widgetHomeModel.unreadCount && this.isFriend == widgetHomeModel.isFriend && this.isCallConnected == widgetHomeModel.isCallConnected && m.areEqual(this.nsfwAllowed, widgetHomeModel.nsfwAllowed) && this.threadCount == widgetHomeModel.threadCount && this.threadExperimentEnabled == widgetHomeModel.threadExperimentEnabled;
}
public final Channel getChannel() {
return this.channel;
}
public final long getChannelId() {
return this.channelId;
}
public final Presence getDmPresence() {
return this.dmPresence;
}
public final NsfwAllowance getNsfwAllowed() {
return this.nsfwAllowed;
}
public final Channel getParentChannel() {
return this.parentChannel;
}
public final StoreChannelsSelected.ResolvedSelectedChannel getSelectedChannel() {
return this.selectedChannel;
}
public final int getThreadCount() {
return this.threadCount;
}
public final boolean getThreadExperimentEnabled() {
return this.threadExperimentEnabled;
}
public final int getUnreadCount() {
return this.unreadCount;
}
public int hashCode() {
StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = this.selectedChannel;
int i = 0;
int hashCode = (resolvedSelectedChannel != null ? resolvedSelectedChannel.hashCode() : 0) * 31;
Channel channel = this.parentChannel;
int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31;
Presence presence = this.dmPresence;
int hashCode3 = (((hashCode2 + (presence != null ? presence.hashCode() : 0)) * 31) + this.unreadCount) * 31;
boolean z2 = this.isFriend;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode3 + i3) * 31;
boolean z3 = this.isCallConnected;
if (z3) {
z3 = true;
}
int i7 = z3 ? 1 : 0;
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = (i6 + i7) * 31;
NsfwAllowance nsfwAllowance = this.nsfwAllowed;
if (nsfwAllowance != null) {
i = nsfwAllowance.hashCode();
}
int i11 = (((i10 + i) * 31) + this.threadCount) * 31;
boolean z4 = this.threadExperimentEnabled;
if (!z4) {
i2 = z4 ? 1 : 0;
}
return i11 + i2;
}
public final boolean isCallConnected() {
return this.isCallConnected;
}
public final boolean isChannelNsfw() {
Channel channel = this.channel;
return channel != null && channel.o();
}
public final boolean isFriend() {
return this.isFriend;
}
public final boolean isNsfwUnConsented() {
return this.channel != null && !StoreStream.Companion.getGuildsNsfw().isGuildNsfwGateAgreed(this.channel.f());
}
public String toString() {
StringBuilder K = a.K("WidgetHomeModel(selectedChannel=");
K.append(this.selectedChannel);
K.append(", parentChannel=");
K.append(this.parentChannel);
K.append(", dmPresence=");
K.append(this.dmPresence);
K.append(", unreadCount=");
K.append(this.unreadCount);
K.append(", isFriend=");
K.append(this.isFriend);
K.append(", isCallConnected=");
K.append(this.isCallConnected);
K.append(", nsfwAllowed=");
K.append(this.nsfwAllowed);
K.append(", threadCount=");
K.append(this.threadCount);
K.append(", threadExperimentEnabled=");
return a.F(K, this.threadExperimentEnabled, ")");
}
}