87 lines
3.5 KiB
Java
87 lines
3.5 KiB
Java
package c.a.s;
|
|
|
|
import android.net.Uri;
|
|
import com.discord.samsung.SamsungConnect$SamsungCallbackException;
|
|
import d0.g0.w;
|
|
import d0.l;
|
|
import d0.w.g.c;
|
|
import d0.w.h.a.e;
|
|
import d0.w.h.a.k;
|
|
import d0.z.d.m;
|
|
import f0.x;
|
|
import f0.z;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import okhttp3.Response;
|
|
/* compiled from: SamsungConnect.kt */
|
|
@e(c = "com.discord.samsung.SamsungConnect$getSamsungAuthorizeCallback$2", f = "SamsungConnect.kt", l = {}, m = "invokeSuspend")
|
|
public final class a extends k implements Function2<CoroutineScope, Continuation<? super Uri>, Object> {
|
|
public final /* synthetic */ x $okHttpClient;
|
|
public final /* synthetic */ String $url;
|
|
public int label;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public a(String str, x xVar, Continuation continuation) {
|
|
super(2, continuation);
|
|
this.$url = str;
|
|
this.$okHttpClient = xVar;
|
|
}
|
|
|
|
@Override // d0.w.h.a.a
|
|
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
|
m.checkNotNullParameter(continuation, "completion");
|
|
return new a(this.$url, this.$okHttpClient, continuation);
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Uri> continuation) {
|
|
Continuation<? super Uri> continuation2 = continuation;
|
|
m.checkNotNullParameter(continuation2, "completion");
|
|
return new a(this.$url, this.$okHttpClient, continuation2).invokeSuspend(Unit.a);
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:21:0x0061, code lost:
|
|
if (r4 == false) goto L_0x0064;
|
|
*/
|
|
@Override // d0.w.h.a.a
|
|
public final Object invokeSuspend(Object obj) {
|
|
String str;
|
|
String query;
|
|
c.getCOROUTINE_SUSPENDED();
|
|
if (this.label == 0) {
|
|
l.throwOnFailure(obj);
|
|
z.a aVar = new z.a();
|
|
String str2 = null;
|
|
aVar.c("GET", null);
|
|
aVar.f(this.$url);
|
|
Response execute = ((f0.f0.g.e) this.$okHttpClient.b(aVar.a())).execute();
|
|
String a = Response.a(execute, "Location", null, 2);
|
|
Uri parse = a != null ? Uri.parse(a) : null;
|
|
boolean z2 = false;
|
|
if (!((parse == null || (query = parse.getQuery()) == null) ? false : w.contains$default((CharSequence) query, (CharSequence) "error", false, 2, (Object) null))) {
|
|
if (!execute.b()) {
|
|
int i = execute.l;
|
|
if (!(i == 307 || i == 308)) {
|
|
switch (i) {
|
|
}
|
|
}
|
|
z2 = true;
|
|
}
|
|
return parse;
|
|
}
|
|
if (parse == null || (str = parse.getQueryParameter("error")) == null) {
|
|
str = "unknown";
|
|
}
|
|
m.checkNotNullExpressionValue(str, "location?.getQueryParameter(\"error\") ?: \"unknown\"");
|
|
if (parse != null) {
|
|
str2 = parse.getQueryParameter("error_description");
|
|
}
|
|
throw new SamsungConnect$SamsungCallbackException(str, str2);
|
|
}
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
}
|
|
}
|