2021-08-09 22:50:52 +00:00
|
|
|
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.domain.ModelUserRelationship;
|
|
|
|
import com.discord.models.presence.Presence;
|
|
|
|
import com.discord.models.user.MeUser;
|
|
|
|
import com.discord.models.user.User;
|
|
|
|
import com.discord.stores.StoreChannelsSelected;
|
|
|
|
import com.discord.stores.StoreStream;
|
|
|
|
import com.discord.stores.StoreThreadsActive;
|
|
|
|
import com.discord.stores.StoreUser;
|
|
|
|
import com.discord.utilities.rx.ObservableWithLeadingEdgeThrottle;
|
|
|
|
import com.discord.widgets.chat.list.CreateThreadsFeatureFlag;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import j0.k.b;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import kotlin.Pair;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.functions.Func8;
|
|
|
|
/* compiled from: WidgetHomeModel.kt */
|
|
|
|
public final class WidgetHomeModel$Companion$get$2<T, R> implements b<Pair<? extends Long, ? extends StoreChannelsSelected.ResolvedSelectedChannel>, Observable<? extends WidgetHomeModel>> {
|
|
|
|
public static final WidgetHomeModel$Companion$get$2 INSTANCE = new WidgetHomeModel$Companion$get$2();
|
|
|
|
|
|
|
|
/* compiled from: WidgetHomeModel.kt */
|
|
|
|
/* renamed from: com.discord.widgets.home.WidgetHomeModel$Companion$get$2$1 reason: invalid class name */
|
|
|
|
public static final class AnonymousClass1<T1, T2, T3, T4, T5, T6, T7, T8, R> implements Func8<MeUser, Map<Long, ? extends Presence>, Long, Integer, Map<Long, ? extends Integer>, Map<Long, ? extends Channel>, Channel, Boolean, WidgetHomeModel> {
|
|
|
|
public final /* synthetic */ Channel $channel;
|
|
|
|
public final /* synthetic */ StoreChannelsSelected.ResolvedSelectedChannel $selectedChannel;
|
|
|
|
|
|
|
|
public AnonymousClass1(Channel channel, StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel) {
|
|
|
|
this.$channel = channel;
|
|
|
|
this.$selectedChannel = resolvedSelectedChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:30:0x007d */
|
|
|
|
public final WidgetHomeModel call(MeUser meUser, Map<Long, Presence> map, Long l, Integer num, Map<Long, Integer> map2, Map<Long, Channel> map3, Channel channel, Boolean bool) {
|
|
|
|
boolean z2;
|
|
|
|
User v0;
|
|
|
|
User v02;
|
|
|
|
Long l2;
|
|
|
|
Long l3;
|
|
|
|
Channel channel2 = this.$channel;
|
|
|
|
NsfwAllowance nsfwAllowance = null;
|
|
|
|
if (channel2 != null && AnimatableValueParser.t1(channel2)) {
|
|
|
|
Channel channel3 = this.$channel;
|
|
|
|
if (channel3 != null) {
|
|
|
|
l3 = Long.valueOf(channel3.h());
|
|
|
|
l2 = l;
|
|
|
|
} else {
|
|
|
|
l2 = l;
|
|
|
|
l3 = null;
|
|
|
|
}
|
|
|
|
if (m.areEqual(l2, l3)) {
|
|
|
|
z2 = true;
|
|
|
|
StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = this.$selectedChannel;
|
|
|
|
m.checkNotNullExpressionValue(resolvedSelectedChannel, "selectedChannel");
|
|
|
|
Channel channel4 = this.$channel;
|
|
|
|
Presence presence = (channel4 != null || (v02 = AnimatableValueParser.v0(channel4)) == null) ? null : (Presence) a.c(v02, map);
|
|
|
|
m.checkNotNullExpressionValue(num, "unreadCount");
|
|
|
|
int intValue = num.intValue();
|
|
|
|
m.checkNotNullExpressionValue(map2, "userRelationships");
|
|
|
|
Channel channel5 = this.$channel;
|
|
|
|
boolean isType = ModelUserRelationship.isType(map2.get((channel5 != null || (v0 = AnimatableValueParser.v0(channel5)) == null) ? null : Long.valueOf(v0.getId())), 1);
|
|
|
|
if (meUser != null) {
|
|
|
|
nsfwAllowance = meUser.getNsfwAllowance();
|
|
|
|
}
|
|
|
|
int size = map3.size();
|
|
|
|
m.checkNotNullExpressionValue(bool, "threadExperimentEnabled");
|
|
|
|
return new WidgetHomeModel(resolvedSelectedChannel, channel, presence, intValue, isType, z2, nsfwAllowance, size, bool.booleanValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
z2 = false;
|
|
|
|
StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = this.$selectedChannel;
|
|
|
|
m.checkNotNullExpressionValue(resolvedSelectedChannel, "selectedChannel");
|
|
|
|
Channel channel4 = this.$channel;
|
|
|
|
if (channel4 != null) {
|
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(num, "unreadCount");
|
|
|
|
int intValue = num.intValue();
|
|
|
|
m.checkNotNullExpressionValue(map2, "userRelationships");
|
|
|
|
Channel channel5 = this.$channel;
|
|
|
|
boolean isType = ModelUserRelationship.isType(map2.get((channel5 != null || (v0 = AnimatableValueParser.v0(channel5)) == null) ? null : Long.valueOf(v0.getId())), 1);
|
|
|
|
if (meUser != null) {
|
|
|
|
}
|
|
|
|
int size = map3.size();
|
|
|
|
m.checkNotNullExpressionValue(bool, "threadExperimentEnabled");
|
|
|
|
return new WidgetHomeModel(resolvedSelectedChannel, channel, presence, intValue, isType, z2, nsfwAllowance, size, bool.booleanValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object] */
|
|
|
|
@Override // rx.functions.Func8
|
|
|
|
public /* bridge */ /* synthetic */ WidgetHomeModel call(MeUser meUser, Map<Long, ? extends Presence> map, Long l, Integer num, Map<Long, ? extends Integer> map2, Map<Long, ? extends Channel> map3, Channel channel, Boolean bool) {
|
|
|
|
return call(meUser, (Map<Long, Presence>) map, l, num, (Map<Long, Integer>) map2, (Map<Long, Channel>) map3, channel, bool);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 // j0.k.b
|
|
|
|
public /* bridge */ /* synthetic */ Observable<? extends WidgetHomeModel> call(Pair<? extends Long, ? extends StoreChannelsSelected.ResolvedSelectedChannel> pair) {
|
|
|
|
return call((Pair<Long, ? extends StoreChannelsSelected.ResolvedSelectedChannel>) pair);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<? extends WidgetHomeModel> call(Pair<Long, ? extends StoreChannelsSelected.ResolvedSelectedChannel> pair) {
|
|
|
|
Long l;
|
|
|
|
long j;
|
|
|
|
Long component1 = pair.component1();
|
|
|
|
StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = (StoreChannelsSelected.ResolvedSelectedChannel) pair.component2();
|
|
|
|
Channel maybeChannel = resolvedSelectedChannel.getMaybeChannel();
|
|
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
|
|
Observable observeMe$default = StoreUser.observeMe$default(companion.getUsers(), false, 1, null);
|
|
|
|
Observable<Map<Long, Presence>> observeAllPresences = companion.getPresences().observeAllPresences();
|
|
|
|
Observable<Long> observeSelectedVoiceChannelId = companion.getVoiceChannelSelected().observeSelectedVoiceChannelId();
|
|
|
|
Observable<Integer> observeTotalMentions = companion.getMentions().observeTotalMentions();
|
|
|
|
Observable<Map<Long, Integer>> observe = companion.getUserRelationships().observe();
|
|
|
|
StoreThreadsActive threadsActive = companion.getThreadsActive();
|
|
|
|
m.checkNotNullExpressionValue(component1, "selectedGuildId");
|
|
|
|
long longValue = component1.longValue();
|
2021-08-20 10:00:12 +00:00
|
|
|
if (maybeChannel != null && AnimatableValueParser.B1(maybeChannel)) {
|
2021-08-09 22:50:52 +00:00
|
|
|
j = maybeChannel.r();
|
|
|
|
} else if (maybeChannel != null) {
|
|
|
|
j = maybeChannel.h();
|
|
|
|
} else {
|
|
|
|
l = null;
|
|
|
|
return ObservableWithLeadingEdgeThrottle.combineLatest(observeMe$default, observeAllPresences, observeSelectedVoiceChannelId, observeTotalMentions, observe, threadsActive.observeActiveThreadsForChannel(longValue, l), WidgetHomeModel.Companion.getParentChannelObservable(maybeChannel), new CreateThreadsFeatureFlag(null, null, 3, null).observeEnabled(component1.longValue()), new AnonymousClass1(maybeChannel, resolvedSelectedChannel), 350, TimeUnit.MILLISECONDS);
|
|
|
|
}
|
|
|
|
l = Long.valueOf(j);
|
|
|
|
return ObservableWithLeadingEdgeThrottle.combineLatest(observeMe$default, observeAllPresences, observeSelectedVoiceChannelId, observeTotalMentions, observe, threadsActive.observeActiveThreadsForChannel(longValue, l), WidgetHomeModel.Companion.getParentChannelObservable(maybeChannel), new CreateThreadsFeatureFlag(null, null, 3, null).observeEnabled(component1.longValue()), new AnonymousClass1(maybeChannel, resolvedSelectedChannel), 350, TimeUnit.MILLISECONDS);
|
|
|
|
}
|
|
|
|
}
|