package com.google.firebase.auth.internal; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; import com.google.android.gms.common.internal.Preconditions; import java.util.Iterator; /* loaded from: classes2.dex */ public final class zzj { private static final zzj zza = new zzj(); private static void zzf(SharedPreferences sharedPreferences) { SharedPreferences.Editor edit = sharedPreferences.edit(); Iterator it = sharedPreferences.getAll().keySet().iterator(); while (it.hasNext()) { edit.remove(it.next()); } edit.apply(); } private static final SharedPreferences zzg(Context context, String str) { return context.getSharedPreferences(String.format("com.google.firebase.auth.internal.browserSignInSessionStore.%s", str), 0); } public final zzi zza(Context context, String str, String str2) { synchronized (this) { Preconditions.checkNotEmpty(str); Preconditions.checkNotEmpty(str2); SharedPreferences zzg = zzg(context, str); String format = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.SESSION_ID", str2); String format2 = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.OPERATION", str2); String format3 = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.PROVIDER_ID", str2); String format4 = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.FIREBASE_APP_NAME", str2); String string = zzg.getString(format, null); String string2 = zzg.getString(format2, null); String string3 = zzg.getString(format3, null); String string4 = zzg.getString("com.google.firebase.auth.api.gms.config.tenant.id", null); String string5 = zzg.getString(format4, null); SharedPreferences.Editor edit = zzg.edit(); edit.remove(format); edit.remove(format2); edit.remove(format3); edit.remove(format4); edit.apply(); if (string == null || string2 == null || string3 == null) { return null; } return new zzi(string, string2, string3, string4, string5); } } public final String zzc(Context context, String str, String str2) { String string; boolean isEmpty; synchronized (this) { Preconditions.checkNotEmpty(str); Preconditions.checkNotEmpty(str2); SharedPreferences zzg = zzg(context, str); String format = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.OPERATION", str2); String string2 = zzg.getString(format, null); String format2 = String.format("com.google.firebase.auth.internal.EVENT_ID.%s.FIREBASE_APP_NAME", str2); string = zzg.getString(format2, null); SharedPreferences.Editor edit = zzg.edit(); edit.remove(format); edit.remove(format2); edit.apply(); isEmpty = TextUtils.isEmpty(string2); } if (isEmpty) { return null; } return string; } public final void zzd(Context context, String str, String str2, String str3, String str4, String str5, String str6, String str7) { synchronized (this) { Preconditions.checkNotEmpty(str); Preconditions.checkNotEmpty(str2); Preconditions.checkNotEmpty(str3); Preconditions.checkNotEmpty(str7); SharedPreferences zzg = zzg(context, str); zzf(zzg); SharedPreferences.Editor edit = zzg.edit(); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.SESSION_ID", str2), str3); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.OPERATION", str2), str4); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.PROVIDER_ID", str2), str5); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.FIREBASE_APP_NAME", str2), str7); edit.putString("com.google.firebase.auth.api.gms.config.tenant.id", str6); edit.apply(); } } public final void zze(Context context, String str, String str2, String str3, String str4) { synchronized (this) { Preconditions.checkNotEmpty(str); Preconditions.checkNotEmpty(str2); SharedPreferences zzg = zzg(context, str); zzf(zzg); SharedPreferences.Editor edit = zzg.edit(); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.OPERATION", str2), "com.google.firebase.auth.internal.ACTION_SHOW_RECAPTCHA"); edit.putString(String.format("com.google.firebase.auth.internal.EVENT_ID.%s.FIREBASE_APP_NAME", str2), str4); edit.apply(); } } public static zzj zzb() { return zza; } private zzj() { } }