@@ -31,43 +31,48 @@ void Pipeline::GetPipelineResult(PipelineSnapshotListener callback) const {
31
31
/* include_document_metadata_changes=*/ true ,
32
32
/* wait_for_sync_when_online=*/ true );
33
33
34
- class ListenOnce : public EventListener <std::vector<PipelineResult>> {
35
- public:
36
- ListenOnce (PipelineSnapshotListener listener)
37
- : listener_(std::move(listener)) {
38
- }
39
-
40
- void OnEvent (
41
- StatusOr<std::vector<PipelineResult>> maybe_snapshot) override {
42
- if (!maybe_snapshot.ok ()) {
43
- listener_->OnEvent (std::move (maybe_snapshot));
44
- return ;
45
- }
46
-
47
- std::vector<PipelineResult> snapshot =
48
- std::move (maybe_snapshot).ValueOrDie ();
49
-
50
- // Remove query first before passing event to user to avoid user actions
51
- // affecting the now stale query.
52
- std::unique_ptr<ListenerRegistration> registration =
53
- registration_promise_.get_future ().get ();
54
- registration->Remove ();
55
-
56
- listener_->OnEvent (std::move (snapshot));
57
- };
58
-
59
- void Resolve (std::unique_ptr<ListenerRegistration> registration) {
60
- registration_promise_.set_value (std::move (registration));
61
- }
62
-
63
- private:
64
- PipelineSnapshotListener listener_;
65
-
66
- std::promise<std::unique_ptr<ListenerRegistration>> registration_promise_;
67
- };
68
-
69
- auto listener = absl::make_unique<ListenOnce>(std::move (callback));
70
- auto * listener_unowned = listener.get ();
34
+ callback->OnEvent (StatusOr<std::vector<PipelineResult>>(
35
+ {(PipelineResult::GetTestResult (firestore_))}));
36
+
37
+ // class ListenOnce : public EventListener<std::vector<PipelineResult>> {
38
+ // public:
39
+ // ListenOnce(PipelineSnapshotListener listener)
40
+ // : listener_(std::move(listener)) {
41
+ // }
42
+ //
43
+ // void OnEvent(
44
+ // StatusOr<std::vector<PipelineResult>> maybe_snapshot) override {
45
+ // if (!maybe_snapshot.ok()) {
46
+ // listener_->OnEvent(std::move(maybe_snapshot));
47
+ // return;
48
+ // }
49
+ //
50
+ // std::vector<PipelineResult> snapshot =
51
+ // std::move(maybe_snapshot).ValueOrDie();
52
+ //
53
+ // // Remove query first before passing event to user to avoid user
54
+ // actions
55
+ // // affecting the now stale query.
56
+ // std::unique_ptr<ListenerRegistration> registration =
57
+ // registration_promise_.get_future().get();
58
+ // registration->Remove();
59
+ //
60
+ // listener_->OnEvent(std::move(snapshot));
61
+ // };
62
+ //
63
+ // void Resolve(std::unique_ptr<ListenerRegistration> registration) {
64
+ // registration_promise_.set_value(std::move(registration));
65
+ // }
66
+ //
67
+ // private:
68
+ // PipelineSnapshotListener listener_;
69
+ //
70
+ // std::promise<std::unique_ptr<ListenerRegistration>>
71
+ // registration_promise_;
72
+ // };
73
+ //
74
+ // auto listener = absl::make_unique<ListenOnce>(std::move(callback));
75
+ // auto* listener_unowned = listener.get();
71
76
72
77
// std::unique_ptr<ListenerRegistration> registration =
73
78
// AddSnapshotListener(std::move(options), std::move(listener));
0 commit comments