2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.utilities.coroutines;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2021-11-08 18:25:28 +00:00
|
|
|
import c.i.a.f.e.o.f;
|
2021-06-27 20:44:35 +00:00
|
|
|
import com.discord.utilities.coroutines.AppErrorTag;
|
2021-11-03 22:42:40 +00:00
|
|
|
import com.discord.utilities.error.AppCancellationException;
|
2021-06-27 20:44:35 +00:00
|
|
|
import com.discord.utilities.error.Error;
|
|
|
|
import com.discord.utilities.rx.RxCoroutineUtilsKt;
|
2021-11-08 18:25:28 +00:00
|
|
|
import d0.l;
|
|
|
|
import d0.w.h.c;
|
|
|
|
import d0.w.i.a.e;
|
|
|
|
import d0.w.i.a.k;
|
|
|
|
import d0.z.d.m;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.lang.ref.WeakReference;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.coroutines.Continuation;
|
|
|
|
import kotlin.jvm.functions.Function2;
|
|
|
|
import kotlin.jvm.internal.Ref$ObjectRef;
|
2021-07-09 21:07:36 +00:00
|
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
2021-06-27 20:44:35 +00:00
|
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
|
|
import rx.Observable;
|
2021-11-08 18:25:28 +00:00
|
|
|
import s.a.a.n;
|
|
|
|
import s.a.j0;
|
|
|
|
import s.a.k1;
|
2021-06-27 20:44:35 +00:00
|
|
|
/* compiled from: RxCoroutineExtensions.kt */
|
2021-11-03 22:42:40 +00:00
|
|
|
@e(c = "com.discord.utilities.coroutines.RxCoroutineExtensionsKt$appAwaitSingle$2", f = "RxCoroutineExtensions.kt", l = {35, 40}, m = "invokeSuspend")
|
2021-06-27 20:44:35 +00:00
|
|
|
public final class RxCoroutineExtensionsKt$appAwaitSingle$2 extends k implements Function2<CoroutineScope, Continuation<? super T>, Object> {
|
|
|
|
public final /* synthetic */ Context $context;
|
2021-11-03 22:42:40 +00:00
|
|
|
public final /* synthetic */ Boolean $suppressToast;
|
2021-06-27 20:44:35 +00:00
|
|
|
public final /* synthetic */ Observable $this_appAwaitSingle;
|
|
|
|
private /* synthetic */ Object L$0;
|
|
|
|
public Object L$1;
|
|
|
|
public int label;
|
|
|
|
|
|
|
|
/* compiled from: RxCoroutineExtensions.kt */
|
|
|
|
@e(c = "com.discord.utilities.coroutines.RxCoroutineExtensionsKt$appAwaitSingle$2$1", f = "RxCoroutineExtensions.kt", l = {}, m = "invokeSuspend")
|
|
|
|
/* renamed from: com.discord.utilities.coroutines.RxCoroutineExtensionsKt$appAwaitSingle$2$1 reason: invalid class name */
|
|
|
|
public static final class AnonymousClass1 extends k implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
|
|
|
|
public final /* synthetic */ Throwable $e;
|
|
|
|
public final /* synthetic */ Ref$ObjectRef $errorTag;
|
|
|
|
public final /* synthetic */ Ref$ObjectRef $weakContext;
|
|
|
|
public int label;
|
2021-11-03 22:42:40 +00:00
|
|
|
public final /* synthetic */ RxCoroutineExtensionsKt$appAwaitSingle$2 this$0;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-11-03 22:42:40 +00:00
|
|
|
public AnonymousClass1(RxCoroutineExtensionsKt$appAwaitSingle$2 rxCoroutineExtensionsKt$appAwaitSingle$2, Throwable th, Ref$ObjectRef ref$ObjectRef, Ref$ObjectRef ref$ObjectRef2, Continuation continuation) {
|
2021-06-27 20:44:35 +00:00
|
|
|
super(2, continuation);
|
2021-11-03 22:42:40 +00:00
|
|
|
this.this$0 = rxCoroutineExtensionsKt$appAwaitSingle$2;
|
2021-06-27 20:44:35 +00:00
|
|
|
this.$e = th;
|
|
|
|
this.$errorTag = ref$ObjectRef;
|
|
|
|
this.$weakContext = ref$ObjectRef2;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // d0.w.i.a.a
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
|
|
|
m.checkNotNullParameter(continuation, "completion");
|
2021-11-03 22:42:40 +00:00
|
|
|
return new AnonymousClass1(this.this$0, this.$e, this.$errorTag, this.$weakContext, continuation);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 Unit> continuation) {
|
|
|
|
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.a);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // d0.w.i.a.a
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Object invokeSuspend(Object obj) {
|
|
|
|
c.getCOROUTINE_SUSPENDED();
|
|
|
|
if (this.label == 0) {
|
|
|
|
l.throwOnFailure(obj);
|
2021-11-03 22:42:40 +00:00
|
|
|
Error.handle(this.$e, this.$errorTag.element, null, (Context) this.$weakContext.element.get(), this.this$0.$suppressToast);
|
2021-06-27 20:44:35 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-11-03 22:42:40 +00:00
|
|
|
public RxCoroutineExtensionsKt$appAwaitSingle$2(Observable observable, Context context, Boolean bool, Continuation continuation) {
|
2021-06-27 20:44:35 +00:00
|
|
|
super(2, continuation);
|
|
|
|
this.$this_appAwaitSingle = observable;
|
|
|
|
this.$context = context;
|
2021-11-03 22:42:40 +00:00
|
|
|
this.$suppressToast = bool;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // d0.w.i.a.a
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
|
|
|
m.checkNotNullParameter(continuation, "completion");
|
2021-11-03 22:42:40 +00:00
|
|
|
RxCoroutineExtensionsKt$appAwaitSingle$2 rxCoroutineExtensionsKt$appAwaitSingle$2 = new RxCoroutineExtensionsKt$appAwaitSingle$2(this.$this_appAwaitSingle, this.$context, this.$suppressToast, continuation);
|
2021-06-27 20:44:35 +00:00
|
|
|
rxCoroutineExtensionsKt$appAwaitSingle$2.L$0 = obj;
|
|
|
|
return rxCoroutineExtensionsKt$appAwaitSingle$2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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, Object obj) {
|
|
|
|
return ((RxCoroutineExtensionsKt$appAwaitSingle$2) create(coroutineScope, (Continuation) obj)).invokeSuspend(Unit.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v5, resolved type: T */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v8, resolved type: T */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v9, resolved type: T */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
2021-11-03 22:42:40 +00:00
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:15:0x005c, code lost:
|
|
|
|
if (r5 != null) goto L_0x0067;
|
2021-06-27 20:44:35 +00:00
|
|
|
*/
|
|
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // d0.w.i.a.a
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Object invokeSuspend(Object obj) {
|
2021-11-03 22:42:40 +00:00
|
|
|
Error error;
|
2021-06-27 20:44:35 +00:00
|
|
|
Ref$ObjectRef ref$ObjectRef;
|
|
|
|
Ref$ObjectRef ref$ObjectRef2;
|
2021-11-03 22:42:40 +00:00
|
|
|
Throwable th;
|
2021-06-27 20:44:35 +00:00
|
|
|
T t;
|
|
|
|
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
|
|
|
|
int i = this.label;
|
|
|
|
if (i == 0) {
|
|
|
|
l.throwOnFailure(obj);
|
|
|
|
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
|
|
|
|
Ref$ObjectRef ref$ObjectRef3 = new Ref$ObjectRef();
|
|
|
|
ref$ObjectRef3.element = new WeakReference(this.$context);
|
|
|
|
Ref$ObjectRef ref$ObjectRef4 = new Ref$ObjectRef();
|
|
|
|
AppErrorTag appErrorTag = (AppErrorTag) coroutineScope.getCoroutineContext().get(AppErrorTag.Key.INSTANCE);
|
|
|
|
if (appErrorTag != null) {
|
|
|
|
String errorTag = appErrorTag.getErrorTag();
|
|
|
|
t = errorTag;
|
|
|
|
}
|
|
|
|
t = coroutineScope.getClass().getSimpleName();
|
|
|
|
ref$ObjectRef4.element = t;
|
|
|
|
try {
|
|
|
|
Observable observable = this.$this_appAwaitSingle;
|
|
|
|
this.L$0 = ref$ObjectRef3;
|
|
|
|
this.L$1 = ref$ObjectRef4;
|
|
|
|
this.label = 1;
|
|
|
|
obj = RxCoroutineUtilsKt.awaitSingle(observable, this);
|
|
|
|
if (obj == coroutine_suspended) {
|
|
|
|
return coroutine_suspended;
|
|
|
|
}
|
2021-11-03 22:42:40 +00:00
|
|
|
} catch (Throwable th2) {
|
|
|
|
th = th2;
|
2021-06-27 20:44:35 +00:00
|
|
|
ref$ObjectRef = ref$ObjectRef3;
|
|
|
|
ref$ObjectRef2 = ref$ObjectRef4;
|
2021-11-03 22:42:40 +00:00
|
|
|
Error create = Error.create(th);
|
2021-07-09 21:07:36 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = j0.a;
|
|
|
|
k1 k1Var = n.b;
|
2021-11-03 22:42:40 +00:00
|
|
|
AnonymousClass1 r3 = new AnonymousClass1(this, th, ref$ObjectRef2, ref$ObjectRef, null);
|
|
|
|
this.L$0 = create;
|
2021-06-27 20:44:35 +00:00
|
|
|
this.L$1 = null;
|
|
|
|
this.label = 2;
|
2021-11-08 18:25:28 +00:00
|
|
|
if (f.k1(k1Var, r3, this) == coroutine_suspended) {
|
2021-06-27 20:44:35 +00:00
|
|
|
return coroutine_suspended;
|
|
|
|
}
|
2021-11-03 22:42:40 +00:00
|
|
|
error = create;
|
|
|
|
m.checkNotNullExpressionValue(error, "error");
|
|
|
|
throw new AppCancellationException("Unexpected error", error.getThrowable(), error);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} else if (i == 1) {
|
2021-11-03 22:42:40 +00:00
|
|
|
Ref$ObjectRef ref$ObjectRef5 = (Ref$ObjectRef) this.L$1;
|
|
|
|
Ref$ObjectRef ref$ObjectRef6 = (Ref$ObjectRef) this.L$0;
|
2021-06-27 20:44:35 +00:00
|
|
|
try {
|
|
|
|
l.throwOnFailure(obj);
|
2021-11-03 22:42:40 +00:00
|
|
|
} catch (Throwable th3) {
|
|
|
|
th = th3;
|
|
|
|
ref$ObjectRef2 = ref$ObjectRef5;
|
|
|
|
ref$ObjectRef = ref$ObjectRef6;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} else if (i != 2) {
|
|
|
|
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
|
|
|
} else {
|
2021-11-03 22:42:40 +00:00
|
|
|
error = (Error) this.L$0;
|
2021-06-27 20:44:35 +00:00
|
|
|
l.throwOnFailure(obj);
|
2021-11-03 22:42:40 +00:00
|
|
|
m.checkNotNullExpressionValue(error, "error");
|
|
|
|
throw new AppCancellationException("Unexpected error", error.getThrowable(), error);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
}
|