@@ -194,32 +194,15 @@ class FirestoreSettings {
194
194
// Nobody should set timestampsInSnapshots anymore, but the error depends on
195
195
// whether they set it to true or false...
196
196
if ( settings . timestampsInSnapshots === true ) {
197
- logError ( `
198
- The timestampsInSnapshots setting now defaults to true and you no
199
- longer need to explicitly set it. In a future release, the setting
200
- will be removed entirely and so it is recommended that you remove it
201
- from your firestore.settings() call now.` ) ;
197
+ logError (
198
+ "The setting 'timestampsInSnapshots: true' is no longer required " +
199
+ 'and should be removed.'
200
+ ) ;
202
201
} else if ( settings . timestampsInSnapshots === false ) {
203
- logError ( `
204
- The timestampsInSnapshots setting will soon be removed. YOU MUST UPDATE
205
- YOUR CODE.
206
-
207
- To hide this warning, stop using the timestampsInSnapshots setting in your
208
- firestore.settings({ ... }) call.
209
-
210
- Once you remove the setting, Timestamps stored in Cloud Firestore will be
211
- read back as Firebase Timestamp objects instead of as system Date objects.
212
- So you will also need to update code expecting a Date to instead expect a
213
- Timestamp. For example:
214
-
215
- // Old:
216
- const date = snapshot.get('created_at');
217
- // New:
218
- const timestamp = snapshot.get('created_at'); const date =
219
- timestamp.toDate();
220
-
221
- Please audit all existing usages of Date when you enable the new
222
- behavior.` ) ;
202
+ logError (
203
+ "Support for 'timestampsInSnapshots: false' will be removed soon. " +
204
+ 'You must update your code to handle Timestamp objects.'
205
+ ) ;
223
206
}
224
207
this . timestampsInSnapshots =
225
208
settings . timestampsInSnapshots ?? DEFAULT_TIMESTAMPS_IN_SNAPSHOTS ;
@@ -338,14 +321,6 @@ export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
338
321
validateExactNumberOfArgs ( 'Firestore.settings' , arguments , 1 ) ;
339
322
validateArgType ( 'Firestore.settings' , 'object' , 1 , settingsLiteral ) ;
340
323
341
- if ( contains ( settingsLiteral , 'persistence' ) ) {
342
- throw new FirestoreError (
343
- Code . INVALID_ARGUMENT ,
344
- '"persistence" is now specified with a separate call to ' +
345
- 'firestore.enablePersistence().'
346
- ) ;
347
- }
348
-
349
324
const newSettings = new FirestoreSettings ( settingsLiteral ) ;
350
325
if ( this . _firestoreClient && ! this . _settings . isEqual ( newSettings ) ) {
351
326
throw new FirestoreError (
@@ -387,10 +362,7 @@ export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
387
362
if ( settings ) {
388
363
if ( settings . experimentalTabSynchronization !== undefined ) {
389
364
logError (
390
- "The 'experimentalTabSynchronization' setting has been renamed to " +
391
- "'synchronizeTabs'. In a future release, the setting will be removed " +
392
- 'and it is recommended that you update your ' +
393
- "firestore.enablePersistence() call to use 'synchronizeTabs'."
365
+ "The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."
394
366
) ;
395
367
}
396
368
synchronizeTabs =
@@ -2305,42 +2277,6 @@ export class QuerySnapshot<T = firestore.DocumentData>
2305
2277
}
2306
2278
}
2307
2279
2308
- // TODO(2018/11/01): As of 2018/04/17 we're changing docChanges from an array
2309
- // into a method. Because this is a runtime breaking change and somewhat subtle
2310
- // (both Array and Function have a .length, etc.), we'll replace commonly-used
2311
- // properties (including Symbol.iterator) to throw a custom error message. In
2312
- // ~6 months we can delete the custom error as most folks will have hopefully
2313
- // migrated.
2314
- function throwDocChangesMethodError ( ) : never {
2315
- throw new FirestoreError (
2316
- Code . INVALID_ARGUMENT ,
2317
- 'QuerySnapshot.docChanges has been changed from a property into a ' +
2318
- 'method, so usages like "querySnapshot.docChanges" should become ' +
2319
- '"querySnapshot.docChanges()"'
2320
- ) ;
2321
- }
2322
-
2323
- const docChangesPropertiesToOverride = [
2324
- 'length' ,
2325
- 'forEach' ,
2326
- 'map' ,
2327
- ...( typeof Symbol !== 'undefined' ? [ Symbol . iterator ] : [ ] )
2328
- ] ;
2329
- docChangesPropertiesToOverride . forEach ( property => {
2330
- /**
2331
- * We are (re-)defining properties on QuerySnapshot.prototype.docChanges which
2332
- * is a Function. This could fail, in particular in the case of 'length' which
2333
- * already exists on Function.prototype and on IE11 is improperly defined with
2334
- * `{ configurable: false }`. So we wrap this in a try/catch to ensure that we
2335
- * still have a functional SDK.
2336
- */
2337
- try {
2338
- Object . defineProperty ( QuerySnapshot . prototype . docChanges , property , {
2339
- get : ( ) => throwDocChangesMethodError ( )
2340
- } ) ;
2341
- } catch ( err ) { } // Ignore this failure intentionally
2342
- } ) ;
2343
-
2344
2280
export class CollectionReference < T = firestore . DocumentData > extends Query < T >
2345
2281
implements firestore . CollectionReference < T > {
2346
2282
constructor (
0 commit comments