155 lines
4.1 KiB
Smali
155 lines
4.1 KiB
Smali
.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 1
|
|
|
|
const-string v0, "headersProvider"
|
|
|
|
invoke-static {p1, v0}, Lk0/o/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/restapi/SpotifyTokenInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
|
|
.locals 8
|
|
|
|
const-string v0, "chain"
|
|
|
|
invoke-static {p1, v0}, Lk0/o/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->p()Lo0/a0;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
const-string v1, "request"
|
|
|
|
invoke-static {v0, v1}, Lk0/o/c/i;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v1, Ljava/util/LinkedHashMap;
|
|
|
|
invoke-direct {v1}, Ljava/util/LinkedHashMap;-><init>()V
|
|
|
|
iget-object v3, v0, Lo0/a0;->b:Lo0/w;
|
|
|
|
iget-object v4, v0, Lo0/a0;->c:Ljava/lang/String;
|
|
|
|
iget-object v6, v0, Lo0/a0;->e:Lokhttp3/RequestBody;
|
|
|
|
iget-object v1, v0, Lo0/a0;->f:Ljava/util/Map;
|
|
|
|
invoke-interface {v1}, Ljava/util/Map;->isEmpty()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
new-instance v1, Ljava/util/LinkedHashMap;
|
|
|
|
invoke-direct {v1}, Ljava/util/LinkedHashMap;-><init>()V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
iget-object v1, v0, Lo0/a0;->f:Ljava/util/Map;
|
|
|
|
invoke-static {v1}, Lf/n/a/k/a;->toMutableMap(Ljava/util/Map;)Ljava/util/Map;
|
|
|
|
move-result-object v1
|
|
|
|
:goto_0
|
|
iget-object v0, v0, Lo0/a0;->d:Lokhttp3/Headers;
|
|
|
|
invoke-virtual {v0}, Lokhttp3/Headers;->j()Lokhttp3/Headers$a;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v2, "Authorization"
|
|
|
|
const-string v5, "Bearer "
|
|
|
|
invoke-static {v5}, Lf/e/b/a/a;->D(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v5
|
|
|
|
iget-object v7, p0, Lcom/discord/restapi/SpotifyTokenInterceptor;->headersProvider:Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;
|
|
|
|
invoke-interface {v7}, Lcom/discord/restapi/RequiredHeadersInterceptor$HeadersProvider;->getSpotifyToken()Ljava/lang/String;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v5, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
const-string v7, "name"
|
|
|
|
invoke-static {v2, v7}, Lk0/o/c/i;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string/jumbo v7, "value"
|
|
|
|
invoke-static {v5, v7}, Lk0/o/c/i;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, v2, v5}, Lokhttp3/Headers$a;->a(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$a;
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
invoke-virtual {v0}, Lokhttp3/Headers$a;->c()Lokhttp3/Headers;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-static {v1}, Lo0/g0/b;->F(Ljava/util/Map;)Ljava/util/Map;
|
|
|
|
move-result-object v7
|
|
|
|
new-instance v0, Lo0/a0;
|
|
|
|
move-object v2, v0
|
|
|
|
invoke-direct/range {v2 .. v7}, Lo0/a0;-><init>(Lo0/w;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V
|
|
|
|
invoke-interface {p1, v0}, Lokhttp3/Interceptor$Chain;->d(Lo0/a0;)Lokhttp3/Response;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
new-instance p1, Ljava/lang/IllegalStateException;
|
|
|
|
const-string/jumbo v0, "url == null"
|
|
|
|
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
|
|
|
|
throw p1
|
|
|
|
:cond_2
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|