2
0
mirror of synced 2025-01-23 12:50:05 +00:00

[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

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