what-the-bank/sources/com/google/android/libraries/places/internal/zzcx.java

107 lines
3.8 KiB
Java

package com.google.android.libraries.places.internal;
import com.android.volley.VolleyError;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.CancellationToken;
import com.google.android.gms.tasks.OnTokenCanceledListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.util.Map;
import o.C1117VzR;
import o.C15788ibz;
import o.zcu;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class zzcx {
private final C1117VzR zza;
private final zzej zzb;
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void zzc(TaskCompletionSource taskCompletionSource, VolleyError volleyError) {
try {
taskCompletionSource.trySetException(zzcr.zza(volleyError));
} catch (Error | RuntimeException e) {
zzgb.zzb(e);
throw e;
}
}
public final Task zza(zzdf zzdfVar, final Class cls) {
TaskCompletionSource taskCompletionSource;
String zzc = zzdfVar.zzc();
Map zzd = zzdfVar.zzd();
CancellationToken zza = zzdfVar.zza();
if (zza != null) {
taskCompletionSource = new TaskCompletionSource(zza);
} else {
taskCompletionSource = new TaskCompletionSource();
}
final TaskCompletionSource taskCompletionSource2 = taskCompletionSource;
final zzcw zzcwVar = new zzcw(this, 0, zzc, null, new C15788ibz.LWm(this, cls, taskCompletionSource2) { // from class: com.google.android.libraries.places.internal.zzct
public final zzcx zza;
public final Class zzb;
public final TaskCompletionSource zzc;
@Override // o.C15788ibz.LWm
public final void onResponse(Object obj) {
this.zza.zzb(this.zzb, this.zzc, (JSONObject) obj);
}
{
this.zza = this;
this.zzb = cls;
this.zzc = taskCompletionSource2;
}
}, new C15788ibz.HBt(taskCompletionSource2) { // from class: com.google.android.libraries.places.internal.zzcu
public final TaskCompletionSource zza;
@Override // o.C15788ibz.HBt
public final void onErrorResponse(VolleyError volleyError) {
zzcx.zzc(this.zza, volleyError);
}
{
this.zza = taskCompletionSource2;
}
}, zzd);
if (zza != null) {
zza.onCanceledRequested(new OnTokenCanceledListener(zzcwVar) { // from class: com.google.android.libraries.places.internal.zzcv
public final zcu zza;
@Override // com.google.android.gms.tasks.OnTokenCanceledListener
public final void onCanceled() {
this.zza.cancel();
}
{
this.zza = zzcwVar;
}
});
}
this.zza.d(zzcwVar);
return taskCompletionSource2.getTask();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final /* synthetic */ void zzb(Class cls, TaskCompletionSource taskCompletionSource, JSONObject jSONObject) {
try {
try {
taskCompletionSource.trySetResult((zzdg) this.zzb.zza(jSONObject.toString(), cls));
} catch (zzdh e) {
taskCompletionSource.trySetException(new ApiException(new Status(8, e.getMessage())));
}
} catch (Error | RuntimeException e2) {
zzgb.zzb(e2);
throw e2;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public zzcx(C1117VzR c1117VzR, zzej zzejVar, byte[] bArr) {
this.zza = c1117VzR;
this.zzb = zzejVar;
}
}