From da506b86bc7eedb7de7764033477252ea383a4f6 Mon Sep 17 00:00:00 2001 From: Michael Lehenbauer Date: Fri, 12 Jan 2018 15:54:42 -0800 Subject: Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) --- Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m | 1 + Firestore/Source/API/FIRDocumentSnapshot.m | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m b/Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m index f557ee6..9a53e29 100644 --- a/Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m +++ b/Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m @@ -611,6 +611,7 @@ } else if (callbacks == 2) { XCTAssertEqual(docSet.count, 1); + XCTAssertTrue([docSet.documents[0] isKindOfClass:[FIRQueryDocumentSnapshot class]]); XCTAssertEqualObjects(docSet.documents[0].data, newData); XCTAssertEqual(docSet.documents[0].metadata.hasPendingWrites, YES); [changeCompletion fulfill]; diff --git a/Firestore/Source/API/FIRDocumentSnapshot.m b/Firestore/Source/API/FIRDocumentSnapshot.m index 358ddac..80b60e6 100644 --- a/Firestore/Source/API/FIRDocumentSnapshot.m +++ b/Firestore/Source/API/FIRDocumentSnapshot.m @@ -51,10 +51,10 @@ NS_ASSUME_NONNULL_BEGIN documentKey:(FSTDocumentKey *)documentKey document:(nullable FSTDocument *)document fromCache:(BOOL)fromCache { - return [[FIRDocumentSnapshot alloc] initWithFirestore:firestore - documentKey:documentKey - document:document - fromCache:fromCache]; + return [[[self class] alloc] initWithFirestore:firestore + documentKey:documentKey + document:document + fromCache:fromCache]; } @end -- cgit v1.2.3