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

Commit 3c62d22

Browse files
Merge pull request #794 from vcooley/feature/query-geopoint
enable querying by GeoPoint
2 parents 8f89d96 + 86fca4e commit 3c62d22

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/firebase.android.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ firebase.toValue = val => {
177177
if (Array.isArray(val)) {
178178
return firebase.toJavaArray(val);
179179
}
180+
if (val instanceof GeoPoint) {
181+
return new com.google.firebase.firestore.GeoPoint(val.latitude, val.longitude);
182+
}
180183

181184
switch (typeof val) {
182185
case 'object':
@@ -1001,7 +1004,7 @@ function toLoginResult(user, additionalUserInfo?): User {
10011004
username: additionalUserInfo.getUsername(),
10021005
isNewUser: additionalUserInfo.isNewUser(),
10031006
profile: firebase.toJsObject(additionalUserInfo.getProfile())
1004-
}
1007+
};
10051008
}
10061009

10071010
return loginResult;

src/firebase.ios.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,6 +2445,9 @@ firebase.firestore.where = (collectionPath: string, fieldPath: string, opStr: fi
24452445
}
24462446

24472447
query = query || FIRFirestore.firestore().collectionWithPath(collectionPath);
2448+
value = value instanceof GeoPoint
2449+
? new FIRGeoPoint({ latitude: value.latitude, longitude: value.longitude })
2450+
: value;
24482451

24492452
if (opStr === "<") {
24502453
query = query.queryWhereFieldIsLessThan(fieldPath, value);

0 commit comments

Comments
 (0)