244 lines
6.6 KiB
Smali
244 lines
6.6 KiB
Smali
.class public final Lcom/discord/gateway/rest/RestClient;
|
|
.super Ljava/lang/Object;
|
|
.source "RestClient.kt"
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Lcom/discord/gateway/rest/RestClient;
|
|
|
|
.field public static restApi:Lcom/discord/gateway/rest/RestApi;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Lcom/discord/gateway/rest/RestClient;
|
|
|
|
invoke-direct {v0}, Lcom/discord/gateway/rest/RestClient;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/gateway/rest/RestClient;->INSTANCE:Lcom/discord/gateway/rest/RestClient;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getGateway()Lrx/Observable;
|
|
.locals 8
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lrx/Observable<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Lcom/discord/restapi/utils/RetryWithDelay;->INSTANCE:Lcom/discord/restapi/utils/RetryWithDelay;
|
|
|
|
sget-object v1, Lcom/discord/gateway/rest/RestClient;->restApi:Lcom/discord/gateway/rest/RestApi;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {v1}, Lcom/discord/gateway/rest/RestApi;->getGateway()Lrx/Observable;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {}, Le0/q/a;->d()Lrx/Scheduler;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Lrx/Observable;->b(Lrx/Scheduler;)Lrx/Observable;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "restApi\n .getGa\u2026scribeOn(Schedulers.io())"
|
|
|
|
invoke-static {v1, v2}, Lw/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x7
|
|
|
|
const/4 v7, 0x0
|
|
|
|
invoke-static/range {v0 .. v7}, Lcom/discord/restapi/utils/RetryWithDelay;->restRetry$default(Lcom/discord/restapi/utils/RetryWithDelay;Lrx/Observable;JLjava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/gateway/rest/RestClient$getGateway$1;->INSTANCE:Lcom/discord/gateway/rest/RestClient$getGateway$1;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->f(Le0/l/i;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "restApi\n .getGa\u2026 .map { it.url }"
|
|
|
|
invoke-static {v0, v1}, Lw/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const-string v0, "restApi"
|
|
|
|
invoke-static {v0}, Lw/u/b/j;->throwUninitializedPropertyAccessException(Ljava/lang/String;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final init(Lcom/discord/gateway/rest/RestConfig;Landroid/content/Context;)V
|
|
.locals 13
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
invoke-virtual {p1}, Lcom/discord/gateway/rest/RestConfig;->component1()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1}, Lcom/discord/gateway/rest/RestConfig;->component2()Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1}, Lcom/discord/gateway/rest/RestConfig;->component3()Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
new-instance v2, Lcom/discord/restapi/RequiredHeadersInterceptor;
|
|
|
|
invoke-direct {v2, v1}, Lcom/discord/restapi/RequiredHeadersInterceptor;-><init>(Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;)V
|
|
|
|
new-instance v1, Lcom/franmontiel/persistentcookiejar/PersistentCookieJar;
|
|
|
|
new-instance v3, Lcom/franmontiel/persistentcookiejar/cache/SetCookieCache;
|
|
|
|
invoke-direct {v3}, Lcom/franmontiel/persistentcookiejar/cache/SetCookieCache;-><init>()V
|
|
|
|
new-instance v4, Lcom/franmontiel/persistentcookiejar/persistence/SharedPrefsCookiePersistor;
|
|
|
|
invoke-direct {v4, p2}, Lcom/franmontiel/persistentcookiejar/persistence/SharedPrefsCookiePersistor;-><init>(Landroid/content/Context;)V
|
|
|
|
invoke-direct {v1, v3, v4}, Lcom/franmontiel/persistentcookiejar/PersistentCookieJar;-><init>(Lcom/franmontiel/persistentcookiejar/cache/CookieCache;Lcom/franmontiel/persistentcookiejar/persistence/CookiePersistor;)V
|
|
|
|
const/4 p2, 0x2
|
|
|
|
new-instance v3, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v3, p2}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
const/4 p2, 0x0
|
|
|
|
new-array p2, p2, [Lokhttp3/Interceptor;
|
|
|
|
invoke-interface {p1, p2}, Ljava/util/Collection;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
array-length p2, p1
|
|
|
|
if-lez p2, :cond_0
|
|
|
|
invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
|
|
|
|
move-result p2
|
|
|
|
array-length v2, p1
|
|
|
|
add-int/2addr p2, v2
|
|
|
|
invoke-virtual {v3, p2}, Ljava/util/ArrayList;->ensureCapacity(I)V
|
|
|
|
invoke-static {v3, p1}, Ljava/util/Collections;->addAll(Ljava/util/Collection;[Ljava/lang/Object;)Z
|
|
|
|
:cond_0
|
|
invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
|
|
|
|
move-result p1
|
|
|
|
new-array p1, p1, [Lokhttp3/Interceptor;
|
|
|
|
invoke-virtual {v3, p1}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, [Lokhttp3/Interceptor;
|
|
|
|
invoke-static {p1}, Le/k/a/c/e/p/g;->listOf([Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v7
|
|
|
|
new-instance v2, Lcom/discord/restapi/RestAPIBuilder;
|
|
|
|
invoke-direct {v2, v0, v1}, Lcom/discord/restapi/RestAPIBuilder;-><init>(Ljava/lang/String;La0/n;)V
|
|
|
|
const-class v3, Lcom/discord/gateway/rest/RestApi;
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const-wide/16 v5, 0x0
|
|
|
|
const/4 v8, 0x0
|
|
|
|
const/4 v9, 0x0
|
|
|
|
const/4 v10, 0x0
|
|
|
|
const/16 v11, 0x76
|
|
|
|
const/4 v12, 0x0
|
|
|
|
invoke-static/range {v2 .. v12}, Lcom/discord/restapi/RestAPIBuilder;->build$default(Lcom/discord/restapi/RestAPIBuilder;Ljava/lang/Class;ZJLjava/util/List;Ljava/lang/String;ZLjava/lang/String;ILjava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Lcom/discord/gateway/rest/RestApi;
|
|
|
|
sput-object p1, Lcom/discord/gateway/rest/RestClient;->restApi:Lcom/discord/gateway/rest/RestApi;
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
new-instance p1, Lw/l;
|
|
|
|
const-string p2, "null cannot be cast to non-null type kotlin.Array<T>"
|
|
|
|
invoke-direct {p1, p2}, Lw/l;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
:cond_2
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lw/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_3
|
|
const-string p1, "restConfig"
|
|
|
|
invoke-static {p1}, Lw/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|