Skip to content

Commit 3711a99

Browse files
committed
fix(firestore): use deserializeField
feat: add toString for Geo & Timestamp
1 parent 0183cdd commit 3711a99

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

packages/firebase-firestore/index.android.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export class DocumentSnapshot<T extends DocumentData = DocumentData> implements
361361
}
362362

363363
data() {
364-
return deserialize(this.native.getData());
364+
return deserializeField(this.native.getData());
365365
}
366366

367367
get<fieldType extends DocumentFieldType>(fieldPath: string | number | FieldPath): fieldType {
@@ -730,7 +730,7 @@ export class QueryDocumentSnapshot<T extends DocumentData = DocumentData> extend
730730
}
731731

732732
data() {
733-
return deserialize(this.#native.getData());
733+
return deserializeField(this.#native.getData());
734734
}
735735

736736
get<fieldType extends DocumentFieldType>(fieldPath: string | number | FieldPath): fieldType {
@@ -1245,6 +1245,13 @@ export class GeoPoint implements IGeoPoint {
12451245
get android() {
12461246
return this.native;
12471247
}
1248+
1249+
toString() {
1250+
return {
1251+
latitude: this.latitude,
1252+
longitude: this.longitude
1253+
}
1254+
}
12481255
}
12491256

12501257
export class Timestamp implements ITimestamp {
@@ -1280,6 +1287,13 @@ export class Timestamp implements ITimestamp {
12801287
get android() {
12811288
return this.native;
12821289
}
1290+
1291+
toString() {
1292+
return {
1293+
nanoseconds: this.nanoseconds,
1294+
seconds: this.seconds
1295+
}
1296+
}
12831297
}
12841298

12851299
export class WriteBatch implements IWriteBatch {

packages/firebase-firestore/index.ios.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export class DocumentSnapshot<T extends DocumentData = DocumentData> implements
304304
}
305305

306306
data() {
307-
return deserialize(this.native.data);
307+
return deserializeField(this.native.data());
308308
}
309309

310310
get<fieldType extends DocumentFieldType>(fieldPath: string | number | FieldPath): fieldType {
@@ -652,7 +652,7 @@ export class QueryDocumentSnapshot<T extends DocumentData = DocumentData> extend
652652
}
653653

654654
data() {
655-
return deserialize(this.#native.data());
655+
return deserializeField(this.#native.data());
656656
}
657657

658658
get<fieldType extends DocumentFieldType>(fieldPath: string | number | FieldPath): fieldType {
@@ -1092,6 +1092,13 @@ export class GeoPoint implements IGeoPoint {
10921092
get ios() {
10931093
return this.native;
10941094
}
1095+
1096+
toString() {
1097+
return {
1098+
latitude: this.latitude,
1099+
longitude: this.longitude
1100+
}
1101+
}
10951102
}
10961103

10971104
export class Timestamp implements ITimestamp {
@@ -1127,6 +1134,13 @@ export class Timestamp implements ITimestamp {
11271134
get ios() {
11281135
return this.native;
11291136
}
1137+
1138+
toString() {
1139+
return {
1140+
nanoseconds: this.nanoseconds,
1141+
seconds: this.seconds
1142+
}
1143+
}
11301144
}
11311145

11321146
export class WriteBatch implements IWriteBatch {

packages/firebase-firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-firestore",
3-
"version": "1.0.0-alpha.4",
3+
"version": "1.0.0-alpha.5",
44
"description": "NativeScript Firebase - Firestore",
55
"main": "index",
66
"typings": "index.d.ts",

0 commit comments

Comments
 (0)