[android][database] added `enableLogging(boolean)` method
This commit is contained in:
parent
7efb14f5b0
commit
621df87145
|
@ -90,7 +90,7 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
|
|||
List<FirebaseApp> firebaseAppList = FirebaseApp.getApps(getReactApplicationContext());
|
||||
for (FirebaseApp app : firebaseAppList) {
|
||||
if (enableLogging) {
|
||||
FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.INFO);
|
||||
FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.DEBUG);
|
||||
} else {
|
||||
FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.WARN);
|
||||
}
|
||||
|
@ -484,9 +484,17 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
|
|||
* @param appName
|
||||
* @return
|
||||
*/
|
||||
static FirebaseDatabase getDatabaseForApp(String appName) {
|
||||
private FirebaseDatabase getDatabaseForApp(String appName) {
|
||||
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
||||
return FirebaseDatabase.getInstance(firebaseApp);
|
||||
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(firebaseApp);
|
||||
|
||||
if (enableLogging) {
|
||||
firebaseDatabase.setLogLevel(Logger.Level.DEBUG);
|
||||
} else {
|
||||
firebaseDatabase.setLogLevel(Logger.Level.WARN);
|
||||
}
|
||||
|
||||
return firebaseDatabase;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.facebook.react.bridge.WritableMap;
|
|||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.database.Query;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
|
@ -345,7 +346,8 @@ class RNFirebaseDatabaseReference {
|
|||
* @return
|
||||
*/
|
||||
private void buildDatabaseQueryAtPathAndModifiers(String path, ReadableArray modifiers) {
|
||||
FirebaseDatabase firebaseDatabase = RNFirebaseDatabase.getDatabaseForApp(appName);
|
||||
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
||||
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(firebaseApp);
|
||||
|
||||
query = firebaseDatabase.getReference(path);
|
||||
List<Object> modifiersList = Utils.recursivelyDeconstructReadableArray(modifiers);
|
||||
|
|
Loading…
Reference in New Issue