[android][database] fix boolean issue
This commit is contained in:
parent
a94943bfc0
commit
99dfdfc982
|
@ -491,15 +491,16 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
|
||||||
private FirebaseDatabase getDatabaseForApp(String appName) {
|
private FirebaseDatabase getDatabaseForApp(String appName) {
|
||||||
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
||||||
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(firebaseApp);
|
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(firebaseApp);
|
||||||
|
Boolean logLevel = loggingLevelSet.get(firebaseDatabase.getApp().getName());
|
||||||
|
|
||||||
if (enableLogging && !loggingLevelSet.get(firebaseDatabase.getApp().getName())) {
|
if (enableLogging && (logLevel == null || !logLevel)) {
|
||||||
try {
|
try {
|
||||||
loggingLevelSet.put(firebaseDatabase.getApp().getName(), enableLogging);
|
loggingLevelSet.put(firebaseDatabase.getApp().getName(), enableLogging);
|
||||||
firebaseDatabase.setLogLevel(Logger.Level.DEBUG);
|
firebaseDatabase.setLogLevel(Logger.Level.DEBUG);
|
||||||
} catch (DatabaseException dex) {
|
} catch (DatabaseException dex) {
|
||||||
// do nothing - to catch 'calls to setLogLevel must be made for use of database' errors
|
// do nothing - to catch 'calls to setLogLevel must be made for use of database' errors
|
||||||
}
|
}
|
||||||
} else if (!enableLogging && loggingLevelSet.get(firebaseDatabase.getApp().getName())) {
|
} else if (!enableLogging && (logLevel != null && logLevel)) {
|
||||||
try {
|
try {
|
||||||
loggingLevelSet.put(firebaseDatabase.getApp().getName(), enableLogging);
|
loggingLevelSet.put(firebaseDatabase.getApp().getName(), enableLogging);
|
||||||
firebaseDatabase.setLogLevel(Logger.Level.WARN);
|
firebaseDatabase.setLogLevel(Logger.Level.WARN);
|
||||||
|
|
Loading…
Reference in New Issue