28
28
#import " Firestore/Example/Tests/Util/FSTHelpers.h"
29
29
30
30
#include " Firestore/core/src/firebase/firestore/model/types.h"
31
+ #include " Firestore/core/src/firebase/firestore/remote/remote_event.h"
31
32
#include " Firestore/core/src/firebase/firestore/util/executor_libdispatch.h"
32
33
#include " absl/memory/memory.h"
33
34
34
35
using firebase::firestore::core::DocumentViewChangeType;
35
36
using firebase::firestore::model::DocumentKeySet;
36
37
using firebase::firestore::model::OnlineState;
38
+ using firebase::firestore::remote::TargetChange;
37
39
using firebase::firestore::util::ExecutorLibdispatch;
38
40
39
41
NS_ASSUME_NONNULL_BEGIN
@@ -84,8 +86,8 @@ - (void)testRaisesCollectionEvents {
84
86
FSTQueryListener *otherListener = [self listenToQuery: query accumulatingSnapshots: otherAccum];
85
87
86
88
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
87
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], nil );
88
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2prime ], nil );
89
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], absl::nullopt );
90
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2prime ], absl::nullopt );
89
91
90
92
FSTDocumentViewChange *change1 =
91
93
[FSTDocumentViewChange changeWithDocument: doc1 type:DocumentViewChangeType: :kAdded ];
@@ -142,7 +144,7 @@ - (void)testRaisesEventForEmptyCollectionAfterSync {
142
144
accumulatingSnapshots: accum];
143
145
144
146
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
145
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], nil );
147
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], absl::nullopt );
146
148
FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[], FSTTestTargetChangeMarkCurrent ());
147
149
148
150
[listener queryDidChangeViewSnapshot: snap1];
@@ -167,8 +169,8 @@ - (void)testMutingAsyncListenerPreventsAllSubsequentEvents {
167
169
}];
168
170
169
171
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
170
- FSTViewSnapshot *viewSnapshot1 = FSTTestApplyChanges (view, @[ doc1 ], nil );
171
- FSTViewSnapshot *viewSnapshot2 = FSTTestApplyChanges (view, @[ doc2 ], nil );
172
+ FSTViewSnapshot *viewSnapshot1 = FSTTestApplyChanges (view, @[ doc1 ], absl::nullopt );
173
+ FSTViewSnapshot *viewSnapshot2 = FSTTestApplyChanges (view, @[ doc2 ], absl::nullopt );
172
174
173
175
FSTViewSnapshotHandler handler = listener.asyncSnapshotHandler ;
174
176
handler (viewSnapshot1, nil );
@@ -204,11 +206,11 @@ - (void)testDoesNotRaiseEventsForMetadataChangesUnlessSpecified {
204
206
accumulatingSnapshots: fullAccum];
205
207
206
208
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
207
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], nil );
209
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], absl::nullopt );
208
210
209
- FSTTargetChange * ackTarget = FSTTestTargetChangeAckDocuments ({doc1.key });
211
+ TargetChange ackTarget = FSTTestTargetChangeAckDocuments ({doc1.key });
210
212
FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[], ackTarget);
211
- FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc2 ], nil );
213
+ FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc2 ], absl::nullopt );
212
214
213
215
[filteredListener queryDidChangeViewSnapshot: snap1]; // local event
214
216
[filteredListener queryDidChangeViewSnapshot: snap2]; // no event
@@ -248,9 +250,9 @@ - (void)testRaisesDocumentMetadataEventsOnlyWhenSpecified {
248
250
accumulatingSnapshots: fullAccum];
249
251
250
252
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
251
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], nil );
252
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime ], nil );
253
- FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc3 ], nil );
253
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], absl::nullopt );
254
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime ], absl::nullopt );
255
+ FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc3 ], absl::nullopt );
254
256
255
257
FSTDocumentViewChange *change1 =
256
258
[FSTDocumentViewChange changeWithDocument: doc1 type:DocumentViewChangeType: :kAdded ];
@@ -303,10 +305,10 @@ - (void)testRaisesQueryMetadataEventsOnlyWhenHasPendingWritesOnTheQueryChanges {
303
305
accumulatingSnapshots: fullAccum];
304
306
305
307
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
306
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], nil );
307
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime ], nil );
308
- FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc3 ], nil );
309
- FSTViewSnapshot *snap4 = FSTTestApplyChanges (view, @[ doc2Prime ], nil );
308
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], absl::nullopt );
309
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime ], absl::nullopt );
310
+ FSTViewSnapshot *snap3 = FSTTestApplyChanges (view, @[ doc3 ], absl::nullopt );
311
+ FSTViewSnapshot *snap4 = FSTTestApplyChanges (view, @[ doc2Prime ], absl::nullopt );
310
312
311
313
[fullListener queryDidChangeViewSnapshot: snap1];
312
314
[fullListener queryDidChangeViewSnapshot: snap2]; // Emits no events.
@@ -343,8 +345,8 @@ - (void)testMetadataOnlyDocumentChangesAreFilteredOutWhenIncludeDocumentMetadata
343
345
accumulatingSnapshots: filteredAccum];
344
346
345
347
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
346
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], nil );
347
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime, doc3 ], nil );
348
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1, doc2 ], absl::nullopt );
349
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc1Prime, doc3 ], absl::nullopt );
348
350
349
351
FSTDocumentViewChange *change3 =
350
352
[FSTDocumentViewChange changeWithDocument: doc3 type:DocumentViewChangeType: :kAdded ];
@@ -378,8 +380,8 @@ - (void)testWillWaitForSyncIfOnline {
378
380
accumulatingSnapshots: events];
379
381
380
382
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
381
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], nil );
382
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2 ], nil );
383
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], absl::nullopt );
384
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2 ], absl::nullopt );
383
385
FSTViewSnapshot *snap3 =
384
386
FSTTestApplyChanges (view, @[], FSTTestTargetChangeAckDocuments ({doc1.key , doc2.key }));
385
387
@@ -420,8 +422,8 @@ - (void)testWillRaiseInitialEventWhenGoingOffline {
420
422
accumulatingSnapshots: events];
421
423
422
424
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
423
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], nil );
424
- FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2 ], nil );
425
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[ doc1 ], absl::nullopt );
426
+ FSTViewSnapshot *snap2 = FSTTestApplyChanges (view, @[ doc2 ], absl::nullopt );
425
427
426
428
[listener applyChangedOnlineState: OnlineState: :Online]; // no event
427
429
[listener queryDidChangeViewSnapshot: snap1]; // no event
@@ -463,7 +465,7 @@ - (void)testWillRaiseInitialEventWhenGoingOfflineAndThereAreNoDocs {
463
465
accumulatingSnapshots: events];
464
466
465
467
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
466
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], nil );
468
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], absl::nullopt );
467
469
468
470
[listener applyChangedOnlineState: OnlineState: :Online]; // no event
469
471
[listener queryDidChangeViewSnapshot: snap1]; // no event
@@ -490,7 +492,7 @@ - (void)testWillRaiseInitialEventWhenStartingOfflineAndThereAreNoDocs {
490
492
accumulatingSnapshots: events];
491
493
492
494
FSTView *view = [[FSTView alloc ] initWithQuery: query remoteDocuments: DocumentKeySet{}];
493
- FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], nil );
495
+ FSTViewSnapshot *snap1 = FSTTestApplyChanges (view, @[], absl::nullopt );
494
496
495
497
[listener applyChangedOnlineState: OnlineState: :Offline]; // no event
496
498
[listener queryDidChangeViewSnapshot: snap1]; // event
0 commit comments