diff --git a/Firestore/Example/SwiftBuildTest/main.swift b/Firestore/Example/SwiftBuildTest/main.swift index 06d9479f44a..d53b3c63a34 100644 --- a/Firestore/Example/SwiftBuildTest/main.swift +++ b/Firestore/Example/SwiftBuildTest/main.swift @@ -219,11 +219,11 @@ func readDocument(at docRef: DocumentReference) { } func readDocumentWithOptions(at docRef: DocumentReference) { - docRef.getDocument(source: Source.default) { document, error in + docRef.getDocument(source: FirestoreSource.default) { document, error in } docRef.getDocument(source: .server) { document, error in } - docRef.getDocument(source: Source.cache) { document, error in + docRef.getDocument(source: FirestoreSource.cache) { document, error in } } @@ -238,11 +238,11 @@ func readDocuments(matching query: Query) { } func readDocumentsWithOptions(matching query: Query) { - query.getDocuments(source: Source.default) { querySnapshot, error in + query.getDocuments(source: FirestoreSource.default) { querySnapshot, error in } query.getDocuments(source: .server) { querySnapshot, error in } - query.getDocuments(source: Source.cache) { querySnapshot, error in + query.getDocuments(source: FirestoreSource.cache) { querySnapshot, error in } } diff --git a/Firestore/Example/Tests/Integration/API/FIRSourceTests.mm b/Firestore/Example/Tests/Integration/API/FIRSourceTests.mm index f3649c9371b..0f844c6dd14 100644 --- a/Firestore/Example/Tests/Integration/API/FIRSourceTests.mm +++ b/Firestore/Example/Tests/Integration/API/FIRSourceTests.mm @@ -22,10 +22,10 @@ #import "Firestore/Source/API/FIRFirestore+Internal.h" #import "Firestore/Source/Core/FSTFirestoreClient.h" -@interface FIRGetSourceTests : FSTIntegrationTestCase +@interface FIRFirestoreSourceTests : FSTIntegrationTestCase @end -@implementation FIRGetSourceTests +@implementation FIRFirestoreSourceTests - (void)testGetDocumentWhileOnlineWithDefaultSource { FIRDocumentReference *doc = [self documentRef]; @@ -144,7 +144,7 @@ - (void)testGetDocumentWhileOnlineCacheOnly { // get doc and ensure that it exists, *is* from the cache, and matches // the initialData. - FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRGetSourceCache]; + FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRFirestoreSourceCache]; XCTAssertTrue(result.exists); XCTAssertTrue(result.metadata.fromCache); XCTAssertFalse(result.metadata.hasPendingWrites); @@ -164,7 +164,7 @@ - (void)testGetCollectionWhileOnlineCacheOnly { // get docs and ensure they *are* from the cache, and matches the // initialDocs. - FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRGetSourceCache]; + FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRFirestoreSourceCache]; XCTAssertTrue(result.metadata.fromCache); XCTAssertFalse(result.metadata.hasPendingWrites); XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ @@ -200,7 +200,7 @@ - (void)testGetDocumentWhileOfflineCacheOnly { // get doc and ensure it exists, *is* from the cache, and matches the // newData. - FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRGetSourceCache]; + FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRFirestoreSourceCache]; XCTAssertTrue(result.exists); XCTAssertTrue(result.metadata.fromCache); XCTAssertTrue(result.metadata.hasPendingWrites); @@ -230,7 +230,7 @@ - (void)testGetCollectionWhileOfflineCacheOnly { // get docs and ensure they *are* from the cache, and matches the updated // data. - FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRGetSourceCache]; + FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRFirestoreSourceCache]; XCTAssertTrue(result.metadata.fromCache); XCTAssertTrue(result.metadata.hasPendingWrites); XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ @@ -255,7 +255,7 @@ - (void)testGetDocumentWhileOnlineServerOnly { // get doc and ensure that it exists, is *not* from the cache, and matches // the initialData. - FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRGetSourceServer]; + FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRFirestoreSourceServer]; XCTAssertTrue(result.exists); XCTAssertFalse(result.metadata.fromCache); XCTAssertFalse(result.metadata.hasPendingWrites); @@ -275,7 +275,7 @@ - (void)testGetCollectionWhileOnlineServerOnly { // get docs and ensure they are *not* from the cache, and matches the // initialData. - FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRGetSourceServer]; + FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRFirestoreSourceServer]; XCTAssertFalse(result.metadata.fromCache); XCTAssertFalse(result.metadata.hasPendingWrites); XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ @@ -302,7 +302,7 @@ - (void)testGetDocumentWhileOfflineServerOnly { // attempt to get doc and ensure it cannot be retreived XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription:@"failedGetDoc"]; - [doc getDocumentWithSource:FIRGetSourceServer + [doc getDocumentWithSource:FIRFirestoreSourceServer completion:^(FIRDocumentSnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -328,7 +328,7 @@ - (void)testGetCollectionWhileOfflineServerOnly { // attempt to get docs and ensure they cannot be retreived XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"]; - [col getDocumentsWithSource:FIRGetSourceServer + [col getDocumentsWithSource:FIRFirestoreSourceServer completion:^(FIRQuerySnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -367,14 +367,14 @@ - (void)testGetDocumentWhileOfflineWithDifferentSource { // get doc (from cache) and ensure it exists, *is* from the cache, and // matches the newData. - FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRGetSourceCache]; + FIRDocumentSnapshot *result = [self readDocumentForRef:doc source:FIRFirestoreSourceCache]; XCTAssertTrue(result.exists); XCTAssertTrue(result.metadata.fromCache); XCTAssertTrue(result.metadata.hasPendingWrites); XCTAssertEqualObjects(result.data, newData); // attempt to get doc (with default get source) - result = [self readDocumentForRef:doc source:FIRGetSourceDefault]; + result = [self readDocumentForRef:doc source:FIRFirestoreSourceDefault]; XCTAssertTrue(result.exists); XCTAssertTrue(result.metadata.fromCache); XCTAssertTrue(result.metadata.hasPendingWrites); @@ -382,7 +382,7 @@ - (void)testGetDocumentWhileOfflineWithDifferentSource { // attempt to get doc (from the server) and ensure it cannot be retreived XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription:@"failedGetDoc"]; - [doc getDocumentWithSource:FIRGetSourceServer + [doc getDocumentWithSource:FIRFirestoreSourceServer completion:^(FIRDocumentSnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -424,7 +424,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentSource { // get docs (from cache) and ensure they *are* from the cache, and // matches the updated data. - FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRGetSourceCache]; + FIRQuerySnapshot *result = [self readDocumentSetForRef:col source:FIRFirestoreSourceCache]; XCTAssertTrue(result.metadata.fromCache); XCTAssertTrue(result.metadata.hasPendingWrites); XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ @@ -440,7 +440,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentSource { ])); // attempt to get docs (with default get source) - result = [self readDocumentSetForRef:col source:FIRGetSourceDefault]; + result = [self readDocumentSetForRef:col source:FIRFirestoreSourceDefault]; XCTAssertTrue(result.metadata.fromCache); XCTAssertEqualObjects(FIRQuerySnapshotGetData(result), (@[ @{@"key1" : @"value1"}, @{@"key2" : @"value2", @"key2b" : @"value2b"}, @@ -456,7 +456,7 @@ - (void)testGetCollectionWhileOfflineWithDifferentSource { // attempt to get docs (from the server) and ensure they cannot be retreived XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"]; - [col getDocumentsWithSource:FIRGetSourceServer + [col getDocumentsWithSource:FIRFirestoreSourceServer completion:^(FIRQuerySnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -529,7 +529,7 @@ - (void)testGetNonExistingDocWhileOnlineCacheOnly { // certain documents *don't* exist. XCTestExpectation *getNonExistingDocCompletion = [self expectationWithDescription:@"getNonExistingDoc"]; - [doc getDocumentWithSource:FIRGetSourceCache + [doc getDocumentWithSource:FIRFirestoreSourceCache completion:^(FIRDocumentSnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -543,7 +543,7 @@ - (void)testGetNonExistingCollectionWhileOnlineCacheOnly { FIRCollectionReference *col = [self collectionRef]; // get collection and ensure it's empty and that it *is* from the cache. - FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRGetSourceCache]; + FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRFirestoreSourceCache]; XCTAssertEqual(snapshot.count, 0); XCTAssertEqual(snapshot.documentChanges.count, 0); XCTAssertTrue(snapshot.metadata.fromCache); @@ -561,7 +561,7 @@ - (void)testGetNonExistingDocWhileOfflineCacheOnly { // certain documents *don't* exist. XCTestExpectation *getNonExistingDocCompletion = [self expectationWithDescription:@"getNonExistingDoc"]; - [doc getDocumentWithSource:FIRGetSourceCache + [doc getDocumentWithSource:FIRFirestoreSourceCache completion:^(FIRDocumentSnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -578,7 +578,7 @@ - (void)testGetNonExistingCollectionWhileOfflineCacheOnly { [self disableNetwork]; // get collection and ensure it's empty and that it *is* from the cache. - FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRGetSourceCache]; + FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRFirestoreSourceCache]; XCTAssertEqual(snapshot.count, 0); XCTAssertEqual(snapshot.documentChanges.count, 0); XCTAssertTrue(snapshot.metadata.fromCache); @@ -589,7 +589,7 @@ - (void)testGetNonExistingDocWhileOnlineServerOnly { FIRDocumentReference *doc = [self documentRef]; // get doc and ensure that it does not exist and is *not* from the cache. - FIRDocumentSnapshot *snapshot = [self readDocumentForRef:doc source:FIRGetSourceServer]; + FIRDocumentSnapshot *snapshot = [self readDocumentForRef:doc source:FIRFirestoreSourceServer]; XCTAssertFalse(snapshot.exists); XCTAssertFalse(snapshot.metadata.fromCache); XCTAssertFalse(snapshot.metadata.hasPendingWrites); @@ -599,7 +599,7 @@ - (void)testGetNonExistingCollectionWhileOnlineServerOnly { FIRCollectionReference *col = [self collectionRef]; // get collection and ensure that it's empty and that it's *not* from the cache. - FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRGetSourceServer]; + FIRQuerySnapshot *snapshot = [self readDocumentSetForRef:col source:FIRFirestoreSourceServer]; XCTAssertEqual(snapshot.count, 0); XCTAssertEqual(snapshot.documentChanges.count, 0); XCTAssertFalse(snapshot.metadata.fromCache); @@ -617,7 +617,7 @@ - (void)testGetNonExistingDocWhileOfflineServerOnly { // certain documents *don't* exist. XCTestExpectation *getNonExistingDocCompletion = [self expectationWithDescription:@"getNonExistingDoc"]; - [doc getDocumentWithSource:FIRGetSourceServer + [doc getDocumentWithSource:FIRFirestoreSourceServer completion:^(FIRDocumentSnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); @@ -635,7 +635,7 @@ - (void)testGetNonExistingCollectionWhileOfflineServerOnly { // attempt to get collection and ensure that it cannot be retreived XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"]; - [col getDocumentsWithSource:FIRGetSourceServer + [col getDocumentsWithSource:FIRFirestoreSourceServer completion:^(FIRQuerySnapshot *snapshot, NSError *error) { XCTAssertNotNil(error); XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain); diff --git a/Firestore/Example/Tests/Util/FSTIntegrationTestCase.h b/Firestore/Example/Tests/Util/FSTIntegrationTestCase.h index ddff759c38b..ed51b169599 100644 --- a/Firestore/Example/Tests/Util/FSTIntegrationTestCase.h +++ b/Firestore/Example/Tests/Util/FSTIntegrationTestCase.h @@ -20,7 +20,7 @@ #import "Firestore/Example/Tests/Util/XCTestCase+Await.h" #import "Firestore/Source/Core/FSTTypes.h" -#import "FIRGetSource.h" +#import "FIRFirestoreSource.h" @class FIRCollectionReference; @class FIRDocumentSnapshot; @@ -73,11 +73,12 @@ extern "C" { - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref; -- (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref source:(FIRGetSource)source; +- (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref + source:(FIRFirestoreSource)source; - (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query; -- (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query source:(FIRGetSource)source; +- (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query source:(FIRFirestoreSource)source; - (FIRDocumentSnapshot *)readSnapshotForRef:(FIRDocumentReference *)query requireOnline:(BOOL)online; diff --git a/Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm b/Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm index 333b4bc6129..598fe49c39e 100644 --- a/Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm +++ b/Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm @@ -210,11 +210,11 @@ - (void)readerAndWriterOnDocumentRef:(void (^)(NSString *path, } - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref { - return [self readDocumentForRef:ref source:FIRGetSourceDefault]; + return [self readDocumentForRef:ref source:FIRFirestoreSourceDefault]; } - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref - source:(FIRGetSource)source { + source:(FIRFirestoreSource)source { __block FIRDocumentSnapshot *result; XCTestExpectation *expectation = [self expectationWithDescription:@"getData"]; @@ -230,10 +230,10 @@ - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref } - (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query { - return [self readDocumentSetForRef:query source:FIRGetSourceDefault]; + return [self readDocumentSetForRef:query source:FIRFirestoreSourceDefault]; } -- (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query source:(FIRGetSource)source { +- (FIRQuerySnapshot *)readDocumentSetForRef:(FIRQuery *)query source:(FIRFirestoreSource)source { __block FIRQuerySnapshot *result; XCTestExpectation *expectation = [self expectationWithDescription:@"getData"]; diff --git a/Firestore/Source/API/FIRDocumentReference.mm b/Firestore/Source/API/FIRDocumentReference.mm index 90109c46c3b..4fcb27c59fa 100644 --- a/Firestore/Source/API/FIRDocumentReference.mm +++ b/Firestore/Source/API/FIRDocumentReference.mm @@ -19,7 +19,7 @@ #import #import "FIRFirestoreErrors.h" -#import "FIRGetSource.h" +#import "FIRFirestoreSource.h" #import "FIRSnapshotMetadata.h" #import "Firestore/Source/API/FIRCollectionReference+Internal.h" #import "Firestore/Source/API/FIRDocumentReference+Internal.h" @@ -207,13 +207,13 @@ - (void)deleteDocumentWithCompletion:(nullable void (^)(NSError *_Nullable error - (void)getDocumentWithCompletion:(void (^)(FIRDocumentSnapshot *_Nullable document, NSError *_Nullable error))completion { - return [self getDocumentWithSource:FIRGetSourceDefault completion:completion]; + return [self getDocumentWithSource:FIRFirestoreSourceDefault completion:completion]; } -- (void)getDocumentWithSource:(FIRGetSource)source +- (void)getDocumentWithSource:(FIRFirestoreSource)source completion:(void (^)(FIRDocumentSnapshot *_Nullable document, NSError *_Nullable error))completion { - if (source == FIRGetSourceCache) { + if (source == FIRFirestoreSourceCache) { [self.firestore.client getDocumentFromLocalCache:self completion:completion]; return; } @@ -252,16 +252,18 @@ - (void)getDocumentWithSource:(FIRGetSource)source NSLocalizedDescriptionKey : @"Failed to get document because the client is offline.", }]); - } else if (snapshot.exists && snapshot.metadata.fromCache && source == FIRGetSourceServer) { - completion(nil, [NSError errorWithDomain:FIRFirestoreErrorDomain - code:FIRFirestoreErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to get document from server. (However, this " - @"document does exist in the local cache. Run again " - @"without setting source to FIRGetSourceServer to " - @"retrieve the cached document.)" - }]); + } else if (snapshot.exists && snapshot.metadata.fromCache && + source == FIRFirestoreSourceServer) { + completion(nil, + [NSError errorWithDomain:FIRFirestoreErrorDomain + code:FIRFirestoreErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to get document from server. (However, this " + @"document does exist in the local cache. Run again " + @"without setting source to FIRFirestoreSourceServer to " + @"retrieve the cached document.)" + }]); } else { completion(snapshot, nil); } diff --git a/Firestore/Source/API/FIRQuery.mm b/Firestore/Source/API/FIRQuery.mm index af2df4cb4e1..313be214461 100644 --- a/Firestore/Source/API/FIRQuery.mm +++ b/Firestore/Source/API/FIRQuery.mm @@ -18,7 +18,7 @@ #import "FIRDocumentReference.h" #import "FIRFirestoreErrors.h" -#import "FIRGetSource.h" +#import "FIRFirestoreSource.h" #import "Firestore/Source/API/FIRDocumentReference+Internal.h" #import "Firestore/Source/API/FIRDocumentSnapshot+Internal.h" #import "Firestore/Source/API/FIRFieldPath+Internal.h" @@ -131,13 +131,13 @@ - (NSUInteger)hash { - (void)getDocumentsWithCompletion:(void (^)(FIRQuerySnapshot *_Nullable snapshot, NSError *_Nullable error))completion { - [self getDocumentsWithSource:FIRGetSourceDefault completion:completion]; + [self getDocumentsWithSource:FIRFirestoreSourceDefault completion:completion]; } -- (void)getDocumentsWithSource:(FIRGetSource)source +- (void)getDocumentsWithSource:(FIRFirestoreSource)source completion:(void (^)(FIRQuerySnapshot *_Nullable snapshot, NSError *_Nullable error))completion { - if (source == FIRGetSourceCache) { + if (source == FIRFirestoreSourceCache) { [self.firestore.client getDocumentsFromLocalCache:self completion:completion]; return; } @@ -160,16 +160,17 @@ - (void)getDocumentsWithSource:(FIRGetSource)source dispatch_semaphore_wait(registered, DISPATCH_TIME_FOREVER); [listenerRegistration remove]; - if (snapshot.metadata.fromCache && source == FIRGetSourceServer) { - completion(nil, [NSError errorWithDomain:FIRFirestoreErrorDomain - code:FIRFirestoreErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to get documents from server. (However, these " - @"documents may exist in the local cache. Run again " - @"without setting source to FIRGetSourceServer to " - @"retrieve the cached documents.)" - }]); + if (snapshot.metadata.fromCache && source == FIRFirestoreSourceServer) { + completion(nil, + [NSError errorWithDomain:FIRFirestoreErrorDomain + code:FIRFirestoreErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to get documents from server. (However, these " + @"documents may exist in the local cache. Run again " + @"without setting source to FIRFirestoreSourceServer to " + @"retrieve the cached documents.)" + }]); } else { completion(snapshot, nil); } diff --git a/Firestore/Source/Core/FSTFirestoreClient.mm b/Firestore/Source/Core/FSTFirestoreClient.mm index 2c7c85f42a3..97968553960 100644 --- a/Firestore/Source/Core/FSTFirestoreClient.mm +++ b/Firestore/Source/Core/FSTFirestoreClient.mm @@ -291,15 +291,16 @@ - (void)getDocumentFromLocalCache:(FIRDocumentReference *)doc fromCache:YES], nil); } else { - completion(nil, [NSError errorWithDomain:FIRFirestoreErrorDomain - code:FIRFirestoreErrorCodeUnavailable - userInfo:@{ - NSLocalizedDescriptionKey : - @"Failed to get document from cache. (However, this " - @"document may exist on the server. Run again without " - @"setting source to FIRGetSourceCache to attempt to " - @"retrieve the document from the server.)", - }]); + completion(nil, + [NSError errorWithDomain:FIRFirestoreErrorDomain + code:FIRFirestoreErrorCodeUnavailable + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to get document from cache. (However, this " + @"document may exist on the server. Run again without " + @"setting source to FIRFirestoreSourceCache to attempt to " + @"retrieve the document from the server.)", + }]); } }]; } diff --git a/Firestore/Source/Public/FIRDocumentReference.h b/Firestore/Source/Public/FIRDocumentReference.h index 39d95b1ffe3..5b10e3f90c5 100644 --- a/Firestore/Source/Public/FIRDocumentReference.h +++ b/Firestore/Source/Public/FIRDocumentReference.h @@ -16,7 +16,7 @@ #import -#import "FIRGetSource.h" +#import "FIRFirestoreSource.h" #import "FIRListenerRegistration.h" @class FIRFirestore; @@ -210,7 +210,7 @@ NS_SWIFT_NAME(DocumentReference) * @param completion a block to execute once the document has been successfully read. */ // clang-format off -- (void)getDocumentWithSource:(FIRGetSource)source completion:(FIRDocumentSnapshotBlock)completion +- (void)getDocumentWithSource:(FIRFirestoreSource)source completion:(FIRDocumentSnapshotBlock)completion NS_SWIFT_NAME(getDocument(source:completion:)); // clang-format on diff --git a/Firestore/Source/Public/FIRGetSource.h b/Firestore/Source/Public/FIRFirestoreSource.h similarity index 92% rename from Firestore/Source/Public/FIRGetSource.h rename to Firestore/Source/Public/FIRFirestoreSource.h index 0ecc6c1f0d0..c1337475ffa 100644 --- a/Firestore/Source/Public/FIRGetSource.h +++ b/Firestore/Source/Public/FIRFirestoreSource.h @@ -41,8 +41,8 @@ * `QuerySnapshot.getDocuments()` will return an empty `QuerySnapshot` with no * documents. */ -typedef NS_ENUM(NSUInteger, FIRGetSource) { - FIRGetSourceDefault, - FIRGetSourceServer, - FIRGetSourceCache -} NS_SWIFT_NAME(Source); +typedef NS_ENUM(NSUInteger, FIRFirestoreSource) { + FIRFirestoreSourceDefault, + FIRFirestoreSourceServer, + FIRFirestoreSourceCache +} NS_SWIFT_NAME(FirestoreSource); diff --git a/Firestore/Source/Public/FIRQuery.h b/Firestore/Source/Public/FIRQuery.h index b852fffd0f3..52255998b70 100644 --- a/Firestore/Source/Public/FIRQuery.h +++ b/Firestore/Source/Public/FIRQuery.h @@ -16,7 +16,7 @@ #import -#import "FIRGetSource.h" +#import "FIRFirestoreSource.h" #import "FIRListenerRegistration.h" @class FIRFieldPath; @@ -106,7 +106,7 @@ NS_SWIFT_NAME(Query) * documentSet will be `nil` only if error is `non-nil`. */ // clang-format off -- (void)getDocumentsWithSource:(FIRGetSource)source completion:(FIRQuerySnapshotBlock)completion +- (void)getDocumentsWithSource:(FIRFirestoreSource)source completion:(FIRQuerySnapshotBlock)completion NS_SWIFT_NAME(getDocuments(source:completion:)); // clang-format on