Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit fe32f87

Browse files
Firestore onSnapshot update to support onError Callbacks. #1176 (rework after merging master)
1 parent fb8c632 commit fe32f87

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/firebase.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,7 @@ firebase.firestore._getDocumentReference = (docRef?: JDocumentReference): firest
23522352
get: () => firebase.firestore.getDocument(collectionPath, docRef.getId()),
23532353
update: (data: any) => firebase.firestore.update(collectionPath, docRef.getId(), data),
23542354
delete: () => firebase.firestore.delete(collectionPath, docRef.getId()),
2355-
onSnapshot: (optionsOrCallback: firestore.SnapshotListenOptions | ((snapshot: DocumentSnapshot) => void), callbackOrOnError?: (docOrError: DocumentSnapshot | Error) => void, onError?: (error: Error) => void) => firebase.firestore.onDocumentSnapshot(javaObj, optionsOrCallback, callbackOrOnError, onError),
2355+
onSnapshot: (optionsOrCallback: firestore.SnapshotListenOptions | ((snapshot: DocumentSnapshot) => void), callbackOrOnError?: (docOrError: DocumentSnapshot | Error) => void, onError?: (error: Error) => void) => firebase.firestore.onDocumentSnapshot(docRef, optionsOrCallback, callbackOrOnError, onError),
23562356
android: docRef
23572357
};
23582358
};
@@ -2373,7 +2373,7 @@ firebase.firestore._getCollectionReference = (colRef?: JCollectionReference): fi
23732373
where: (fieldPath: string, opStr: firestore.WhereFilterOp, value: any) => firebase.firestore.where(collectionPath, fieldPath, opStr, value),
23742374
orderBy: (fieldPath: string, directionStr: firestore.OrderByDirection): firestore.Query => firebase.firestore.orderBy(collectionPath, fieldPath, directionStr, colRef),
23752375
limit: (limit: number): firestore.Query => firebase.firestore.limit(collectionPath, limit, colRef),
2376-
onSnapshot: (optionsOrCallback: firestore.SnapshotListenOptions | ((snapshot: QuerySnapshot) => void), callback?: (snapshot: QuerySnapshot) => void) => firebase.firestore.onCollectionSnapshot(colRef, optionsOrCallback, callback),
2376+
onSnapshot: (optionsOrCallback: firestore.SnapshotListenOptions | ((snapshot: QuerySnapshot) => void), callbackOrOnError?: (snapshotOrError: QuerySnapshot | Error) => void, onError?: (error: Error) => void) => firebase.firestore.onCollectionSnapshot(colRef, optionsOrCallback, callbackOrOnError, onError),
23772377
startAfter: (snapshot: DocumentSnapshot): firestore.Query => firebase.firestore.startAfter(collectionPath, snapshot, colRef),
23782378
startAt: (snapshot: DocumentSnapshot): firestore.Query => firebase.firestore.startAt(collectionPath, snapshot, colRef),
23792379
endAt: (snapshot: DocumentSnapshot): firestore.Query => firebase.firestore.endAt(collectionPath, snapshot, colRef),
@@ -2426,7 +2426,7 @@ firebase.firestore.add = (collectionPath: string, document: any): Promise<firest
24262426

24272427
const onSuccessListener = new gmsTasks.OnSuccessListener({
24282428
onSuccess: (docRef: com.google.firebase.firestore.DocumentReference) => {
2429-
resolve(firebase.firestore._getDocumentReference(docRef))
2429+
resolve(firebase.firestore._getDocumentReference(docRef));
24302430
}
24312431
});
24322432

src/firebase.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ firebase.firestore.add = (collectionPath: string, document: any): Promise<firest
20922092
if (error) {
20932093
reject(error.localizedDescription);
20942094
} else {
2095-
resolve(firebase.firestore._getDocumentReference(fIRDocumentReference))
2095+
resolve(firebase.firestore._getDocumentReference(fIRDocumentReference));
20962096
}
20972097
});
20982098

0 commit comments

Comments
 (0)