discord-jadx/app/src/main/java/com/discord/stores/StoreApplicationStreaming$c...

73 lines
4.2 KiB
Java

package com.discord.stores;
import c.d.b.a.a;
import com.discord.app.AppLog;
import com.discord.models.domain.ModelApplicationStream;
import com.discord.rtcconnection.RtcConnection;
import com.discord.stores.StoreApplicationStreaming;
import com.discord.utilities.logging.Logger;
import d0.z.d.m;
import d0.z.d.o;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: StoreApplicationStreaming.kt */
public final class StoreApplicationStreaming$createStream$1 extends o implements Function0<Unit> {
public final /* synthetic */ long $channelId;
public final /* synthetic */ Long $guildId;
public final /* synthetic */ String $preferredRegion;
public final /* synthetic */ StoreApplicationStreaming this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public StoreApplicationStreaming$createStream$1(StoreApplicationStreaming storeApplicationStreaming, long j, Long l, String str) {
super(0);
this.this$0 = storeApplicationStreaming;
this.$channelId = j;
this.$guildId = l;
this.$preferredRegion = str;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
StoreApplicationStreaming.ActiveApplicationStream.State state;
StoreApplicationStreaming.ActiveApplicationStream.State state2;
ModelApplicationStream stream;
RtcConnection rtcConnection$app_productionBetaRelease = StoreApplicationStreaming.access$getRtcConnectionStore$p(this.this$0).getRtcConnection$app_productionBetaRelease();
Object obj = null;
boolean z2 = false;
if (rtcConnection$app_productionBetaRelease == null || rtcConnection$app_productionBetaRelease.M != this.$channelId || (!m.areEqual(rtcConnection$app_productionBetaRelease.L, this.$guildId))) {
AppLog appLog = AppLog.g;
StringBuilder L = a.L("\n Failed to start stream.\n rtcConnection == null: ");
L.append(rtcConnection$app_productionBetaRelease == null);
L.append("\n rtcConnection.channelId != channelId: ");
if (rtcConnection$app_productionBetaRelease == null || rtcConnection$app_productionBetaRelease.M != this.$channelId) {
z2 = true;
}
L.append(z2);
L.append("\n rtcConnection.guildId != guildId: ");
if (rtcConnection$app_productionBetaRelease != null) {
obj = rtcConnection$app_productionBetaRelease.L;
}
L.append(!m.areEqual(obj, this.$guildId));
L.append("\n ");
Logger.e$default(appLog, "Failed to start stream.", new IllegalStateException(d0.g0.m.trimIndent(L.toString())), null, 4, null);
return;
}
long id2 = StoreApplicationStreaming.access$getUserStore$p(this.this$0).getMe().getId();
ModelApplicationStream guildStream = this.$guildId != null ? new ModelApplicationStream.GuildStream(this.$guildId.longValue(), this.$channelId, id2) : new ModelApplicationStream.CallStream(this.$channelId, id2);
StoreApplicationStreaming.ActiveApplicationStream access$getActiveApplicationStream$p = StoreApplicationStreaming.access$getActiveApplicationStream$p(this.this$0);
if (!(access$getActiveApplicationStream$p == null || (stream = access$getActiveApplicationStream$p.getStream()) == null)) {
obj = stream.getEncodedStreamKey();
}
if ((obj == guildStream.getEncodedStreamKey()) && access$getActiveApplicationStream$p != null && (state2 = access$getActiveApplicationStream$p.getState()) != null && state2.isStreamActive()) {
z2 = true;
}
if (!z2) {
if (!(access$getActiveApplicationStream$p == null || (state = access$getActiveApplicationStream$p.getState()) == null || !state.isStreamActive())) {
StoreApplicationStreaming.access$stopStreamInternal(this.this$0, access$getActiveApplicationStream$p.getStream().getEncodedStreamKey());
}
StoreApplicationStreaming.access$getStoreStream$p(this.this$0).streamCreate(guildStream.getEncodedStreamKey(), this.$preferredRegion);
}
}
}