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

273 lines
12 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.libraries.places.internal;
import android.location.Location;
import android.text.TextUtils;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.android.libraries.places.api.model.PlaceLikelihood;
import com.google.android.libraries.places.api.net.FetchPhotoRequest;
import com.google.android.libraries.places.api.net.FetchPhotoResponse;
import com.google.android.libraries.places.api.net.FetchPlaceRequest;
import com.google.android.libraries.places.api.net.FetchPlaceResponse;
import com.google.android.libraries.places.api.net.FindAutocompletePredictionsRequest;
import com.google.android.libraries.places.api.net.FindAutocompletePredictionsResponse;
import com.google.android.libraries.places.api.net.FindCurrentPlaceRequest;
import com.google.android.libraries.places.api.net.FindCurrentPlaceResponse;
import com.google.android.libraries.places.api.net.PlacesStatusCodes;
import java.util.ArrayList;
import java.util.Locale;
/* loaded from: classes2.dex */
public final class zzeu implements zzcs {
private final zzgf zza;
private final zzcx zzb;
private final zzdd zzc;
private final zzfr zzd;
private final zzbx zze;
private final zzdv zzf;
private final zzdz zzg;
private final zzed zzh;
private final zzeh zzi;
private final zzfs zzj;
/* JADX INFO: Access modifiers changed from: package-private */
public static final /* synthetic */ FetchPlaceResponse zzi(Task task) throws Exception {
zzdy zzdyVar = (zzdy) task.getResult();
int zza = zzfb.zza(zzdyVar.status);
if (PlacesStatusCodes.isError(zza)) {
throw new ApiException(new Status(zza, zzfb.zzb(zzdyVar.status, zzdyVar.errorMessage)));
}
zzfa zzfaVar = zzdyVar.result;
String[] strArr = zzdyVar.htmlAttributions;
return FetchPlaceResponse.newInstance(zzex.zzd(zzfaVar, strArr != null ? zziy.zzl(strArr) : null));
}
/* JADX INFO: Access modifiers changed from: package-private */
public static final /* synthetic */ FindCurrentPlaceResponse zzj(Task task) throws Exception {
zzeg zzegVar = (zzeg) task.getResult();
int zza = zzfb.zza(zzegVar.status);
if (PlacesStatusCodes.isError(zza)) {
throw new ApiException(new Status(zza, zzfb.zzb(zzegVar.status, zzegVar.errorMessage)));
}
ArrayList arrayList = new ArrayList();
zzez[] zzezVarArr = zzegVar.predictions;
if (zzezVarArr != null) {
for (zzez zzezVar : zzezVarArr) {
if (zzezVar.zza() != null) {
Double zzb = zzezVar.zzb();
if (zzb != null) {
zzfa zza2 = zzezVar.zza();
String[] strArr = zzegVar.htmlAttributions;
arrayList.add(PlaceLikelihood.newInstance(zzex.zzd(zza2, strArr != null ? zziy.zzl(strArr) : null), zzb.doubleValue()));
} else {
throw new ApiException(new Status(8, "Unexpected server error: PlaceLikelihood returned without a likelihood value"));
}
} else {
throw new ApiException(new Status(8, "Unexpected server error: PlaceLikelihood returned without a Place value"));
}
}
}
return FindCurrentPlaceResponse.newInstance(arrayList);
}
@Override // com.google.android.libraries.places.internal.zzcs
public final Task zza(FetchPhotoRequest fetchPhotoRequest) {
Integer maxWidth = fetchPhotoRequest.getMaxWidth();
Integer maxHeight = fetchPhotoRequest.getMaxHeight();
if (maxWidth != null || maxHeight != null) {
if (maxWidth == null || maxWidth.intValue() > 0) {
if (maxHeight == null || maxHeight.intValue() > 0) {
String zza = this.zzj.zza();
this.zzj.zze();
zzdr zzdrVar = new zzdr(fetchPhotoRequest, zza, false, this.zza);
final long zza2 = this.zze.zza();
return this.zzc.zzb(zzdrVar, new zzds()).continueWith(new Continuation(this) { // from class: com.google.android.libraries.places.internal.zzes
public final zzeu zza;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return FetchPhotoResponse.newInstance(((zzdu) task.getResult()).zza);
}
{
this.zza = this;
}
}).continueWith(new Continuation(this, zza2) { // from class: com.google.android.libraries.places.internal.zzet
public final zzeu zza;
public final long zzb;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return this.zza.zze(this.zzb, task);
}
{
this.zza = this;
this.zzb = zza2;
}
});
}
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, String.format("Max Height must not be < 1, but was: %d.", maxHeight))));
}
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, String.format("Max Width must not be < 1, but was: %d.", maxWidth))));
}
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, "Must include max width or max height in request.")));
}
@Override // com.google.android.libraries.places.internal.zzcs
public final Task zzb(FetchPlaceRequest fetchPlaceRequest) {
if (TextUtils.isEmpty(fetchPlaceRequest.getPlaceId())) {
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, "Place ID must not be empty.")));
}
if (fetchPlaceRequest.getPlaceFields().isEmpty()) {
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, "Place Fields must not be empty.")));
}
Locale zzb = this.zzj.zzb();
String zza = this.zzj.zza();
this.zzj.zze();
zzdx zzdxVar = new zzdx(fetchPlaceRequest, zzb, zza, false, this.zza);
final long zza2 = this.zze.zza();
return this.zzb.zza(zzdxVar, zzdy.class).continueWith(new Continuation(this) { // from class: com.google.android.libraries.places.internal.zzeo
public final zzeu zza;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return zzeu.zzi(task);
}
{
this.zza = this;
}
}).continueWith(new Continuation(this, zza2) { // from class: com.google.android.libraries.places.internal.zzep
public final zzeu zza;
public final long zzb;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return this.zza.zzf(this.zzb, task);
}
{
this.zza = this;
this.zzb = zza2;
}
});
}
@Override // com.google.android.libraries.places.internal.zzcs
public final Task zzc(FindAutocompletePredictionsRequest findAutocompletePredictionsRequest) {
String query = findAutocompletePredictionsRequest.getQuery();
if (query == null || TextUtils.isEmpty(query.trim())) {
return Tasks.forResult(FindAutocompletePredictionsResponse.newInstance(zziy.zzm()));
}
Locale zzb = this.zzj.zzb();
String zza = this.zzj.zza();
this.zzj.zze();
zzeb zzebVar = new zzeb(findAutocompletePredictionsRequest, zzb, zza, false, this.zza);
final long zza2 = this.zze.zza();
return this.zzb.zza(zzebVar, zzec.class).continueWith(new Continuation(this) { // from class: com.google.android.libraries.places.internal.zzem
public final zzeu zza;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return zzed.zza((zzec) task.getResult());
}
{
this.zza = this;
}
}).continueWith(new Continuation(this, zza2) { // from class: com.google.android.libraries.places.internal.zzen
public final zzeu zza;
public final long zzb;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return this.zza.zzg(this.zzb, task);
}
{
this.zza = this;
this.zzb = zza2;
}
});
}
@Override // com.google.android.libraries.places.internal.zzcs
public final Task zzd(FindCurrentPlaceRequest findCurrentPlaceRequest, Location location, zziy zziyVar) {
if (findCurrentPlaceRequest.getPlaceFields().isEmpty()) {
return Tasks.forException(new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, "Place Fields must not be empty.")));
}
Locale zzb = this.zzj.zzb();
String zza = this.zzj.zza();
this.zzj.zze();
zzef zzefVar = new zzef(findCurrentPlaceRequest, location, zziyVar, zzb, zza, false, this.zza);
final long zza2 = this.zze.zza();
return this.zzb.zza(zzefVar, zzeg.class).continueWith(new Continuation(this) { // from class: com.google.android.libraries.places.internal.zzeq
public final zzeu zza;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return zzeu.zzj(task);
}
{
this.zza = this;
}
}).continueWith(new Continuation(this, zza2) { // from class: com.google.android.libraries.places.internal.zzer
public final zzeu zza;
public final long zzb;
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task) {
return this.zza.zzh(this.zzb, task);
}
{
this.zza = this;
this.zzb = zza2;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public final /* synthetic */ FetchPhotoResponse zze(long j, Task task) throws Exception {
this.zzd.zzb(task, j, this.zze.zza());
return (FetchPhotoResponse) task.getResult();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final /* synthetic */ FetchPlaceResponse zzf(long j, Task task) throws Exception {
this.zzd.zzd(task, j, this.zze.zza());
return (FetchPlaceResponse) task.getResult();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final /* synthetic */ FindAutocompletePredictionsResponse zzg(long j, Task task) throws Exception {
this.zzd.zzf(task, j, this.zze.zza());
return (FindAutocompletePredictionsResponse) task.getResult();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final /* synthetic */ FindCurrentPlaceResponse zzh(long j, Task task) throws Exception {
this.zzd.zzh(task, j, this.zze.zza());
return (FindCurrentPlaceResponse) task.getResult();
}
/* JADX INFO: Access modifiers changed from: package-private */
public zzeu(zzfs zzfsVar, zzgf zzgfVar, zzcx zzcxVar, zzdd zzddVar, zzfr zzfrVar, zzbx zzbxVar, zzdv zzdvVar, zzdz zzdzVar, zzed zzedVar, zzeh zzehVar, byte[] bArr) {
this.zzj = zzfsVar;
this.zza = zzgfVar;
this.zzb = zzcxVar;
this.zzc = zzddVar;
this.zzd = zzfrVar;
this.zze = zzbxVar;
this.zzf = zzdvVar;
this.zzg = zzdzVar;
this.zzh = zzedVar;
this.zzi = zzehVar;
}
}