discord-jadx/app/src/main/java/b/a/q/s.java

72 lines
2.8 KiB
Java
Raw Normal View History

2021-12-17 22:01:24 +00:00
package b.a.q;
2021-12-17 22:01:24 +00:00
import b.a.q.n0.a;
import com.discord.rtcconnection.RtcConnection;
2021-11-01 07:19:03 +00:00
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 */
2021-11-01 07:19:03 +00:00
public Unit mo1invoke() {
2021-12-17 22:01:24 +00:00
w wVar = this.this$0.j;
RtcConnection rtcConnection = wVar.this$0;
String str = wVar.$endpoint;
String str2 = wVar.$token;
SSLSocketFactory sSLSocketFactory = wVar.$sslSocketFactory;
2021-12-17 22:01:24 +00:00
rtcConnection.q.succeed();
String str3 = sSLSocketFactory != null ? "wss" : "ws";
if (str == null || str.length() == 0) {
2021-12-17 22:01:24 +00:00
a aVar = rtcConnection.w;
if (aVar != null) {
2021-09-14 16:14:33 +00:00
aVar.c();
}
2021-08-18 07:29:27 +00:00
rtcConnection.u(RtcConnection.State.b.a);
} else {
String replace$default = t.replace$default(str, ".gg", ".media", false, 4, (Object) null);
2021-12-17 22:01:24 +00:00
String w = b.d.b.a.a.w(str3, "://", replace$default);
2021-11-05 21:05:33 +00:00
String replace$default2 = t.replace$default(w, ":80", ":443", false, 4, (Object) null);
2021-12-17 22:01:24 +00:00
a aVar2 = rtcConnection.w;
if (aVar2 != null) {
2021-09-14 16:14:33 +00:00
aVar2.c();
}
2021-12-17 22:01:24 +00:00
if (rtcConnection.u) {
2021-08-18 07:29:27 +00:00
RtcConnection.j(rtcConnection, false, "Connect called on destroyed instance.", null, false, 4);
} else if (str2 == null) {
2021-08-18 07:29:27 +00:00
RtcConnection.j(rtcConnection, false, "Connect called with no token.", null, false, 12);
} else {
2021-08-18 07:29:27 +00:00
rtcConnection.r("connecting via endpoint: " + replace$default + " token: " + str2);
try {
2021-11-05 21:05:33 +00:00
URI uri = new URI(w);
2022-01-17 16:29:36 +00:00
rtcConnection.f2742y = uri.getHost();
rtcConnection.f2743z = Integer.valueOf(uri.getPort());
} catch (Exception e) {
2021-12-17 22:01:24 +00:00
rtcConnection.V.e(rtcConnection.l, "Failed to parse RTC endpoint", e, g0.mapOf(d0.o.to("endpoint", replace$default)));
}
2021-12-17 22:01:24 +00:00
a aVar3 = new a(replace$default2, str2, sSLSocketFactory, rtcConnection.V, rtcConnection.U.c(), rtcConnection.W, rtcConnection.l);
h0 h0Var = rtcConnection.M;
m.checkNotNullParameter(h0Var, "listener");
2021-12-17 22:01:24 +00:00
aVar3.q.add(h0Var);
2021-09-14 16:14:33 +00:00
aVar3.d();
2021-12-17 22:01:24 +00:00
rtcConnection.w = aVar3;
}
}
return Unit.a;
}
}