Skip to content

Commit 69e733e

Browse files
wilhuffa-maurice
authored andcommitted
Remove LastResult implementations
PiperOrigin-RevId: 319034882
1 parent b1c3695 commit 69e733e

26 files changed

+7
-215
lines changed

firestore/src/android/collection_reference_android.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ Future<DocumentReference> CollectionReferenceInternal::Add(
121121
return promise.GetFuture();
122122
}
123123

124-
Future<DocumentReference> CollectionReferenceInternal::AddLastResult() {
125-
return promises_.LastResult<DocumentReference>(CollectionReferenceFn::kAdd);
126-
}
127-
128124
/* static */
129125
bool CollectionReferenceInternal::Initialize(App* app) {
130126
JNIEnv* env = app->GetJNIEnv();

firestore/src/android/collection_reference_android.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace firestore {
1111

1212
// To make things simple, CollectionReferenceInternal uses the Future management
1313
// from its base class, QueryInternal. Each API of CollectionReference that
14-
// returns a Future needs to define an enum value to QueryFn. For example, Foo()
15-
// and FooLastResult() implementation relies on the enum value QueryFn::kFoo.
16-
// The enum values are used to identify and manage Future in the Firestore
17-
// Future manager.
14+
// returns a Future needs to define an enum value to QueryFn. For example, a
15+
// Future-returning method Foo() relies on the enum value QueryFn::kFoo. The
16+
// enum values are used to identify and manage Future in the Firestore Future
17+
// manager.
1818
using CollectionReferenceFn = QueryFn;
1919

2020
// This is the Android implementation of CollectionReference.
@@ -29,7 +29,6 @@ class CollectionReferenceInternal : public QueryInternal {
2929
DocumentReference Document() const;
3030
DocumentReference Document(const std::string& document_path) const;
3131
Future<DocumentReference> Add(const MapFieldValue& data);
32-
Future<DocumentReference> AddLastResult();
3332

3433
private:
3534
friend class FirestoreInternal;

firestore/src/android/document_reference_android.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ Future<DocumentSnapshot> DocumentReferenceInternal::Get(Source source) {
126126
return promise.GetFuture();
127127
}
128128

129-
Future<DocumentSnapshot> DocumentReferenceInternal::GetLastResult() {
130-
return promises_.LastResult<DocumentSnapshot>(DocumentReferenceFn::kGet);
131-
}
132-
133129
Future<void> DocumentReferenceInternal::Set(const MapFieldValue& data,
134130
const SetOptions& options) {
135131
FieldValueInternal map_value(data);
@@ -149,10 +145,6 @@ Future<void> DocumentReferenceInternal::Set(const MapFieldValue& data,
149145
return promise.GetFuture();
150146
}
151147

152-
Future<void> DocumentReferenceInternal::SetLastResult() {
153-
return promises_.LastResult<void>(DocumentReferenceFn::kSet);
154-
}
155-
156148
Future<void> DocumentReferenceInternal::Update(const MapFieldValue& data) {
157149
FieldValueInternal map_value(data);
158150
JNIEnv* env = firestore_->app()->GetJNIEnv();
@@ -197,10 +189,6 @@ Future<void> DocumentReferenceInternal::Update(const MapFieldPathValue& data) {
197189
return promise.GetFuture();
198190
}
199191

200-
Future<void> DocumentReferenceInternal::UpdateLastResult() {
201-
return promises_.LastResult<void>(DocumentReferenceFn::kUpdate);
202-
}
203-
204192
Future<void> DocumentReferenceInternal::Delete() {
205193
JNIEnv* env = firestore_->app()->GetJNIEnv();
206194
jobject task = env->CallObjectMethod(
@@ -214,10 +202,6 @@ Future<void> DocumentReferenceInternal::Delete() {
214202
return promise.GetFuture();
215203
}
216204

217-
Future<void> DocumentReferenceInternal::DeleteLastResult() {
218-
return promises_.LastResult<void>(DocumentReferenceFn::kDelete);
219-
}
220-
221205
#if defined(FIREBASE_USE_STD_FUNCTION)
222206

223207
ListenerRegistration DocumentReferenceInternal::AddSnapshotListener(

firestore/src/android/document_reference_android.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ class DocumentReferenceInternal : public Wrapper {
8484
*/
8585
Future<DocumentSnapshot> Get(Source source);
8686

87-
/**
88-
* Gets the result of the most recent call to either of the Get() methods.
89-
*
90-
* @return The result of last call to Get() or an invalid Future, if there is
91-
* no such call.
92-
*/
93-
Future<DocumentSnapshot> GetLastResult();
94-
9587
/**
9688
* Writes to this document.
9789
*
@@ -105,15 +97,6 @@ class DocumentReferenceInternal : public Wrapper {
10597
*/
10698
Future<void> Set(const MapFieldValue& data, const SetOptions& options);
10799

108-
/**
109-
* Gets the result of the most recent call to either of the Set()
110-
* methods.
111-
*
112-
* @return The result of last call to Set() or an invalid Future, if there is
113-
* no such call.
114-
*/
115-
Future<void> SetLastResult();
116-
117100
/**
118101
* Updates fields in this document.
119102
*
@@ -137,29 +120,13 @@ class DocumentReferenceInternal : public Wrapper {
137120
*/
138121
Future<void> Update(const MapFieldPathValue& data);
139122

140-
/**
141-
* Gets the result of the most recent call to Update().
142-
*
143-
* @return The result of last call to Update() or an invalid Future, if there
144-
* is no such call.
145-
*/
146-
Future<void> UpdateLastResult();
147-
148123
/**
149124
* Removes this document.
150125
*
151126
* @return A Future that will be resolved when the delete completes.
152127
*/
153128
Future<void> Delete();
154129

155-
/**
156-
* Gets the result of the most recent call to Delete().
157-
*
158-
* @return The result of last call to Delete() or an invalid Future, if there
159-
* is no such call.
160-
*/
161-
Future<void> DeleteLastResult();
162-
163130
#if defined(FIREBASE_USE_STD_FUNCTION)
164131
/**
165132
* @brief Starts listening to the document referenced by this

firestore/src/android/firestore_android.cc

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,6 @@ Future<void> FirestoreInternal::RunTransaction(
411411
}
412412
#endif // defined(FIREBASE_USE_STD_FUNCTION) || defined(DOXYGEN)
413413

414-
Future<void> FirestoreInternal::RunTransactionLastResult() {
415-
return LastResult(FirestoreFn::kRunTransaction);
416-
}
417-
418414
Future<void> FirestoreInternal::DisableNetwork() {
419415
JNIEnv* env = app_->GetJNIEnv();
420416
jobject task = env->CallObjectMethod(
@@ -429,10 +425,6 @@ Future<void> FirestoreInternal::DisableNetwork() {
429425
return promise.GetFuture();
430426
}
431427

432-
Future<void> FirestoreInternal::DisableNetworkLastResult() {
433-
return LastResult(FirestoreFn::kDisableNetwork);
434-
}
435-
436428
Future<void> FirestoreInternal::EnableNetwork() {
437429
JNIEnv* env = app_->GetJNIEnv();
438430
jobject task = env->CallObjectMethod(
@@ -447,10 +439,6 @@ Future<void> FirestoreInternal::EnableNetwork() {
447439
return promise.GetFuture();
448440
}
449441

450-
Future<void> FirestoreInternal::EnableNetworkLastResult() {
451-
return LastResult(FirestoreFn::kEnableNetwork);
452-
}
453-
454442
Future<void> FirestoreInternal::Terminate() {
455443
JNIEnv* env = app_->GetJNIEnv();
456444

@@ -466,10 +454,6 @@ Future<void> FirestoreInternal::Terminate() {
466454
return promise.GetFuture();
467455
}
468456

469-
Future<void> FirestoreInternal::TerminateLastResult() {
470-
return LastResult(FirestoreFn::kTerminate);
471-
}
472-
473457
Future<void> FirestoreInternal::WaitForPendingWrites() {
474458
JNIEnv* env = app_->GetJNIEnv();
475459
jobject task = env->CallObjectMethod(
@@ -484,10 +468,6 @@ Future<void> FirestoreInternal::WaitForPendingWrites() {
484468
return promise.GetFuture();
485469
}
486470

487-
Future<void> FirestoreInternal::WaitForPendingWritesLastResult() {
488-
return LastResult(FirestoreFn::kWaitForPendingWrites);
489-
}
490-
491471
Future<void> FirestoreInternal::ClearPersistence() {
492472
JNIEnv* env = app_->GetJNIEnv();
493473
jobject task = env->CallObjectMethod(
@@ -502,10 +482,6 @@ Future<void> FirestoreInternal::ClearPersistence() {
502482
return promise.GetFuture();
503483
}
504484

505-
Future<void> FirestoreInternal::ClearPersistenceLastResult() {
506-
return LastResult(FirestoreFn::kClearPersistence);
507-
}
508-
509485
ListenerRegistration FirestoreInternal::AddSnapshotsInSyncListener(
510486
EventListener<void>* listener, bool passing_listener_ownership) {
511487
JNIEnv* env = app_->GetJNIEnv();

firestore/src/android/firestore_android.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class WriteBatch;
3333
extern const char kApiIdentifier[];
3434

3535
// Each API of Firestore that returns a Future needs to define an enum
36-
// value here. For example, Foo() and FooLastResult() implementation relies on
37-
// the enum value kFoo. The enum values are used to identify and manage Future
38-
// in the Firestore Future manager.
36+
// value here. For example, a Future-returning method Foo() relies on the enum
37+
// value kFoo. The enum values are used to identify and manage Future in the
38+
// Firestore Future manager.
3939
enum class FirestoreFn {
4040
kEnableNetwork = 0,
4141
kDisableNetwork,
@@ -93,24 +93,18 @@ class FirestoreInternal {
9393
Future<void> RunTransaction(
9494
std::function<Error(Transaction&, std::string&)> update);
9595
#endif // defined(FIREBASE_USE_STD_FUNCTION) || defined(DOXYGEN)
96-
Future<void> RunTransactionLastResult();
9796

9897
// Disables network and gets anything from cache instead of server.
9998
Future<void> DisableNetwork();
100-
Future<void> DisableNetworkLastResult();
10199

102100
// Re-enables network after a prior call to DisableNetwork().
103101
Future<void> EnableNetwork();
104-
Future<void> EnableNetworkLastResult();
105102

106103
Future<void> Terminate();
107-
Future<void> TerminateLastResult();
108104

109105
Future<void> WaitForPendingWrites();
110-
Future<void> WaitForPendingWritesLastResult();
111106

112107
Future<void> ClearPersistence();
113-
Future<void> ClearPersistenceLastResult();
114108

115109
ListenerRegistration AddSnapshotsInSyncListener(
116110
EventListener<void>* listener, bool passing_listener_ownership = false);
@@ -160,11 +154,6 @@ class FirestoreInternal {
160154
return future_manager_.GetFutureApi(this);
161155
}
162156

163-
Future<void> LastResult(FirestoreFn id) {
164-
const auto& result = ref_future()->LastResult(static_cast<int>(id));
165-
return static_cast<const Future<void>&>(result);
166-
}
167-
168157
void ShutdownUserCallbackExecutor();
169158

170159
static bool Initialize(App* app);

firestore/src/android/promise_factory_android.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ class PromiseFactory {
4040
return Promise<PublicT, InternalT, EnumT>{future_api(), firestore_};
4141
}
4242

43-
// A helper that generalizes the logic for FooLastResult() of each Foo()
44-
// defined.
45-
template <typename ResultType>
46-
Future<ResultType> LastResult(EnumT index) {
47-
const auto& result = future_api()->LastResult(static_cast<int>(index));
48-
return static_cast<const Future<ResultType>&>(result);
49-
}
50-
5143
private:
5244
// Gets the reference-counted Future implementation of this instance, which
5345
// can be used to create a Future.

firestore/src/android/query_android.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ Future<QuerySnapshot> QueryInternal::Get(Source source) {
8686
return promise.GetFuture();
8787
}
8888

89-
Future<QuerySnapshot> QueryInternal::GetLastResult() {
90-
return promises_.LastResult<QuerySnapshot>(QueryFn::kGet);
91-
}
92-
9389
/* static */
9490
bool QueryInternal::Initialize(App* app) {
9591
JNIEnv* env = app->GetJNIEnv();

firestore/src/android/query_android.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,6 @@ class QueryInternal : public Wrapper {
389389
*/
390390
virtual Future<QuerySnapshot> Get(Source source);
391391

392-
/**
393-
* @brief Gets the result of the most recent call to either of the Get()
394-
* methods.
395-
*
396-
* @return The result of last call to Get() or an invalid Future, if there is
397-
* no such call.
398-
*/
399-
virtual Future<QuerySnapshot> GetLastResult();
400-
401392
#if defined(FIREBASE_USE_STD_FUNCTION)
402393
/**
403394
* @brief Starts listening to the QuerySnapshot events referenced by this

firestore/src/android/write_batch_android.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ Future<void> WriteBatchInternal::Commit() {
111111
return promise.GetFuture();
112112
}
113113

114-
Future<void> WriteBatchInternal::CommitLastResult() {
115-
return promises_.LastResult<void>(WriteBatchFn::kCommit);
116-
}
117-
118114
/* static */
119115
bool WriteBatchInternal::Initialize(App* app) {
120116
JNIEnv* env = app->GetJNIEnv();

0 commit comments

Comments
 (0)