what-the-bank/sources/com/google/firebase/firestore/FirestoreMultiDbComponent.java

47 lines
2.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.firestore;
import android.content.Context;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseAppLifecycleListener;
import com.google.firebase.appcheck.interop.InternalAppCheckTokenProvider;
import com.google.firebase.auth.internal.InternalAuthProvider;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.remote.GrpcMetadataProvider;
import com.google.firebase.inject.Deferred;
import java.util.HashMap;
import java.util.Map;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class FirestoreMultiDbComponent implements FirebaseAppLifecycleListener, FirebaseFirestore.InstanceRegistry {
private final FirebaseApp app;
private final Deferred<InternalAppCheckTokenProvider> appCheckProvider;
private final Deferred<InternalAuthProvider> authProvider;
private final Context context;
private final Map<String, FirebaseFirestore> instances = new HashMap();
private final GrpcMetadataProvider metadataProvider;
/* JADX INFO: Access modifiers changed from: package-private */
public FirestoreMultiDbComponent(Context context, FirebaseApp firebaseApp, Deferred<InternalAuthProvider> deferred, Deferred<InternalAppCheckTokenProvider> deferred2, GrpcMetadataProvider grpcMetadataProvider) {
this.context = context;
this.app = firebaseApp;
this.authProvider = deferred;
this.appCheckProvider = deferred2;
this.metadataProvider = grpcMetadataProvider;
firebaseApp.addLifecycleEventListener(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
public FirebaseFirestore get(String str) {
FirebaseFirestore firebaseFirestore;
synchronized (this) {
firebaseFirestore = this.instances.get(str);
if (firebaseFirestore == null) {
firebaseFirestore = FirebaseFirestore.newInstance(this.context, this.app, this.authProvider, this.appCheckProvider, str, this, this.metadataProvider);
this.instances.put(str, firebaseFirestore);
}
}
return firebaseFirestore;
}
}