package com.discord.widgets.stage; import android.content.Context; import androidx.fragment.app.FragmentManager; import c.d.b.a.a; import c0.f0.q; import c0.t.h0; import c0.t.u; import c0.z.d.m; import c0.z.d.o; 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 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 */ public final class StageChannelJoinHelper$connectToStage$2 extends o implements Function0 { 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 */ public static final class AnonymousClass1 extends o implements Function1 { public final /* synthetic */ StageChannelJoinHelper$connectToStage$2 this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(StageChannelJoinHelper$connectToStage$2 stageChannelJoinHelper$connectToStage$2) { super(1); this.this$0 = stageChannelJoinHelper$connectToStage$2; } /* 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(StoreVoiceChannelSelected.JoinVoiceChannelResult joinVoiceChannelResult) { invoke(joinVoiceChannelResult); return Unit.a; } public final void invoke(StoreVoiceChannelSelected.JoinVoiceChannelResult joinVoiceChannelResult) { m.checkNotNullParameter(joinVoiceChannelResult, "it"); StageChannelJoinHelper$connectToStage$2 stageChannelJoinHelper$connectToStage$2 = this.this$0; 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); } this.this$0.$onCompleted.mo17invoke(); } } /* JADX INFO: 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 WARNING: Code restructure failed: missing block: B:20:0x007b, code lost: if (r13.$voiceChannelSelectedStore.getSelectedVoiceChannelId() != r13.$channelId) goto L_0x007f; */ @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public final void mo17invoke() { Object obj; boolean z2; Channel channel = this.$channelsStore.getChannel(this.$channelId); if (channel != null) { Map map = (Map) a.s0(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 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.mo17invoke(); return; } ObservableExtensionsKt.appSubscribe$default(this.$voiceChannelSelectedStore.selectVoiceChannel(this.$channelId), StageChannelJoinHelper.INSTANCE.getClass(), (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null); } } }