182 lines
7.2 KiB
Java
182 lines
7.2 KiB
Java
package retrofit2;
|
|
|
|
import java.io.IOException;
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.reflect.ParameterizedType;
|
|
import java.lang.reflect.Type;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.Executor;
|
|
import o.C15139giB;
|
|
import okhttp3.Request;
|
|
import retrofit2.CallAdapter;
|
|
import retrofit2.DefaultCallAdapterFactory;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public final class DefaultCallAdapterFactory extends CallAdapter.Factory {
|
|
private final Executor callbackExecutor;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public DefaultCallAdapterFactory(Executor executor) {
|
|
this.callbackExecutor = executor;
|
|
}
|
|
|
|
@Override // retrofit2.CallAdapter.Factory
|
|
public final CallAdapter<?, ?> get(Type type, Annotation[] annotationArr, Retrofit retrofit) {
|
|
if (getRawType(type) != Call.class) {
|
|
return null;
|
|
}
|
|
if (!(type instanceof ParameterizedType)) {
|
|
throw new IllegalArgumentException("Call return type must be parameterized as Call<Foo> or Call<? extends Foo>");
|
|
}
|
|
return new CallAdapter<Object, Call<?>>(this, Utils.getParameterUpperBound(0, (ParameterizedType) type), Utils.isAnnotationPresent(annotationArr, SkipCallbackExecutor.class) ? null : this.callbackExecutor) { // from class: retrofit2.DefaultCallAdapterFactory.1
|
|
final DefaultCallAdapterFactory this$0;
|
|
final Executor val$executor;
|
|
final Type val$responseType;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$responseType = r2;
|
|
this.val$executor = r3;
|
|
}
|
|
|
|
@Override // retrofit2.CallAdapter
|
|
public Call<?> adapt(Call<Object> call) {
|
|
Executor executor = this.val$executor;
|
|
return executor != null ? new ExecutorCallbackCall(executor, call) : call;
|
|
}
|
|
|
|
@Override // retrofit2.CallAdapter
|
|
public Type responseType() {
|
|
return this.val$responseType;
|
|
}
|
|
};
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static final class ExecutorCallbackCall<T> implements Call<T> {
|
|
final Executor callbackExecutor;
|
|
final Call<T> delegate;
|
|
|
|
ExecutorCallbackCall(Executor executor, Call<T> call) {
|
|
this.callbackExecutor = executor;
|
|
this.delegate = call;
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final void enqueue(Callback<T> callback) {
|
|
Objects.requireNonNull(callback, "callback == null");
|
|
this.delegate.enqueue(new AnonymousClass1(this, callback));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1, reason: invalid class name */
|
|
/* loaded from: classes.dex */
|
|
public class AnonymousClass1 implements Callback<T> {
|
|
final ExecutorCallbackCall this$0;
|
|
final Callback val$callback;
|
|
|
|
AnonymousClass1(ExecutorCallbackCall executorCallbackCall, Callback callback) {
|
|
this.this$0 = executorCallbackCall;
|
|
this.val$callback = callback;
|
|
}
|
|
|
|
@Override // retrofit2.Callback
|
|
public void onResponse(Call<T> call, final Response<T> response) {
|
|
Executor executor = this.this$0.callbackExecutor;
|
|
final Callback callback = this.val$callback;
|
|
executor.execute(new Runnable(this, callback, response) { // from class: retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1$$ExternalSyntheticLambda0
|
|
public final DefaultCallAdapterFactory.ExecutorCallbackCall.AnonymousClass1 f$0;
|
|
public final Callback f$1;
|
|
public final Response f$2;
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.f$0.m498xddacc936(this.f$1, this.f$2);
|
|
}
|
|
|
|
{
|
|
this.f$0 = this;
|
|
this.f$1 = callback;
|
|
this.f$2 = response;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$onResponse$0$retrofit2-DefaultCallAdapterFactory$ExecutorCallbackCall$1, reason: not valid java name */
|
|
public /* synthetic */ void m498xddacc936(Callback callback, Response response) {
|
|
if (this.this$0.delegate.isCanceled()) {
|
|
callback.onFailure(this.this$0, new IOException("Canceled"));
|
|
} else {
|
|
callback.onResponse(this.this$0, response);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$onFailure$1$retrofit2-DefaultCallAdapterFactory$ExecutorCallbackCall$1, reason: not valid java name */
|
|
public /* synthetic */ void m497x714e864(Callback callback, Throwable th) {
|
|
callback.onFailure(this.this$0, th);
|
|
}
|
|
|
|
@Override // retrofit2.Callback
|
|
public void onFailure(Call<T> call, final Throwable th) {
|
|
Executor executor = this.this$0.callbackExecutor;
|
|
final Callback callback = this.val$callback;
|
|
executor.execute(new Runnable(this, callback, th) { // from class: retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1$$ExternalSyntheticLambda1
|
|
public final DefaultCallAdapterFactory.ExecutorCallbackCall.AnonymousClass1 f$0;
|
|
public final Callback f$1;
|
|
public final Throwable f$2;
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.f$0.m497x714e864(this.f$1, this.f$2);
|
|
}
|
|
|
|
{
|
|
this.f$0 = this;
|
|
this.f$1 = callback;
|
|
this.f$2 = th;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final boolean isExecuted() {
|
|
return this.delegate.isExecuted();
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final Response<T> execute() throws IOException {
|
|
return this.delegate.execute();
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final void cancel() {
|
|
this.delegate.cancel();
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final boolean isCanceled() {
|
|
return this.delegate.isCanceled();
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final Call<T> clone() {
|
|
return new ExecutorCallbackCall(this.callbackExecutor, this.delegate.clone());
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final Request request() {
|
|
return this.delegate.request();
|
|
}
|
|
|
|
@Override // retrofit2.Call
|
|
public final C15139giB timeout() {
|
|
return this.delegate.timeout();
|
|
}
|
|
}
|
|
}
|