@@ -29,6 +29,8 @@ import { validateIsNotUsedTogether } from '../util/input_validation';
2929export const DEFAULT_HOST = 'firestore.googleapis.com' ;
3030export const DEFAULT_SSL = true ;
3131
32+ const DEFAULT_AUTO_DETECT_LONG_POLLING = false ;
33+
3234/**
3335 * Specifies custom configurations for your Cloud Firestore instance.
3436 * You must set these before invoking any other methods.
@@ -123,17 +125,28 @@ export class FirestoreSettingsImpl {
123125 }
124126 }
125127
126- this . experimentalForceLongPolling = ! ! settings . experimentalForceLongPolling ;
127- this . experimentalAutoDetectLongPolling =
128- ! ! settings . experimentalAutoDetectLongPolling ;
129- this . useFetchStreams = ! ! settings . useFetchStreams ;
130-
131128 validateIsNotUsedTogether (
132129 'experimentalForceLongPolling' ,
133130 settings . experimentalForceLongPolling ,
134131 'experimentalAutoDetectLongPolling' ,
135132 settings . experimentalAutoDetectLongPolling
136133 ) ;
134+
135+ this . experimentalForceLongPolling = ! ! settings . experimentalForceLongPolling ;
136+
137+ if ( this . experimentalForceLongPolling ) {
138+ this . experimentalAutoDetectLongPolling = false ;
139+ } else if ( settings . experimentalAutoDetectLongPolling === undefined ) {
140+ this . experimentalAutoDetectLongPolling = DEFAULT_AUTO_DETECT_LONG_POLLING ;
141+ } else {
142+ // For backwards compatibility, coerce the value to boolean even though
143+ // the TypeScript compiler has narrowed the type to boolean already.
144+ // noinspection PointlessBooleanExpressionJS
145+ this . experimentalAutoDetectLongPolling =
146+ ! ! settings . experimentalAutoDetectLongPolling ;
147+ }
148+
149+ this . useFetchStreams = ! ! settings . useFetchStreams ;
137150 }
138151
139152 isEqual ( other : FirestoreSettingsImpl ) : boolean {
0 commit comments