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

327 lines
22 KiB
Java

package com.discord.widgets.user.usersheet;
import c.d.b.a.a;
import com.discord.api.channel.Channel;
import com.discord.api.channel.ChannelUtils;
import com.discord.api.role.GuildRole;
import com.discord.api.user.UserProfile;
import com.discord.api.voice.state.StageRequestToSpeakState;
import com.discord.api.voice.state.VoiceState;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.user.MeUser;
import com.discord.models.user.User;
import com.discord.stores.StoreGuilds;
import com.discord.stores.StoreMediaSettings;
import com.discord.stores.StorePermissions;
import com.discord.stores.StoreStageChannels;
import com.discord.stores.StoreUserNotes;
import com.discord.stores.StoreUserPresence;
import com.discord.stores.StoreUserProfile;
import com.discord.stores.StoreUserRelationships;
import com.discord.stores.StoreVoiceStates;
import com.discord.utilities.rx.ObservableCombineLatestOverloadsKt;
import com.discord.utilities.streams.StreamContext;
import com.discord.utilities.streams.StreamContextService;
import com.discord.widgets.guildcommunicationdisabled.start.GuildCommunicationDisabledGuildsFeatureFlag;
import com.discord.widgets.stage.StageRoles;
import com.discord.widgets.user.presence.ModelRichPresence;
import com.discord.widgets.user.usersheet.WidgetUserSheetViewModel;
import com.discord.widgets.user.usersheet.WidgetUserSheetViewModelStoreState;
import d0.t.h0;
import d0.t.n;
import d0.z.d.m;
import d0.z.d.o;
import j0.k.b;
import j0.l.e.j;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.functions.Function16;
import rx.Observable;
/* compiled from: WidgetUserSheetViewModelStoreState.kt */
public final class WidgetUserSheetViewModelStoreState$observeStoreState$3<T, R> implements b<WidgetUserSheetViewModelStoreState.BootstrapData, Observable<? extends WidgetUserSheetViewModel.StoreState>> {
public final /* synthetic */ Long $guildId;
public final /* synthetic */ StoreGuilds $storeGuilds;
public final /* synthetic */ StoreMediaSettings $storeMediaSettings;
public final /* synthetic */ StorePermissions $storePermissions;
public final /* synthetic */ StoreStageChannels $storeStageChannels;
public final /* synthetic */ StoreUserNotes $storeUserNotes;
public final /* synthetic */ StoreUserPresence $storeUserPresence;
public final /* synthetic */ StoreUserProfile $storeUserProfile;
public final /* synthetic */ StoreUserRelationships $storeUserRelationships;
public final /* synthetic */ StoreVoiceStates $storeVoiceStates;
public final /* synthetic */ StreamContextService $streamContextService;
/* compiled from: WidgetUserSheetViewModelStoreState.kt */
/* renamed from: com.discord.widgets.user.usersheet.WidgetUserSheetViewModelStoreState$observeStoreState$3$1 reason: invalid class name */
public static final class AnonymousClass1<T, R> implements b {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public final Void call(Long l) {
return null;
}
}
/* compiled from: WidgetUserSheetViewModelStoreState.kt */
/* renamed from: com.discord.widgets.user.usersheet.WidgetUserSheetViewModelStoreState$observeStoreState$3$2 reason: invalid class name */
public static final class AnonymousClass2 extends o implements Function16<Map<Long, ? extends GuildMember>, Map<Long, ? extends GuildRole>, Map<Long, ? extends VoiceState>, Map<Long, ? extends VoiceState>, StoreMediaSettings.VoiceConfiguration, ModelRichPresence, Guild, Long, StreamContext, UserProfile, Integer, StoreUserNotes.UserNoteState, StageRoles, StageRequestToSpeakState, StageRoles, Boolean, WidgetUserSheetViewModel.StoreState> {
public final /* synthetic */ Channel $channel;
public final /* synthetic */ MeUser $me;
public final /* synthetic */ Channel $selectedVoiceChannel;
public final /* synthetic */ User $user;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass2(User user, MeUser meUser, Channel channel, Channel channel2) {
super(16);
this.$user = user;
this.$me = meUser;
this.$channel = channel;
this.$selectedVoiceChannel = channel2;
}
public final WidgetUserSheetViewModel.StoreState invoke(Map<Long, GuildMember> map, Map<Long, GuildRole> map2, Map<Long, VoiceState> map3, Map<Long, VoiceState> map4, StoreMediaSettings.VoiceConfiguration voiceConfiguration, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, UserProfile userProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2, boolean z2) {
m.checkNotNullParameter(map, "computedMembers");
m.checkNotNullParameter(map2, "guildRoles");
m.checkNotNullParameter(map3, "mySelectedVoiceChannelVoiceStates");
m.checkNotNullParameter(map4, "currentChannelVoiceStates");
m.checkNotNullParameter(voiceConfiguration, "voiceConfig");
m.checkNotNullParameter(userProfile, "userProfile");
m.checkNotNullParameter(userNoteState, "userNote");
m.checkNotNullParameter(stageRequestToSpeakState, "userRequestToSpeakState");
Boolean bool = (Boolean) a.e(this.$user, voiceConfiguration.getMutedUsers());
boolean booleanValue = bool != null ? bool.booleanValue() : false;
boolean isSelfMuted = voiceConfiguration.isSelfMuted();
boolean isSelfDeafened = voiceConfiguration.isSelfDeafened();
Float f = (Float) a.e(this.$user, voiceConfiguration.getUserOutputVolumes());
float floatValue = f != null ? f.floatValue() : 100.0f;
User user = this.$user;
MeUser meUser = this.$me;
Channel channel = this.$channel;
Channel channel2 = this.$selectedVoiceChannel;
return new WidgetUserSheetViewModel.StoreState(user, meUser, channel, map, map2, map3, map4, booleanValue, isSelfMuted, isSelfDeafened, floatValue, modelRichPresence, guild, l, streamContext, userProfile, num, userNoteState, (channel2 == null || !ChannelUtils.z(channel2)) ? null : channel2, stageRoles, stageRequestToSpeakState, stageRoles2, z2, null);
}
/* 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, 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 // kotlin.jvm.functions.Function16
public /* bridge */ /* synthetic */ WidgetUserSheetViewModel.StoreState invoke(Map<Long, ? extends GuildMember> map, Map<Long, ? extends GuildRole> map2, Map<Long, ? extends VoiceState> map3, Map<Long, ? extends VoiceState> map4, StoreMediaSettings.VoiceConfiguration voiceConfiguration, ModelRichPresence modelRichPresence, Guild guild, Long l, StreamContext streamContext, UserProfile userProfile, Integer num, StoreUserNotes.UserNoteState userNoteState, StageRoles stageRoles, StageRequestToSpeakState stageRequestToSpeakState, StageRoles stageRoles2, Boolean bool) {
return invoke((Map<Long, GuildMember>) map, (Map<Long, GuildRole>) map2, (Map<Long, VoiceState>) map3, (Map<Long, VoiceState>) map4, voiceConfiguration, modelRichPresence, guild, l, streamContext, userProfile, num, userNoteState, stageRoles, stageRequestToSpeakState, stageRoles2, bool.booleanValue());
}
}
public WidgetUserSheetViewModelStoreState$observeStoreState$3(Long l, StoreGuilds storeGuilds, StoreVoiceStates storeVoiceStates, StoreUserPresence storeUserPresence, StorePermissions storePermissions, StreamContextService streamContextService, StoreStageChannels storeStageChannels, StoreMediaSettings storeMediaSettings, StoreUserProfile storeUserProfile, StoreUserRelationships storeUserRelationships, StoreUserNotes storeUserNotes) {
this.$guildId = l;
this.$storeGuilds = storeGuilds;
this.$storeVoiceStates = storeVoiceStates;
this.$storeUserPresence = storeUserPresence;
this.$storePermissions = storePermissions;
this.$streamContextService = streamContextService;
this.$storeStageChannels = storeStageChannels;
this.$storeMediaSettings = storeMediaSettings;
this.$storeUserProfile = storeUserProfile;
this.$storeUserRelationships = storeUserRelationships;
this.$storeUserNotes = storeUserNotes;
}
/* JADX WARNING: Code restructure failed: missing block: B:32:0x00e3, code lost:
if (r6 != null) goto L_0x00ec;
*/
/* JADX WARNING: Code restructure failed: missing block: B:36:0x00f9, code lost:
if (r7 != null) goto L_0x0103;
*/
/* JADX WARNING: Code restructure failed: missing block: B:42:0x0123, code lost:
if (r2 != null) goto L_0x012f;
*/
/* JADX WARNING: Code restructure failed: missing block: B:47:0x0141, code lost:
if (r3 != null) goto L_0x014e;
*/
/* JADX WARNING: Code restructure failed: missing block: B:56:0x0176, code lost:
if (r5 != null) goto L_0x0181;
*/
/* JADX WARNING: Removed duplicated region for block: B:15:0x0071 */
/* JADX WARNING: Removed duplicated region for block: B:20:0x008e */
/* JADX WARNING: Removed duplicated region for block: B:25:0x00ac */
/* JADX WARNING: Removed duplicated region for block: B:31:0x00d6 */
/* JADX WARNING: Removed duplicated region for block: B:35:0x00ee */
/* JADX WARNING: Removed duplicated region for block: B:37:0x00fc */
/* JADX WARNING: Removed duplicated region for block: B:41:0x0112 */
/* JADX WARNING: Removed duplicated region for block: B:43:0x0126 */
/* JADX WARNING: Removed duplicated region for block: B:46:0x0131 */
/* JADX WARNING: Removed duplicated region for block: B:48:0x0144 */
/* JADX WARNING: Removed duplicated region for block: B:55:0x0165 */
public final Observable<? extends WidgetUserSheetViewModel.StoreState> call(WidgetUserSheetViewModelStoreState.BootstrapData bootstrapData) {
Observable<Map<Long, GuildMember>> observable;
Observable<Map<Long, GuildRole>> observable2;
Observable<Guild> observable3;
Observable observable4;
Observable<Long> observable5;
Channel channel;
MeUser meUser;
Observable<StageRoles> observable6;
MeUser meUser2;
Observable<StageRequestToSpeakState> observable7;
Observable<Boolean> observable8;
Observable<Map<Long, VoiceState>> observe;
Observable<Map<Long, VoiceState>> observe2;
User component1 = bootstrapData.component1();
MeUser component2 = bootstrapData.component2();
Channel component3 = bootstrapData.component3();
Channel component4 = bootstrapData.component4();
if (component1 == null) {
return Observable.d0(5, TimeUnit.SECONDS).F(AnonymousClass1.INSTANCE);
}
Long l = this.$guildId;
if (l == null) {
l = component3 != null ? Long.valueOf(component3.f()) : null;
}
if (l != null) {
l.longValue();
Observable<Map<Long, GuildMember>> observeComputed = this.$storeGuilds.observeComputed(l.longValue(), n.listOf((Object[]) new Long[]{Long.valueOf(component1.getId()), Long.valueOf(component2.getId())}));
if (observeComputed != null) {
observable = observeComputed;
if (l != null) {
l.longValue();
Observable<Map<Long, GuildRole>> observeRoles = this.$storeGuilds.observeRoles(l.longValue());
if (observeRoles != null) {
observable2 = observeRoles;
Observable<Map<Long, VoiceState>> jVar = (component4 != null || (observe2 = this.$storeVoiceStates.observe(component4.f(), component4.h())) == null) ? new j(h0.emptyMap()) : observe2;
Observable<Map<Long, VoiceState>> jVar2 = (component3 != null || (observe = this.$storeVoiceStates.observe(component3.f(), component3.h())) == null) ? new j(h0.emptyMap()) : observe;
Observable<ModelRichPresence> observable9 = ModelRichPresence.Companion.get(component1.getId(), this.$storeUserPresence);
if (l != null) {
l.longValue();
observable3 = this.$storeGuilds.observeGuild(l.longValue());
}
observable3 = new j<>(null);
if (component3 != null) {
observable4 = observable;
observable5 = this.$storePermissions.observePermissionsForChannel(component3.h());
} else {
observable4 = observable;
}
observable5 = new j<>(null);
Observable<StreamContext> forUser = this.$streamContextService.getForUser(component1.getId(), true);
if (component4 != null) {
meUser = component2;
channel = component3;
observable6 = this.$storeStageChannels.observeUserRoles(component1.getId(), component4.h());
} else {
meUser = component2;
channel = component3;
}
observable6 = new j<>(null);
if (component4 != null) {
meUser2 = meUser;
observable7 = this.$storeStageChannels.observeUserRequestToSpeakState(component1.getId(), component4.h());
} else {
meUser2 = meUser;
}
observable7 = new j(StageRequestToSpeakState.NONE);
if (component4 == null || (r9 = this.$storeStageChannels.observeMyRoles(component4.h())) == null) {
Observable<StageRoles> observable10 = new j<>(null);
}
if (l != null) {
l.longValue();
observable8 = GuildCommunicationDisabledGuildsFeatureFlag.Companion.getINSTANCE().observeCanGuildAccessCommunicationDisabled(l.longValue());
}
observable8 = new j(Boolean.FALSE);
m.checkNotNullExpressionValue(observable4, "computedMembersObservable");
m.checkNotNullExpressionValue(observable2, "guildRolesObservable");
m.checkNotNullExpressionValue(jVar, "mySelectedVoiceChannelVoiceStatesObservable");
m.checkNotNullExpressionValue(jVar2, "currentChannelVoiceStatesObservable");
Observable<StoreMediaSettings.VoiceConfiguration> voiceConfig = this.$storeMediaSettings.getVoiceConfig();
m.checkNotNullExpressionValue(observable3, "guildsObservable");
m.checkNotNullExpressionValue(observable5, "permissionsObservable");
Observable<UserProfile> observeUserProfile = this.$storeUserProfile.observeUserProfile(component1.getId());
Observable<Integer> observe3 = this.$storeUserRelationships.observe(component1.getId());
Observable<StoreUserNotes.UserNoteState> observeUserNote = this.$storeUserNotes.observeUserNote(component1.getId());
m.checkNotNullExpressionValue(observable6, "userStageRolesObservable");
m.checkNotNullExpressionValue(observable7, "userStageRequestToSpeakStateObservable");
m.checkNotNullExpressionValue(observable10, "myStageRolesObservable");
m.checkNotNullExpressionValue(observable8, "canDisableCommunicationObservable");
return ObservableCombineLatestOverloadsKt.combineLatest(observable4, observable2, jVar, jVar2, voiceConfig, observable9, observable3, observable5, forUser, observeUserProfile, observe3, observeUserNote, observable6, observable7, observable10, observable8, new AnonymousClass2(component1, meUser2, channel, component4));
}
}
observable2 = new j(h0.emptyMap());
if (component4 != null) {
}
if (component3 != null) {
}
Observable<ModelRichPresence> observable9 = ModelRichPresence.Companion.get(component1.getId(), this.$storeUserPresence);
if (l != null) {
}
observable3 = new j<>(null);
if (component3 != null) {
}
observable5 = new j<>(null);
Observable<StreamContext> forUser = this.$streamContextService.getForUser(component1.getId(), true);
if (component4 != null) {
}
observable6 = new j<>(null);
if (component4 != null) {
}
observable7 = new j(StageRequestToSpeakState.NONE);
Observable<StageRoles> observable10 = new j<>(null);
if (l != null) {
}
observable8 = new j(Boolean.FALSE);
m.checkNotNullExpressionValue(observable4, "computedMembersObservable");
m.checkNotNullExpressionValue(observable2, "guildRolesObservable");
m.checkNotNullExpressionValue(jVar, "mySelectedVoiceChannelVoiceStatesObservable");
m.checkNotNullExpressionValue(jVar2, "currentChannelVoiceStatesObservable");
Observable<StoreMediaSettings.VoiceConfiguration> voiceConfig = this.$storeMediaSettings.getVoiceConfig();
m.checkNotNullExpressionValue(observable3, "guildsObservable");
m.checkNotNullExpressionValue(observable5, "permissionsObservable");
Observable<UserProfile> observeUserProfile = this.$storeUserProfile.observeUserProfile(component1.getId());
Observable<Integer> observe3 = this.$storeUserRelationships.observe(component1.getId());
Observable<StoreUserNotes.UserNoteState> observeUserNote = this.$storeUserNotes.observeUserNote(component1.getId());
m.checkNotNullExpressionValue(observable6, "userStageRolesObservable");
m.checkNotNullExpressionValue(observable7, "userStageRequestToSpeakStateObservable");
m.checkNotNullExpressionValue(observable10, "myStageRolesObservable");
m.checkNotNullExpressionValue(observable8, "canDisableCommunicationObservable");
return ObservableCombineLatestOverloadsKt.combineLatest(observable4, observable2, jVar, jVar2, voiceConfig, observable9, observable3, observable5, forUser, observeUserProfile, observe3, observeUserNote, observable6, observable7, observable10, observable8, new AnonymousClass2(component1, meUser2, channel, component4));
}
}
observable = new j(h0.emptyMap());
if (l != null) {
}
observable2 = new j(h0.emptyMap());
if (component4 != null) {
}
if (component3 != null) {
}
Observable<ModelRichPresence> observable9 = ModelRichPresence.Companion.get(component1.getId(), this.$storeUserPresence);
if (l != null) {
}
observable3 = new j<>(null);
if (component3 != null) {
}
observable5 = new j<>(null);
Observable<StreamContext> forUser = this.$streamContextService.getForUser(component1.getId(), true);
if (component4 != null) {
}
observable6 = new j<>(null);
if (component4 != null) {
}
observable7 = new j(StageRequestToSpeakState.NONE);
Observable<StageRoles> observable10 = new j<>(null);
if (l != null) {
}
observable8 = new j(Boolean.FALSE);
m.checkNotNullExpressionValue(observable4, "computedMembersObservable");
m.checkNotNullExpressionValue(observable2, "guildRolesObservable");
m.checkNotNullExpressionValue(jVar, "mySelectedVoiceChannelVoiceStatesObservable");
m.checkNotNullExpressionValue(jVar2, "currentChannelVoiceStatesObservable");
Observable<StoreMediaSettings.VoiceConfiguration> voiceConfig = this.$storeMediaSettings.getVoiceConfig();
m.checkNotNullExpressionValue(observable3, "guildsObservable");
m.checkNotNullExpressionValue(observable5, "permissionsObservable");
Observable<UserProfile> observeUserProfile = this.$storeUserProfile.observeUserProfile(component1.getId());
Observable<Integer> observe3 = this.$storeUserRelationships.observe(component1.getId());
Observable<StoreUserNotes.UserNoteState> observeUserNote = this.$storeUserNotes.observeUserNote(component1.getId());
m.checkNotNullExpressionValue(observable6, "userStageRolesObservable");
m.checkNotNullExpressionValue(observable7, "userStageRequestToSpeakStateObservable");
m.checkNotNullExpressionValue(observable10, "myStageRolesObservable");
m.checkNotNullExpressionValue(observable8, "canDisableCommunicationObservable");
return ObservableCombineLatestOverloadsKt.combineLatest(observable4, observable2, jVar, jVar2, voiceConfig, observable9, observable3, observable5, forUser, observeUserProfile, observe3, observeUserNote, observable6, observable7, observable10, observable8, new AnonymousClass2(component1, meUser2, channel, component4));
}
}