what-the-bank/sources/com/google/android/gms/common/api/internal/TaskUtil.java

34 lines
1.3 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.common.api.internal;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
/* loaded from: classes.dex */
public class TaskUtil {
public static void setResultOrApiException(Status status, TaskCompletionSource<Void> taskCompletionSource) {
setResultOrApiException(status, null, taskCompletionSource);
}
@Deprecated
public static Task<Void> toVoidTaskThatFailsOnFalse(Task<Boolean> task) {
return task.continueWith(new zacx());
}
public static <ResultT> boolean trySetResultOrApiException(Status status, ResultT resultt, TaskCompletionSource<ResultT> taskCompletionSource) {
if (status.isSuccess()) {
return taskCompletionSource.trySetResult(resultt);
}
return taskCompletionSource.trySetException(new ApiException(status));
}
public static <TResult> void setResultOrApiException(Status status, TResult tresult, TaskCompletionSource<TResult> taskCompletionSource) {
if (status.isSuccess()) {
taskCompletionSource.setResult(tresult);
} else {
taskCompletionSource.setException(new ApiException(status));
}
}
}