2020-05-17 12:40:10 +00:00
|
|
|
.class public final Lcom/discord/restapi/SpotifyTokenInterceptor;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "RestInterceptors.kt"
|
|
|
|
|
|
|
|
# interfaces
|
|
|
|
.implements Lokhttp3/Interceptor;
|
|
|
|
|
|
|
|
|
|
|
|
# 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/SpotifyTokenInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
const-string p1, "headersProvider"
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {p1}, Li0/n/c/h;->c(Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
const/4 p1, 0x0
|
|
|
|
|
|
|
|
throw p1
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
|
2020-07-08 16:44:49 +00:00
|
|
|
.locals 9
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
const/4 v0, 0x0
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
if-eqz p1, :cond_4
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->r()Lm0/a0;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
move-result-object v1
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
if-eqz v1, :cond_3
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
new-instance v2, Ljava/util/LinkedHashMap;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-direct {v2}, Ljava/util/LinkedHashMap;-><init>()V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v4, v1, Lm0/a0;->b:Lm0/w;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v5, v1, Lm0/a0;->c:Ljava/lang/String;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v7, v1, Lm0/a0;->e:Lokhttp3/RequestBody;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v2, v1, Lm0/a0;->f:Ljava/util/Map;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
invoke-interface {v2}, Ljava/util/Map;->isEmpty()Z
|
|
|
|
|
|
|
|
move-result v2
|
|
|
|
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
|
|
|
|
new-instance v2, Ljava/util/LinkedHashMap;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-direct {v2}, Ljava/util/LinkedHashMap;-><init>()V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v2, v1, Lm0/a0;->f:Ljava/util/Map;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {v2}, Li0/i/t;->toMutableMap(Ljava/util/Map;)Ljava/util/Map;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object v2
|
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
:goto_0
|
2020-07-14 22:43:59 +00:00
|
|
|
iget-object v1, v1, Lm0/a0;->d:Lokhttp3/Headers;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-virtual {v1}, Lokhttp3/Headers;->e()Lokhttp3/Headers$a;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
const-string v3, "Bearer "
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {v3}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
move-result-object v3
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
iget-object v6, p0, Lcom/discord/restapi/SpotifyTokenInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
|
|
|
|
invoke-interface {v6}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getSpotifyToken()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v6
|
|
|
|
|
|
|
|
invoke-virtual {v3, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v3
|
|
|
|
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
|
|
|
|
const-string v0, "Authorization"
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-virtual {v1, v0, v3}, Lokhttp3/Headers$a;->a(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$a;
|
|
|
|
|
|
|
|
if-eqz v4, :cond_1
|
|
|
|
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Headers$a;->c()Lokhttp3/Headers;
|
|
|
|
|
|
|
|
move-result-object v6
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {v2}, Lm0/g0/b;->F(Ljava/util/Map;)Ljava/util/Map;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
move-result-object v8
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
new-instance v0, Lm0/a0;
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
move-object v3, v0
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-direct/range {v3 .. v8}, Lm0/a0;-><init>(Lm0/w;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V
|
2020-07-08 16:44:49 +00:00
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-interface {p1, v0}, Lokhttp3/Interceptor$Chain;->d(Lm0/a0;)Lokhttp3/Response;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
return-object p1
|
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
:cond_1
|
|
|
|
new-instance p1, Ljava/lang/IllegalStateException;
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
const-string v0, "url == null"
|
2020-05-17 12:40:10 +00:00
|
|
|
|
2020-07-08 16:44:49 +00:00
|
|
|
invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
2020-05-17 12:40:10 +00:00
|
|
|
|
|
|
|
throw p1
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
:cond_2
|
|
|
|
const-string p1, "value"
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {p1}, Li0/n/c/h;->c(Ljava/lang/String;)V
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
throw v0
|
|
|
|
|
|
|
|
:cond_3
|
|
|
|
throw v0
|
|
|
|
|
|
|
|
:cond_4
|
|
|
|
const-string p1, "chain"
|
|
|
|
|
2020-07-14 22:43:59 +00:00
|
|
|
invoke-static {p1}, Li0/n/c/h;->c(Ljava/lang/String;)V
|
2020-07-08 16:44:49 +00:00
|
|
|
|
|
|
|
throw v0
|
2020-05-17 12:40:10 +00:00
|
|
|
.end method
|