discord-jadx/app/src/main/java/c/a/r/s.java

72 lines
2.8 KiB
Java

package c.a.r;
import c.a.r.l0.a;
import com.discord.rtcconnection.RtcConnection;
import d0.g0.t;
import d0.t.g0;
import d0.z.d.m;
import d0.z.d.o;
import java.net.URI;
import javax.net.ssl.SSLSocketFactory;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: RtcConnection.kt */
public final class s extends o implements Function0<Unit> {
public final /* synthetic */ t this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public s(t tVar) {
super(0);
this.this$0 = tVar;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public Unit mo1invoke() {
w wVar = this.this$0.i;
RtcConnection rtcConnection = wVar.this$0;
String str = wVar.$endpoint;
String str2 = wVar.$token;
SSLSocketFactory sSLSocketFactory = wVar.$sslSocketFactory;
rtcConnection.p.succeed();
String str3 = sSLSocketFactory != null ? "wss" : "ws";
if (str == null || str.length() == 0) {
a aVar = rtcConnection.v;
if (aVar != null) {
aVar.e();
}
rtcConnection.u(RtcConnection.State.b.a);
} else {
String replace$default = t.replace$default(str, ".gg", ".media", false, 4, (Object) null);
String v = c.d.b.a.a.v(str3, "://", replace$default);
String replace$default2 = t.replace$default(v, ":80", ":443", false, 4, (Object) null);
a aVar2 = rtcConnection.v;
if (aVar2 != null) {
aVar2.e();
}
if (rtcConnection.t) {
RtcConnection.j(rtcConnection, false, "Connect called on destroyed instance.", null, false, 4);
} else if (str2 == null) {
RtcConnection.j(rtcConnection, false, "Connect called with no token.", null, false, 12);
} else {
rtcConnection.r("connecting via endpoint: " + replace$default + " token: " + str2);
try {
URI uri = new URI(v);
rtcConnection.f2082x = uri.getHost();
rtcConnection.f2083y = Integer.valueOf(uri.getPort());
} catch (Exception e) {
rtcConnection.S.e(rtcConnection.k, "Failed to parse RTC endpoint", e, g0.mapOf(d0.o.to("endpoint", replace$default)));
}
a aVar3 = new a(replace$default2, str2, sSLSocketFactory, rtcConnection.S, rtcConnection.R.c(), rtcConnection.T, rtcConnection.k);
d0 d0Var = rtcConnection.J;
m.checkNotNullParameter(d0Var, "listener");
aVar3.o.add(d0Var);
aVar3.f();
rtcConnection.v = aVar3;
}
}
return Unit.a;
}
}