130 lines
4.6 KiB
Java
130 lines
4.6 KiB
Java
|
package com.google.android.gms.internal.p002firebaseauthapi;
|
||
|
|
||
|
import android.os.Parcel;
|
||
|
import android.os.Parcelable;
|
||
|
import android.util.Log;
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||
|
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
|
||
|
import com.google.android.gms.common.util.DefaultClock;
|
||
|
import com.google.android.gms.common.util.Strings;
|
||
|
import org.json.JSONException;
|
||
|
import org.json.JSONObject;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzzy extends AbstractSafeParcelable implements zzxn<zzzy> {
|
||
|
public static final Parcelable.Creator<zzzy> CREATOR = new zzzz();
|
||
|
private static final String zza = "zzzy";
|
||
|
private String zzb;
|
||
|
private String zzc;
|
||
|
private Long zzd;
|
||
|
private String zze;
|
||
|
private Long zzf;
|
||
|
|
||
|
public zzzy() {
|
||
|
this.zzf = Long.valueOf(System.currentTimeMillis());
|
||
|
}
|
||
|
|
||
|
public static zzzy zzd(String str) {
|
||
|
try {
|
||
|
JSONObject jSONObject = new JSONObject(str);
|
||
|
zzzy zzzyVar = new zzzy();
|
||
|
zzzyVar.zzb = jSONObject.optString("refresh_token", null);
|
||
|
zzzyVar.zzc = jSONObject.optString("access_token", null);
|
||
|
zzzyVar.zzd = Long.valueOf(jSONObject.optLong("expires_in"));
|
||
|
zzzyVar.zze = jSONObject.optString("token_type", null);
|
||
|
zzzyVar.zzf = Long.valueOf(jSONObject.optLong("issued_at"));
|
||
|
return zzzyVar;
|
||
|
} catch (JSONException e) {
|
||
|
Log.d(zza, "Failed to read GetTokenResponse from JSONObject");
|
||
|
throw new zzqx(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.os.Parcelable
|
||
|
public final void writeToParcel(Parcel parcel, int i) {
|
||
|
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
||
|
SafeParcelWriter.writeString(parcel, 2, this.zzb, false);
|
||
|
SafeParcelWriter.writeString(parcel, 3, this.zzc, false);
|
||
|
SafeParcelWriter.writeLongObject(parcel, 4, Long.valueOf(zzb()), false);
|
||
|
SafeParcelWriter.writeString(parcel, 5, this.zze, false);
|
||
|
SafeParcelWriter.writeLongObject(parcel, 6, Long.valueOf(this.zzf.longValue()), false);
|
||
|
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.internal.p002firebaseauthapi.zzxn
|
||
|
public final /* synthetic */ zzxn zza(String str) throws zzvg {
|
||
|
try {
|
||
|
JSONObject jSONObject = new JSONObject(str);
|
||
|
this.zzb = Strings.emptyToNull(jSONObject.optString("refresh_token"));
|
||
|
this.zzc = Strings.emptyToNull(jSONObject.optString("access_token"));
|
||
|
this.zzd = Long.valueOf(jSONObject.optLong("expires_in", 0L));
|
||
|
this.zze = Strings.emptyToNull(jSONObject.optString("token_type"));
|
||
|
this.zzf = Long.valueOf(System.currentTimeMillis());
|
||
|
return this;
|
||
|
} catch (NullPointerException | JSONException e) {
|
||
|
throw zzabk.zza(e, zza, str);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final long zzb() {
|
||
|
Long l = this.zzd;
|
||
|
if (l == null) {
|
||
|
return 0L;
|
||
|
}
|
||
|
return l.longValue();
|
||
|
}
|
||
|
|
||
|
public final long zzc() {
|
||
|
return this.zzf.longValue();
|
||
|
}
|
||
|
|
||
|
public final String zzh() {
|
||
|
JSONObject jSONObject = new JSONObject();
|
||
|
try {
|
||
|
jSONObject.put("refresh_token", this.zzb);
|
||
|
jSONObject.put("access_token", this.zzc);
|
||
|
jSONObject.put("expires_in", this.zzd);
|
||
|
jSONObject.put("token_type", this.zze);
|
||
|
jSONObject.put("issued_at", this.zzf);
|
||
|
return jSONObject.toString();
|
||
|
} catch (JSONException e) {
|
||
|
Log.d(zza, "Failed to convert GetTokenResponse to JSON");
|
||
|
throw new zzqx(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void zzi(String str) {
|
||
|
this.zzb = Preconditions.checkNotEmpty(str);
|
||
|
}
|
||
|
|
||
|
public final boolean zzj() {
|
||
|
return DefaultClock.getInstance().currentTimeMillis() + 300000 < this.zzf.longValue() + (this.zzd.longValue() * 1000);
|
||
|
}
|
||
|
|
||
|
public zzzy(String str, String str2, Long l, String str3) {
|
||
|
this(str, str2, l, str3, Long.valueOf(System.currentTimeMillis()));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public zzzy(String str, String str2, Long l, String str3, Long l2) {
|
||
|
this.zzb = str;
|
||
|
this.zzc = str2;
|
||
|
this.zzd = l;
|
||
|
this.zze = str3;
|
||
|
this.zzf = l2;
|
||
|
}
|
||
|
|
||
|
public final String zzg() {
|
||
|
return this.zze;
|
||
|
}
|
||
|
|
||
|
public final String zzf() {
|
||
|
return this.zzb;
|
||
|
}
|
||
|
|
||
|
public final String zze() {
|
||
|
return this.zzc;
|
||
|
}
|
||
|
}
|