Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(firestore): support clearPersistence() & terminate() APIs #3591

Merged
merged 30 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4666a51
feat(firestore): clearPersistence API
russellwheatley May 1, 2020
6f4a3be
Merge branch 'master' into @russell/firestore-clear-persistence
Salakar May 5, 2020
6d0598e
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 3, 2020
27aaa62
docs(firestore): update types & ios return null
russellwheatley Jun 3, 2020
fe1c80b
fix(firestore):update to void return types
russellwheatley Jun 3, 2020
2b8d228
feat(firestore): clearPersistence & terminate api
russellwheatley Jun 9, 2020
f70c71a
docs(firestore): terminate api
russellwheatley Jun 9, 2020
f640b7b
docs(firestore): update
russellwheatley Jun 9, 2020
1e85384
build(android): add gpu guest
russellwheatley Jun 10, 2020
c84d91c
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 11, 2020
5a59883
Merge branch 'master' firestore-clear-persistence
russellwheatley Jun 17, 2020
671ff91
Merge branch '@russell/firestore-clear-persistence' of github.com:inv…
russellwheatley Jun 17, 2020
f85c11a
chore(firestore): clear cached settings
russellwheatley Jun 17, 2020
cd1392e
tests(firestore): update clearPersistence test
russellwheatley Jun 17, 2020
ca12019
fix(firestore, java): rm only pertinent keys
russellwheatley Jun 17, 2020
984384f
fix(firestore, ios): rm pertinent cache keys
russellwheatley Jun 17, 2020
766178c
docs(firestore): gen docs
russellwheatley Jun 17, 2020
cefb8c1
fix(firestore, ios): terminate bug
russellwheatley Jun 18, 2020
4d2dbaa
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 18, 2020
49b4aa4
fix(firestore, android): apply changes
russellwheatley Jun 18, 2020
fdb1b59
Merge branch '@russell/firestore-clear-persistence' of github.com:inv…
russellwheatley Jun 18, 2020
2b15da6
chore(firestore): PR requests
russellwheatley Jun 19, 2020
0ec641b
chore(firestore): update to weakhashmap for cache
russellwheatley Jun 19, 2020
d70b7ba
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 22, 2020
45c966c
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 22, 2020
1a9aa74
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 22, 2020
40f2043
Merge branch 'master' into clear-persistence
russellwheatley Jun 22, 2020
d1dec91
docs(firestore): update docs
russellwheatley Jun 22, 2020
cc1235e
Apply suggestions from code review
russellwheatley Jun 22, 2020
6fa4a7f
Merge branch 'master' into @russell/firestore-clear-persistence
russellwheatley Jun 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ Task<Void> settings(String appName, Map<String, Object> settings) {
return null;
});
}

Task<Void> clearPersistence(String appName){
return getFirestoreForApp(appName).clearPersistence();
Salakar marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ public void setLogLevel(String logLevel) {
}
}

@ReactMethod
public void clearPersistence(String appName, Promise promise) {
module.clearPersistence(appName).addOnCompleteListener(task -> {
if (task.isSuccessful()) {
promise.resolve(null);
} else {
rejectPromiseFirestoreException(promise, task.getException());
}
});
}

@ReactMethod
public void disableNetwork(String appName, Promise promise) {
module.disableNetwork(appName).addOnCompleteListener(task -> {
Expand Down
15 changes: 15 additions & 0 deletions packages/firestore/ios/RNFBFirestore/RNFBFirestoreModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,19 @@ + (BOOL)requiresMainQueueSetup {
resolve([NSNull null]);
}

RCT_EXPORT_METHOD(clearPersistence:
(FIRApp *) firebaseApp
: (RCTPromiseResolveBlock) resolve
: (RCTPromiseRejectBlock)reject
) {
[[RNFBFirestoreCommon getFirestoreForApp:firebaseApp] clearPersistenceWithCompletion:^(NSError *error) {
if (error) {
[RNFBFirestoreCommon promiseRejectFirestoreException:reject error:error];
} else {
resolve(nil);
}
}];
}


@end
4 changes: 4 additions & 0 deletions packages/firestore/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class FirebaseFirestoreModule extends FirebaseModule {
return new FirestoreWriteBatch(this);
}

clearPersistence() {
return this.native.clearPersistence();
}

collection(collectionPath) {
if (!isString(collectionPath)) {
throw new Error(
Expand Down