@@ -106,7 +106,8 @@ import {
106
106
validateOptionNames ,
107
107
validatePositiveNumber ,
108
108
validateStringEnum ,
109
- valueDescription
109
+ valueDescription ,
110
+ validateIsNotUsedTogether
110
111
} from '../util/input_validation' ;
111
112
import { getLogLevel , logError , LogLevel , setLogLevel } from '../util/log' ;
112
113
import { AutoId } from '../util/misc' ;
@@ -146,6 +147,7 @@ const DEFAULT_HOST = 'firestore.googleapis.com';
146
147
const DEFAULT_SSL = true ;
147
148
const DEFAULT_TIMESTAMPS_IN_SNAPSHOTS = true ;
148
149
const DEFAULT_FORCE_LONG_POLLING = false ;
150
+ const DEFAULT_FORCE_AUTO_DETECT_LONG_POLLING = false ;
149
151
const DEFAULT_IGNORE_UNDEFINED_PROPERTIES = false ;
150
152
151
153
/**
@@ -191,6 +193,8 @@ class FirestoreSettings {
191
193
192
194
readonly experimentalForceLongPolling : boolean ;
193
195
196
+ readonly experimentalAutoDetectLongPolling : boolean ;
197
+
194
198
readonly ignoreUndefinedProperties : boolean ;
195
199
196
200
// Can be a google-auth-library or gapi client.
@@ -221,6 +225,7 @@ class FirestoreSettings {
221
225
'timestampsInSnapshots' ,
222
226
'cacheSizeBytes' ,
223
227
'experimentalForceLongPolling' ,
228
+ 'experimentalAutoDetectLongPolling' ,
224
229
'ignoreUndefinedProperties'
225
230
] ) ;
226
231
@@ -294,6 +299,23 @@ class FirestoreSettings {
294
299
) ;
295
300
this . experimentalForceLongPolling =
296
301
settings . experimentalForceLongPolling ?? DEFAULT_FORCE_LONG_POLLING ;
302
+
303
+ validateNamedOptionalType (
304
+ 'settings' ,
305
+ 'boolean' ,
306
+ 'experimentalAutoDetectLongPolling' ,
307
+ settings . experimentalAutoDetectLongPolling
308
+ ) ;
309
+ this . experimentalAutoDetectLongPolling =
310
+ settings . experimentalAutoDetectLongPolling ??
311
+ DEFAULT_FORCE_AUTO_DETECT_LONG_POLLING ;
312
+
313
+ validateIsNotUsedTogether (
314
+ 'experimentalForceLongPolling' ,
315
+ settings . experimentalForceLongPolling ,
316
+ 'experimentalAutoDetectLongPolling' ,
317
+ settings . experimentalAutoDetectLongPolling
318
+ ) ;
297
319
}
298
320
299
321
isEqual ( other : FirestoreSettings ) : boolean {
@@ -305,6 +327,8 @@ class FirestoreSettings {
305
327
this . cacheSizeBytes === other . cacheSizeBytes &&
306
328
this . experimentalForceLongPolling ===
307
329
other . experimentalForceLongPolling &&
330
+ this . experimentalAutoDetectLongPolling ===
331
+ other . experimentalAutoDetectLongPolling &&
308
332
this . ignoreUndefinedProperties === other . ignoreUndefinedProperties
309
333
) ;
310
334
}
@@ -552,7 +576,8 @@ export class Firestore implements PublicFirestore, FirebaseService {
552
576
this . _persistenceKey ,
553
577
this . _settings . host ,
554
578
this . _settings . ssl ,
555
- this . _settings . experimentalForceLongPolling
579
+ this . _settings . experimentalForceLongPolling ,
580
+ this . _settings . experimentalAutoDetectLongPolling
556
581
) ;
557
582
}
558
583
0 commit comments