33 lines
1.2 KiB
Java
33 lines
1.2 KiB
Java
package com.google.android.gms.common.internal;
|
|
|
|
import com.google.android.gms.common.api.PendingResult;
|
|
import com.google.android.gms.common.api.Response;
|
|
import com.google.android.gms.common.api.Result;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.android.gms.tasks.TaskCompletionSource;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class PendingResultUtil {
|
|
private static final zas zaa = new zao();
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface ResultConverter<R extends Result, T> {
|
|
T convert(R r);
|
|
}
|
|
|
|
public static <R extends Result, T extends Response<R>> Task<T> toResponseTask(PendingResult<R> pendingResult, T t) {
|
|
return toTask(pendingResult, new zaq(t));
|
|
}
|
|
|
|
public static <R extends Result, T> Task<T> toTask(PendingResult<R> pendingResult, ResultConverter<R, T> resultConverter) {
|
|
zas zasVar = zaa;
|
|
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
|
pendingResult.addStatusListener(new zap(pendingResult, taskCompletionSource, resultConverter, zasVar));
|
|
return taskCompletionSource.getTask();
|
|
}
|
|
|
|
public static <R extends Result> Task<Void> toVoidTask(PendingResult<R> pendingResult) {
|
|
return toTask(pendingResult, new zar());
|
|
}
|
|
}
|