|
63 | 63 | #include "Firestore/core/src/util/exception.h" |
64 | 64 | #include "Firestore/core/src/util/statusor.h" |
65 | 65 | #include "Firestore/core/src/util/string_apple.h" |
66 | | -#include "Firestore/core/interfaceForSwift/api/pipeline.h" |
67 | | -#include "Firestore/core/interfaceForSwift/api/pipeline_result.h" |
68 | 66 | #include "absl/strings/match.h" |
69 | 67 |
|
70 | 68 | namespace nanopb = firebase::firestore::nanopb; |
|
73 | 71 | using firebase::firestore::google_firestore_v1_Value_fields; |
74 | 72 | using firebase::firestore::api::Firestore; |
75 | 73 | using firebase::firestore::api::MakeListenSource; |
76 | | -using firebase::firestore::api::PipelineResult; |
77 | | -using firebase::firestore::api::PipelineSnapshotListener; |
78 | 74 | using firebase::firestore::api::Query; |
79 | 75 | using firebase::firestore::api::QueryListenerRegistration; |
80 | 76 | using firebase::firestore::api::QuerySnapshot; |
@@ -179,35 +175,6 @@ - (void)getDocumentsWithCompletion:(void (^)(FIRQuerySnapshot *_Nullable snapsho |
179 | 175 | _query.GetDocuments(Source::Default, [self wrapQuerySnapshotBlock:completion]); |
180 | 176 | } |
181 | 177 |
|
182 | | -+ (PipelineSnapshotListener) |
183 | | - wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore |
184 | | - completion:(void (^)(std::shared_ptr<std::vector<PipelineResult>> result, |
185 | | - NSError *_Nullable error))completion { |
186 | | - class Converter : public EventListener<std::vector<PipelineResult>> { |
187 | | - public: |
188 | | - explicit Converter(std::shared_ptr<api::Firestore> firestore, PipelineBlock completion) |
189 | | - : firestore_(firestore), completion_(completion) { |
190 | | - } |
191 | | - |
192 | | - void OnEvent(StatusOr<std::vector<PipelineResult>> maybe_snapshot) override { |
193 | | - if (maybe_snapshot.ok()) { |
194 | | - completion_( |
195 | | - std::make_shared<std::vector<PipelineResult>>( |
196 | | - std::initializer_list<PipelineResult>{PipelineResult::GetTestResult(firestore_)}), |
197 | | - nullptr); |
198 | | - } else { |
199 | | - completion_(nullptr, MakeNSError(maybe_snapshot.status())); |
200 | | - } |
201 | | - } |
202 | | - |
203 | | - private: |
204 | | - std::shared_ptr<api::Firestore> firestore_; |
205 | | - PipelineBlock completion_; |
206 | | - }; |
207 | | - |
208 | | - return absl::make_unique<Converter>(firestore, completion); |
209 | | -} |
210 | | - |
211 | 178 | - (void)getDocumentsWithSource:(FIRFirestoreSource)publicSource |
212 | 179 | completion:(void (^)(FIRQuerySnapshot *_Nullable snapshot, |
213 | 180 | NSError *_Nullable error))completion { |
@@ -567,29 +534,6 @@ void OnEvent(StatusOr<QuerySnapshot> maybe_snapshot) override { |
567 | 534 | return absl::make_unique<Converter>(block); |
568 | 535 | } |
569 | 536 |
|
570 | | -+ (QuerySnapshotListener)wrapPipelineCallbackBlock:(FIRQuerySnapshotBlock)block { |
571 | | - class Converter : public EventListener<QuerySnapshot> { |
572 | | - public: |
573 | | - explicit Converter(FIRQuerySnapshotBlock block) : block_(block) { |
574 | | - } |
575 | | - |
576 | | - void OnEvent(StatusOr<QuerySnapshot> maybe_snapshot) override { |
577 | | - if (maybe_snapshot.ok()) { |
578 | | - FIRQuerySnapshot *result = |
579 | | - [[FIRQuerySnapshot alloc] initWithSnapshot:std::move(maybe_snapshot).ValueOrDie()]; |
580 | | - block_(result, nil); |
581 | | - } else { |
582 | | - block_(nil, MakeNSError(maybe_snapshot.status())); |
583 | | - } |
584 | | - } |
585 | | - |
586 | | - private: |
587 | | - FIRQuerySnapshotBlock block_; |
588 | | - }; |
589 | | - |
590 | | - return absl::make_unique<Converter>(block); |
591 | | -} |
592 | | - |
593 | 537 | - (Filter)parseFieldFilter:(FSTUnaryFilter *)unaryFilter { |
594 | 538 | auto describer = [&unaryFilter] { |
595 | 539 | return MakeString(NSStringFromClass([unaryFilter.value class])); |
|
0 commit comments