From fd9fd271d0dba3935a6f5611a1554f2c59b696af Mon Sep 17 00:00:00 2001 From: zxu Date: Thu, 15 Feb 2018 17:23:08 -0500 Subject: replacing Auth/FSTUser by C++ auth implementation (#804) * replacing Auth/FSTUser by C++ auth implementation * address changes --- Firestore/Source/Local/FSTMemoryPersistence.mm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Firestore/Source/Local/FSTMemoryPersistence.mm') diff --git a/Firestore/Source/Local/FSTMemoryPersistence.mm b/Firestore/Source/Local/FSTMemoryPersistence.mm index e301820..ba71f9c 100644 --- a/Firestore/Source/Local/FSTMemoryPersistence.mm +++ b/Firestore/Source/Local/FSTMemoryPersistence.mm @@ -16,7 +16,8 @@ #import "Firestore/Source/Local/FSTMemoryPersistence.h" -#import "Firestore/Source/Auth/FSTUser.h" +#include + #import "Firestore/Source/Local/FSTMemoryMutationQueue.h" #import "Firestore/Source/Local/FSTMemoryQueryCache.h" #import "Firestore/Source/Local/FSTMemoryRemoteDocumentCache.h" @@ -24,12 +25,15 @@ #import "Firestore/Source/Local/FSTWriteGroupTracker.h" #import "Firestore/Source/Util/FSTAssert.h" +#include "Firestore/core/src/firebase/firestore/auth/user.h" + +using firebase::firestore::auth::HashUser; +using firebase::firestore::auth::User; + NS_ASSUME_NONNULL_BEGIN @interface FSTMemoryPersistence () @property(nonatomic, strong, nonnull) FSTWriteGroupTracker *writeGroupTracker; -@property(nonatomic, strong, nonnull) - NSMutableDictionary> *mutationQueues; @property(nonatomic, assign, getter=isStarted) BOOL started; @end @@ -46,6 +50,8 @@ NS_ASSUME_NONNULL_BEGIN /** The FSTRemoteDocumentCache representing the persisted cache of remote documents. */ FSTMemoryRemoteDocumentCache *_remoteDocumentCache; + + std::unordered_map, HashUser> _mutationQueues; } + (instancetype)persistence { @@ -57,7 +63,6 @@ NS_ASSUME_NONNULL_BEGIN _writeGroupTracker = [FSTWriteGroupTracker tracker]; _queryCache = [[FSTMemoryQueryCache alloc] init]; _remoteDocumentCache = [[FSTMemoryRemoteDocumentCache alloc] init]; - _mutationQueues = [NSMutableDictionary dictionary]; } return self; } @@ -75,11 +80,11 @@ NS_ASSUME_NONNULL_BEGIN self.started = NO; } -- (id)mutationQueueForUser:(FSTUser *)user { - id queue = self.mutationQueues[user]; +- (id)mutationQueueForUser:(const User &)user { + id queue = _mutationQueues[user]; if (!queue) { queue = [FSTMemoryMutationQueue mutationQueue]; - self.mutationQueues[user] = queue; + _mutationQueues[user] = queue; } return queue; } -- cgit v1.2.3