125 lines
3.5 KiB
Smali
125 lines
3.5 KiB
Smali
.class public final Lcom/discord/restapi/RequiredHeadersInterceptor;
|
|
.super Ljava/lang/Object;
|
|
.source "RestInterceptors.kt"
|
|
|
|
# interfaces
|
|
.implements Lokhttp3/Interceptor;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public final headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;)V
|
|
.locals 0
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/restapi/RequiredHeadersInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "headersProvider"
|
|
|
|
invoke-static {p1}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
|
|
.locals 6
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
iget-object v0, p0, Lcom/discord/restapi/RequiredHeadersInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
invoke-interface {v0}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getAuthToken()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lcom/discord/restapi/RequiredHeadersInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
invoke-interface {v1}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getFingerprint()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
iget-object v2, p0, Lcom/discord/restapi/RequiredHeadersInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
invoke-interface {v2}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getLocale()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
iget-object v3, p0, Lcom/discord/restapi/RequiredHeadersInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
invoke-interface {v3}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getUserAgent()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->e()Lc0/y;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Lc0/y;->c()Lc0/y$a;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "User-Agent"
|
|
|
|
invoke-virtual {v4, v5, v3}, Lc0/y$a;->a(Ljava/lang/String;Ljava/lang/String;)Lc0/y$a;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const-string v3, "Authorization"
|
|
|
|
invoke-virtual {v4, v3, v0}, Lc0/y$a;->a(Ljava/lang/String;Ljava/lang/String;)Lc0/y$a;
|
|
|
|
:cond_0
|
|
if-eqz v1, :cond_1
|
|
|
|
const-string v0, "X-Fingerprint"
|
|
|
|
invoke-virtual {v4, v0, v1}, Lc0/y$a;->a(Ljava/lang/String;Ljava/lang/String;)Lc0/y$a;
|
|
|
|
:cond_1
|
|
if-eqz v2, :cond_2
|
|
|
|
const-string v0, "Accept-Language"
|
|
|
|
invoke-virtual {v4, v0, v2}, Lc0/y$a;->a(Ljava/lang/String;Ljava/lang/String;)Lc0/y$a;
|
|
|
|
:cond_2
|
|
invoke-virtual {v4}, Lc0/y$a;->a()Lc0/y;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {p1, v0}, Lokhttp3/Interceptor$Chain;->a(Lc0/y;)Lokhttp3/Response;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_3
|
|
const-string p1, "chain"
|
|
|
|
invoke-static {p1}, Ly/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|