discord-jadx/app/src/main/java/com/discord/widgets/stage/StageChannelJoinHelper$connectToStage$2.java
2022-03-21 18:52:30 +00:00

133 lines
6.5 KiB
Java

package com.discord.widgets.stage;
import android.content.Context;
import androidx.fragment.app.FragmentManager;
import b.d.b.a.a;
import com.discord.api.channel.Channel;
import com.discord.app.AppTransitionActivity;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreUserRelationships;
import com.discord.stores.StoreVoiceChannelSelected;
import com.discord.stores.StoreVoiceStates;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.widgets.stage.sheet.WidgetStageAudienceBlockedBottomSheet;
import com.discord.widgets.voice.fullscreen.WidgetCallFullscreen;
import d0.f0.q;
import d0.t.h0;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Iterator;
import java.util.Map;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.sequences.Sequence;
/* compiled from: StageChannelJoinHelper.kt */
/* loaded from: classes2.dex */
public final class StageChannelJoinHelper$connectToStage$2 extends o implements Function0<Unit> {
public final /* synthetic */ long $channelId;
public final /* synthetic */ StoreChannels $channelsStore;
public final /* synthetic */ Context $context;
public final /* synthetic */ FragmentManager $fragmentManager;
public final /* synthetic */ boolean $launchFullscreen;
public final /* synthetic */ Function0 $onCompleted;
public final /* synthetic */ StoreUserRelationships $userRelationshipsStore;
public final /* synthetic */ StoreVoiceChannelSelected $voiceChannelSelectedStore;
public final /* synthetic */ StoreVoiceStates $voiceStatesStore;
public final /* synthetic */ boolean $warnedAboutBlockedUsers;
/* compiled from: StageChannelJoinHelper.kt */
/* renamed from: com.discord.widgets.stage.StageChannelJoinHelper$connectToStage$2$1 reason: invalid class name */
/* loaded from: classes2.dex */
public static final class AnonymousClass1 extends o implements Function1<StoreVoiceChannelSelected.JoinVoiceChannelResult, Unit> {
public AnonymousClass1() {
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(StoreVoiceChannelSelected.JoinVoiceChannelResult joinVoiceChannelResult) {
invoke2(joinVoiceChannelResult);
return Unit.a;
}
/* renamed from: invoke reason: avoid collision after fix types in other method */
public final void invoke2(StoreVoiceChannelSelected.JoinVoiceChannelResult joinVoiceChannelResult) {
m.checkNotNullParameter(joinVoiceChannelResult, "it");
StageChannelJoinHelper$connectToStage$2 stageChannelJoinHelper$connectToStage$2 = StageChannelJoinHelper$connectToStage$2.this;
if (stageChannelJoinHelper$connectToStage$2.$launchFullscreen) {
WidgetCallFullscreen.Companion.launch$default(WidgetCallFullscreen.Companion, stageChannelJoinHelper$connectToStage$2.$context, stageChannelJoinHelper$connectToStage$2.$channelId, true, null, AppTransitionActivity.Transition.TYPE_SLIDE_VERTICAL_WITH_FADE, 8, null);
}
StageChannelJoinHelper$connectToStage$2.this.$onCompleted.invoke();
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public StageChannelJoinHelper$connectToStage$2(StoreChannels storeChannels, long j, StoreVoiceStates storeVoiceStates, StoreUserRelationships storeUserRelationships, boolean z2, StoreVoiceChannelSelected storeVoiceChannelSelected, FragmentManager fragmentManager, boolean z3, Function0 function0, Context context) {
super(0);
this.$channelsStore = storeChannels;
this.$channelId = j;
this.$voiceStatesStore = storeVoiceStates;
this.$userRelationshipsStore = storeUserRelationships;
this.$warnedAboutBlockedUsers = z2;
this.$voiceChannelSelectedStore = storeVoiceChannelSelected;
this.$fragmentManager = fragmentManager;
this.$launchFullscreen = z3;
this.$onCompleted = function0;
this.$context = context;
}
/* JADX WARN: Code restructure failed: missing block: B:22:0x007b, code lost:
if (r13.$voiceChannelSelectedStore.getSelectedVoiceChannelId() != r13.$channelId) goto L_0x007f;
*/
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke reason: avoid collision after fix types in other method */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final void invoke2() {
Object obj;
boolean z2;
Channel channel = this.$channelsStore.getChannel(this.$channelId);
if (channel != null) {
Map map = (Map) a.u0(channel, this.$voiceStatesStore.get());
if (map == null) {
map = h0.emptyMap();
}
Sequence map2 = q.map(q.filter(u.asSequence(map.values()), new StageChannelJoinHelper$connectToStage$2$channelVoiceStateUserIds$1(channel)), StageChannelJoinHelper$connectToStage$2$channelVoiceStateUserIds$2.INSTANCE);
Map<Long, Integer> relationships = this.$userRelationshipsStore.getRelationships();
boolean z3 = true;
if (!this.$warnedAboutBlockedUsers) {
Iterator it = map2.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
Integer num = relationships.get(Long.valueOf(((Number) obj).longValue()));
if (num != null && num.intValue() == 2) {
z2 = true;
continue;
} else {
z2 = false;
continue;
}
if (z2) {
break;
}
}
if (obj != null) {
}
}
z3 = false;
if (z3) {
WidgetStageAudienceBlockedBottomSheet.Companion.show(this.$fragmentManager, this.$channelId, this.$launchFullscreen);
this.$onCompleted.invoke();
return;
}
ObservableExtensionsKt.appSubscribe$default(this.$voiceChannelSelectedStore.selectVoiceChannel(this.$channelId), StageChannelJoinHelper.INSTANCE.getClass(), (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(), 62, (Object) null);
}
}
}