2019-02-04 20:14:45 +00:00
|
|
|
.class public final Lcom/discord/restapi/SpotifyAuthInterceptor;
|
|
|
|
.super Ljava/lang/Object;
|
2019-02-04 20:29:01 +00:00
|
|
|
.source "RestInterceptors.kt"
|
2019-02-04 20:14:45 +00:00
|
|
|
|
|
|
|
# interfaces
|
|
|
|
.implements Lokhttp3/Interceptor;
|
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
|
|
|
.field private final clientId:Ljava/lang/String;
|
|
|
|
|
|
|
|
.field private final clientSecret:Ljava/lang/String;
|
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
const-string v0, "clientId"
|
|
|
|
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
|
|
|
|
const-string v0, "clientSecret"
|
|
|
|
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
iput-object p1, p0, Lcom/discord/restapi/SpotifyAuthInterceptor;->clientId:Ljava/lang/String;
|
|
|
|
|
|
|
|
iput-object p2, p0, Lcom/discord/restapi/SpotifyAuthInterceptor;->clientSecret:Ljava/lang/String;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public final intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
|
|
|
|
.locals 5
|
|
|
|
|
|
|
|
const-string v0, "chain"
|
|
|
|
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
|
2019-03-22 22:04:12 +00:00
|
|
|
invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->Aq()Lokhttp3/w;
|
2019-02-04 20:14:45 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
2019-03-22 22:04:12 +00:00
|
|
|
invoke-virtual {v0}, Lokhttp3/w;->AD()Lokhttp3/w$a;
|
2019-02-04 20:14:45 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
|
|
|
|
iget-object v2, p0, Lcom/discord/restapi/SpotifyAuthInterceptor;->clientId:Ljava/lang/String;
|
|
|
|
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
const/16 v2, 0x3a
|
|
|
|
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
iget-object v2, p0, Lcom/discord/restapi/SpotifyAuthInterceptor;->clientSecret:Ljava/lang/String;
|
|
|
|
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
const-string v2, "Authorization"
|
|
|
|
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
const-string v4, "Basic "
|
|
|
|
|
|
|
|
invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
sget-object v4, Lkotlin/text/d;->UTF_8:Ljava/nio/charset/Charset;
|
|
|
|
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
|
|
|
|
invoke-virtual {v1, v4}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
const-string v4, "(this as java.lang.String).getBytes(charset)"
|
|
|
|
|
|
|
|
invoke-static {v1, v4}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
|
|
|
|
const/4 v4, 0x2
|
|
|
|
|
|
|
|
invoke-static {v1, v4}, Landroid/util/Base64;->encodeToString([BI)Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
|
|
|
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
|
|
|
|
move-result-object v1
|
|
|
|
|
2019-02-27 21:13:14 +00:00
|
|
|
invoke-virtual {v0, v2, v1}, Lokhttp3/w$a;->ak(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/w$a;
|
2019-02-04 20:14:45 +00:00
|
|
|
|
2019-03-22 22:04:12 +00:00
|
|
|
invoke-virtual {v0}, Lokhttp3/w$a;->AF()Lokhttp3/w;
|
2019-02-04 20:14:45 +00:00
|
|
|
|
|
|
|
move-result-object v0
|
|
|
|
|
|
|
|
invoke-interface {p1, v0}, Lokhttp3/Interceptor$Chain;->b(Lokhttp3/w;)Lokhttp3/Response;
|
|
|
|
|
|
|
|
move-result-object p1
|
|
|
|
|
|
|
|
const-string v0, "chain.proceed(modifiedRequest)"
|
|
|
|
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
|
|
|
|
return-object p1
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
new-instance p1, Lkotlin/r;
|
|
|
|
|
|
|
|
const-string v0, "null cannot be cast to non-null type java.lang.String"
|
|
|
|
|
|
|
|
invoke-direct {p1, v0}, Lkotlin/r;-><init>(Ljava/lang/String;)V
|
|
|
|
|
|
|
|
throw p1
|
|
|
|
.end method
|