apkfuckery/com.discord/smali/f/a/h/d.smali
2020-09-29 21:44:44 +00:00

317 lines
8.6 KiB
Smali

.class public final Lf/a/h/d;
.super Lb0/n/c/k;
.source "RtcConnection.kt"
# interfaces
.implements Lkotlin/jvm/functions/Function0;
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Lb0/n/c/k;",
"Lkotlin/jvm/functions/Function0<",
"Lkotlin/Unit;",
">;"
}
.end annotation
# instance fields
.field public final synthetic this$0:Lf/a/h/e;
# direct methods
.method public constructor <init>(Lf/a/h/e;)V
.locals 0
iput-object p1, p0, Lf/a/h/d;->this$0:Lf/a/h/e;
const/4 p1, 0x0
invoke-direct {p0, p1}, Lb0/n/c/k;-><init>(I)V
return-void
.end method
# virtual methods
.method public invoke()Ljava/lang/Object;
.locals 17
move-object/from16 v1, p0
iget-object v0, v1, Lf/a/h/d;->this$0:Lf/a/h/e;
iget-object v0, v0, Lf/a/h/e;->d:Lf/a/h/h;
iget-object v2, v0, Lf/a/h/h;->this$0:Lcom/discord/rtcconnection/RtcConnection;
iget-object v3, v0, Lf/a/h/h;->$endpoint:Ljava/lang/String;
iget-object v6, v0, Lf/a/h/h;->$token:Ljava/lang/String;
iget-object v7, v0, Lf/a/h/h;->$sslSocketFactory:Ljavax/net/ssl/SSLSocketFactory;
iget-object v0, v2, Lcom/discord/rtcconnection/RtcConnection;->e:Lcom/discord/utilities/networking/Backoff;
invoke-virtual {v0}, Lcom/discord/utilities/networking/Backoff;->succeed()V
if-eqz v7, :cond_0
const-string/jumbo v0, "wss"
goto :goto_0
:cond_0
const-string/jumbo v0, "ws"
:goto_0
const/4 v4, 0x0
const/4 v5, 0x4
const-string v8, ".gg"
const-string v9, ".media"
invoke-static {v3, v8, v9, v4, v5}, Lb0/t/k;->replace$default(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)Ljava/lang/String;
move-result-object v8
const-string v9, "://"
invoke-static {v0, v9, v8}, Lf/e/c/a/a;->r(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
const-string v9, ":80"
const-string v10, ":443"
invoke-static {v0, v9, v10, v4, v5}, Lb0/t/k;->replace$default(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)Ljava/lang/String;
move-result-object v5
iget-object v9, v2, Lcom/discord/rtcconnection/RtcConnection;->j:Lf/a/h/t/a;
const/4 v10, 0x0
if-eqz v9, :cond_1
iget-object v9, v9, Lf/a/h/t/a;->r:Ljava/lang/String;
goto :goto_1
:cond_1
move-object v9, v10
:goto_1
invoke-static {v9, v5}, Lb0/n/c/j;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v9
if-eqz v9, :cond_3
iget-object v9, v2, Lcom/discord/rtcconnection/RtcConnection;->j:Lf/a/h/t/a;
if-eqz v9, :cond_2
iget-object v9, v9, Lf/a/h/t/a;->s:Ljava/lang/String;
goto :goto_2
:cond_2
move-object v9, v10
:goto_2
invoke-static {v9, v6}, Lb0/n/c/j;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v9
if-eqz v9, :cond_3
iget-object v9, v2, Lcom/discord/rtcconnection/RtcConnection;->g:Lcom/discord/rtcconnection/RtcConnection$State;
instance-of v9, v9, Lcom/discord/rtcconnection/RtcConnection$State$d;
if-nez v9, :cond_3
iget-object v11, v2, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;
iget-object v12, v2, Lcom/discord/rtcconnection/RtcConnection;->b:Ljava/lang/String;
const/4 v14, 0x0
const/4 v15, 0x4
const/16 v16, 0x0
const-string v13, "Already connecting, no need to continue."
invoke-static/range {v11 .. v16}, Lcom/discord/utilities/logging/Logger;->w$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
goto/16 :goto_4
:cond_3
iget-object v9, v2, Lcom/discord/rtcconnection/RtcConnection;->j:Lf/a/h/t/a;
const/4 v11, 0x1
if-eqz v9, :cond_4
iget-object v12, v9, Lf/a/h/t/a;->p:Ljava/util/List;
invoke-interface {v12}, Ljava/util/List;->clear()V
sget-object v12, Lf/a/h/t/b;->d:Lf/a/h/t/b;
invoke-virtual {v9, v12}, Lf/a/h/t/a;->b(Lkotlin/jvm/functions/Function1;)V
iput-boolean v11, v9, Lf/a/h/t/a;->q:Z
:cond_4
iget-boolean v9, v2, Lcom/discord/rtcconnection/RtcConnection;->h:Z
if-eqz v9, :cond_5
const-string v0, "Connect called on destroyed instance."
invoke-virtual {v2, v4, v0, v10}, Lcom/discord/rtcconnection/RtcConnection;->d(ZLjava/lang/String;Ljava/lang/Throwable;)V
goto/16 :goto_4
:cond_5
if-nez v6, :cond_6
const-string v0, "Connect called with no token."
invoke-virtual {v2, v4, v0, v10}, Lcom/discord/rtcconnection/RtcConnection;->d(ZLjava/lang/String;Ljava/lang/Throwable;)V
goto/16 :goto_4
:cond_6
iget-object v9, v2, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;
new-instance v10, Ljava/lang/StringBuilder;
invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V
const-string v11, "connecting via endpoint: "
invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v10, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v11, " token: "
invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v10, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v10
iget-object v11, v2, Lcom/discord/rtcconnection/RtcConnection;->b:Ljava/lang/String;
invoke-virtual {v9, v10, v11}, Lcom/discord/utilities/logging/Logger;->recordBreadcrumb(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v3}, Ljava/lang/String;->length()I
move-result v3
if-nez v3, :cond_7
const/4 v4, 0x1
:cond_7
if-eqz v4, :cond_8
sget-object v0, Lcom/discord/rtcconnection/RtcConnection$State$b;->a:Lcom/discord/rtcconnection/RtcConnection$State$b;
invoke-virtual {v2, v0}, Lcom/discord/rtcconnection/RtcConnection;->o(Lcom/discord/rtcconnection/RtcConnection$State;)V
goto :goto_4
:cond_8
:try_start_0
new-instance v3, Ljava/net/URI;
invoke-direct {v3, v0}, Ljava/net/URI;-><init>(Ljava/lang/String;)V
invoke-virtual {v3}, Ljava/net/URI;->getHost()Ljava/lang/String;
move-result-object v0
iput-object v0, v2, Lcom/discord/rtcconnection/RtcConnection;->l:Ljava/lang/String;
invoke-virtual {v3}, Ljava/net/URI;->getPort()I
move-result v0
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
iput-object v0, v2, Lcom/discord/rtcconnection/RtcConnection;->m:Ljava/lang/Integer;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_3
:catch_0
move-exception v0
iget-object v3, v2, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;
new-instance v4, Lkotlin/Pair;
const-string v9, "endpoint"
invoke-direct {v4, v9, v8}, Lkotlin/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V
invoke-static {v4}, Lf/h/a/f/e/n/f;->mapOf(Lkotlin/Pair;)Ljava/util/Map;
move-result-object v4
const-string v8, "Failed to parse RTC endpoint"
invoke-virtual {v3, v8, v0, v4}, Lcom/discord/utilities/logging/Logger;->e(Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;)V
:goto_3
new-instance v0, Lf/a/h/t/a;
iget-object v8, v2, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;
iget-object v3, v2, Lcom/discord/rtcconnection/RtcConnection;->B:Lcom/discord/rtcconnection/mediaengine/MediaEngine;
invoke-interface {v3}, Lcom/discord/rtcconnection/mediaengine/MediaEngine;->l()Ljava/util/concurrent/ExecutorService;
move-result-object v9
iget-object v10, v2, Lcom/discord/rtcconnection/RtcConnection;->D:Lcom/discord/utilities/time/Clock;
move-object v4, v0
invoke-direct/range {v4 .. v10}, Lf/a/h/t/a;-><init>(Ljava/lang/String;Ljava/lang/String;Ljavax/net/ssl/SSLSocketFactory;Lcom/discord/utilities/logging/Logger;Ljava/util/concurrent/ExecutorService;Lcom/discord/utilities/time/Clock;)V
iget-object v3, v2, Lcom/discord/rtcconnection/RtcConnection;->t:Lf/a/h/q;
const-string v4, "listener"
invoke-static {v3, v4}, Lb0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
iget-object v4, v0, Lf/a/h/t/a;->p:Ljava/util/List;
invoke-interface {v4, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
invoke-virtual {v0}, Lf/a/h/t/a;->e()Z
iput-object v0, v2, Lcom/discord/rtcconnection/RtcConnection;->j:Lf/a/h/t/a;
:goto_4
sget-object v0, Lkotlin/Unit;->a:Lkotlin/Unit;
return-object v0
.end method