[android][firestore] Ensure settings are preserved if `settings` is called multiple times

This commit is contained in:
Chris Bianca 2018-05-18 07:58:32 +01:00
parent 4a362bd786
commit 1f814d4cab
1 changed files with 6 additions and 0 deletions

View File

@ -205,12 +205,18 @@ public class RNFirebaseFirestore extends ReactContextBaseJavaModule {
FirebaseFirestoreSettings.Builder firestoreSettings = new FirebaseFirestoreSettings.Builder();
if (settings.hasKey("host")) {
firestoreSettings.setHost(settings.getString("host"));
} else {
firestoreSettings.setHost(firestore.getFirestoreSettings().getHost());
}
if (settings.hasKey("persistence")) {
firestoreSettings.setPersistenceEnabled(settings.getBoolean("persistence"));
} else {
firestoreSettings.setPersistenceEnabled(firestore.getFirestoreSettings().isPersistenceEnabled());
}
if (settings.hasKey("ssl")) {
firestoreSettings.setSslEnabled(settings.getBoolean("ssl"));
} else {
firestoreSettings.setSslEnabled(firestore.getFirestoreSettings().isSslEnabled());
}
if (settings.hasKey("timestampsInSnapshots")) {
// TODO: Not supported on Android yet