aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Core/FSTView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/Source/Core/FSTView.mm')
-rw-r--r--Firestore/Source/Core/FSTView.mm29
1 files changed, 20 insertions, 9 deletions
diff --git a/Firestore/Source/Core/FSTView.mm b/Firestore/Source/Core/FSTView.mm
index b3cf189..d87951a 100644
--- a/Firestore/Source/Core/FSTView.mm
+++ b/Firestore/Source/Core/FSTView.mm
@@ -16,15 +16,20 @@
#import "Firestore/Source/Core/FSTView.h"
+#include <utility>
+
#import "Firestore/Source/Core/FSTQuery.h"
#import "Firestore/Source/Core/FSTViewSnapshot.h"
#import "Firestore/Source/Model/FSTDocument.h"
-#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Model/FSTFieldValue.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
#import "Firestore/Source/Util/FSTAssert.h"
+#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+
+using firebase::firestore::model::DocumentKey;
+
NS_ASSUME_NONNULL_BEGIN
#pragma mark - FSTViewDocumentChanges
@@ -61,28 +66,34 @@ NS_ASSUME_NONNULL_BEGIN
@interface FSTLimboDocumentChange ()
-+ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key;
++ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key;
- (instancetype)initWithType:(FSTLimboDocumentChangeType)type
- key:(FSTDocumentKey *)key NS_DESIGNATED_INITIALIZER;
+ key:(DocumentKey)key NS_DESIGNATED_INITIALIZER;
@end
-@implementation FSTLimboDocumentChange
+@implementation FSTLimboDocumentChange {
+ DocumentKey _key;
+}
-+ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key {
- return [[FSTLimboDocumentChange alloc] initWithType:type key:key];
++ (instancetype)changeWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key {
+ return [[FSTLimboDocumentChange alloc] initWithType:type key:std::move(key)];
}
-- (instancetype)initWithType:(FSTLimboDocumentChangeType)type key:(FSTDocumentKey *)key {
+- (instancetype)initWithType:(FSTLimboDocumentChangeType)type key:(DocumentKey)key {
self = [super init];
if (self) {
_type = type;
- _key = key;
+ _key = std::move(key);
}
return self;
}
+- (const DocumentKey &)key {
+ return _key;
+}
+
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
@@ -357,7 +368,7 @@ static NSComparisonResult FSTCompareDocumentViewChangeTypes(FSTDocumentViewChang
#pragma mark - Private methods
/** Returns whether the doc for the given key should be in limbo. */
-- (BOOL)shouldBeLimboDocumentKey:(FSTDocumentKey *)key {
+- (BOOL)shouldBeLimboDocumentKey:(const DocumentKey &)key {
// If the remote end says it's part of this query, it's not in limbo.
if ([self.syncedDocuments containsObject:key]) {
return NO;