Skip to content

Commit

Permalink
fix(firestore): use databaseId for persistent cache index manager
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Aug 12, 2024
1 parent 90d724a commit e8ea87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import static io.invertase.firebase.common.RCTConvertFirebase.toHashMap;
import static io.invertase.firebase.firestore.ReactNativeFirebaseFirestoreCommon.rejectPromiseFirestoreException;
import static io.invertase.firebase.firestore.UniversalFirebaseFirestoreCommon.getFirestoreForApp;
import static io.invertase.firebase.firestore.UniversalFirebaseFirestoreCommon.createFirestoreKey;
import static io.invertase.firebase.firestore.UniversalFirebaseFirestoreCommon.getFirestoreForApp;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
Expand Down Expand Up @@ -167,9 +167,10 @@ public void terminate(String appName, String databaseId, Promise promise) {
}

@ReactMethod
public void persistenceCacheIndexManager(String appName, int requestType, Promise promise) {
public void persistenceCacheIndexManager(
String appName, String databaseId, int requestType, Promise promise) {
PersistentCacheIndexManager indexManager =
getFirestoreForApp(appName).getPersistentCacheIndexManager();
getFirestoreForApp(appName, databaseId).getPersistentCacheIndexManager();
if (indexManager != null) {
switch (requestType) {
case 0:
Expand Down
4 changes: 3 additions & 1 deletion packages/firestore/ios/RNFBFirestore/RNFBFirestoreModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ + (BOOL)requiresMainQueueSetup {

RCT_EXPORT_METHOD(persistenceCacheIndexManager
: (FIRApp *)firebaseApp
: (NSString *)databaseId
: (NSInteger)requestType
: (RCTPromiseResolveBlock)resolve
: (RCTPromiseRejectBlock)reject) {
FIRPersistentCacheIndexManager *persistentCacheIndexManager =
[RNFBFirestoreCommon getFirestoreForApp:firebaseApp].persistentCacheIndexManager;
[RNFBFirestoreCommon getFirestoreForApp:firebaseApp databaseId:databaseId]
.persistentCacheIndexManager;

if (persistentCacheIndexManager) {
switch (requestType) {
Expand Down

0 comments on commit e8ea87c

Please sign in to comment.