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

Commit 9e090fd

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 7c67832 + 9b0be7b commit 9e090fd

31 files changed

+407
-102
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
[Firebase iOS SDK Changelog](https://firebase.google.com/support/release-notes/ios)
44
[Firebase Android SDK Changelog](https://firebase.google.com/support/release-notes/android)
55

6-
## 6.5.0 (2018, August ?)
6+
## 6.6.0 (2018, August 28)
7+
[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/66?closed=1)
8+
9+
10+
## 6.5.0 (2018, August 16)
711
[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/65?closed=1)
812

913

demo-ng/app/tabs/firestore/firestore.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Button text="login anonymously" (tap)="loginAnonymously()" class="button button-user"></Button>
44
<Label text="After pressing these buttons, check the console log" textWrap="true"></Label>
55

6+
<Button text="Issue 854" (tap)="issue854()" class="button"></Button>
67
<Button text="Add" (tap)="firestoreAdd()" class="button"></Button>
78
<Button text="Set" (tap)="firestoreSet()" class="button"></Button>
89
<Button text="Set (auto id)" (tap)="firestoreSetByAutoID()" class="button"></Button>
@@ -24,6 +25,8 @@
2425
<Button text="Where" (tap)="firestoreWhere()" class="button"></Button>
2526
<Button text="Where, Order, Limit" (tap)="firestoreWhereOrderLimit()" class="button"></Button>
2627
<Button text="Where array_contains" (tap)="firestoreWhereCityHasALake()" class="button"></Button>
28+
<Button text="Start at 'LA'" (tap)="firestoreStartAt()" class="button"></Button>
29+
<Button text="Start after 'LA'" (tap)="firestoreStartAfter()" class="button"></Button>
2730
<Button text="Delete" (tap)="firestoreDelete()" class="button"></Button>
2831
<Button text="Transactional update (iOS)" (tap)="transactionalUpdate()" class="button"></Button>
2932
<Button text="Write batch" (tap)="writeBatch()" class="button"></Button>

demo-ng/app/tabs/firestore/firestore.component.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,23 @@ export class FirestoreComponent {
2626
// AngularFireModule.initializeApp({});
2727
}
2828

29+
public issue854(): void {
30+
const helloRef: firestore.DocumentReference =
31+
firebase.firestore()
32+
.collection("users")
33+
.doc(firebase.auth().currentUser.uid)
34+
.collection("availability")
35+
.doc("hello");
36+
37+
helloRef.get().then(snapshot => console.log(snapshot.data()))
38+
}
39+
2940
public loginAnonymously(): void {
3041
firebase.auth().signInAnonymously()
31-
.then(() => console.log("Logged in"))
42+
.then(() => {
43+
const user = firebase.auth().currentUser;
44+
firebase.firestore().collection("users").doc(user.uid).set(user);
45+
})
3246
.catch(err => console.log("Login error: " + JSON.stringify(err)));
3347
}
3448

@@ -119,10 +133,14 @@ export class FirestoreComponent {
119133
}
120134

121135
public firestoreUpdate(): void {
136+
// get a document reference so we can add a city reference to our favourite dog
137+
const sfDocRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SF");
138+
122139
firebase.firestore().collection("dogs").doc("fave")
123140
.update({
124141
name: "Woofieupdate",
125142
last: "updatedwoofie!",
143+
city: sfDocRef,
126144
updateTs: firestore.FieldValue.serverTimestamp(),
127145
updateTsAlt: firebase.firestore().FieldValue().serverTimestamp(),
128146
lastKnownLocation: firebase.firestore().GeoPoint(4.34, 5.67)
@@ -326,4 +344,30 @@ export class FirestoreComponent {
326344
.then(() => console.log(`Transaction successfully committed`))
327345
.catch(error => console.log("doTransaction error: " + error));
328346
}
347+
348+
public firestoreStartAt(): void {
349+
firebase.firestore().collection('cities')
350+
.doc('LA')
351+
.get()
352+
.then(doc => {
353+
firebase.firestore().collection('cities')
354+
.orderBy('name', 'asc')
355+
.startAt(doc)
356+
.get()
357+
.then(snap => snap.forEach(doc => console.log(doc.id, doc.data())));
358+
});
359+
}
360+
361+
public firestoreStartAfter(): void {
362+
firebase.firestore().collection('cities')
363+
.doc('LA')
364+
.get()
365+
.then(doc => {
366+
firebase.firestore().collection('cities')
367+
.orderBy('name', 'asc')
368+
.startAfter(doc)
369+
.get()
370+
.then(snap => snap.forEach(doc => console.log(doc.id, doc.data())));
371+
});
372+
}
329373
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { PropertyChangeData } from "tns-core-modules/data/observable";
2+
3+
export abstract class AbstractMLKitViewComponent {
4+
torchOn: boolean = false;
5+
6+
toggleTorch(args: PropertyChangeData): void {
7+
if (args.value !== null && args.value !== this.torchOn) {
8+
this.torchOn = args.value;
9+
}
10+
}
11+
}

demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
formats="QR_CODE, EAN_8, EAN_13"
1010
android:processEveryNthFrame="5"
1111
ios:processEveryNthFrame="10"
12+
[torchOn]="torchOn"
1213
(scanResult)="onBarcodeScanResult($event)">
1314
</MLKitBarcodeScanner>
1415

@@ -45,4 +46,10 @@
4546
</ng-template>
4647
</ListView>
4748
</GridLayout>
49+
50+
<GridLayout rows="auto" columns="auto, auto" horizontalAlignment="right" class="m-t-4 m-r-8">
51+
<Label col="0" text="Torch" class="c-white" [class.disabled]="!torchOn"></Label>
52+
<Switch col="1" [checked]="torchOn" (checkedChange)="toggleTorch($event)"></Switch>
53+
</GridLayout>
54+
4855
</GridLayout>
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Component } from "@angular/core";
22
import { MLKitScanBarcodesOnDeviceResult } from "nativescript-plugin-firebase/mlkit/barcodescanning";
3+
import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component";
34

45
@Component({
56
selector: "mlkit-barcodescanning",
67
moduleId: module.id,
78
templateUrl: "./barcodescanning.component.html",
89
})
9-
export class BarcodeScanningComponent {
10+
export class BarcodeScanningComponent extends AbstractMLKitViewComponent {
1011
barcodes: Array<{
1112
value: string;
1213
format: string;
@@ -15,5 +16,6 @@ export class BarcodeScanningComponent {
1516
onBarcodeScanResult(event: any): void {
1617
const result: MLKitScanBarcodesOnDeviceResult = event.value;
1718
this.barcodes = result.barcodes;
19+
console.log("this.barcodes: " + JSON.stringify(this.barcodes));
1820
}
1921
}

demo-ng/app/tabs/mlkit/facedetection/facedetection.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
enableFaceTracking="true"
1212
minimumFaceSize="0.2"
1313
modeType="accurate"
14+
[torchOn]="torchOn"
1415
(scanResult)="onFaceDetectionResult($event)">
1516
</MLKitFaceDetection>
1617

@@ -59,4 +60,10 @@
5960
</GridLayout>
6061
</ng-template>
6162
</ListView>
63+
64+
<GridLayout rows="auto" columns="auto, auto" horizontalAlignment="right" class="m-t-4 m-r-8">
65+
<Label col="0" text="Torch" class="c-white" [class.disabled]="!torchOn"></Label>
66+
<Switch col="1" [checked]="torchOn" (checkedChange)="toggleTorch($event)"></Switch>
67+
</GridLayout>
68+
6269
</GridLayout>

demo-ng/app/tabs/mlkit/facedetection/facedetection.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { Component } from "@angular/core";
22
import { MLKitDetectFacesOnDeviceResult, MLKitDetectFacesResultFace } from "nativescript-plugin-firebase/mlkit/facedetection";
3+
import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component";
34

45
@Component({
56
selector: "mlkit-facedetection",
67
moduleId: module.id,
78
templateUrl: "./facedetection.component.html",
89
})
9-
export class FaceDetectionComponent {
10+
export class FaceDetectionComponent extends AbstractMLKitViewComponent {
1011
faces: Array<MLKitDetectFacesResultFace>;
1112

1213
mlKitAllOK: string;

demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@
4242
</ng-template>
4343
</ListView>
4444
</GridLayout>
45+
46+
<GridLayout rows="auto" columns="auto, auto" horizontalAlignment="right" class="m-t-4 m-r-8">
47+
<Label col="0" text="Torch" class="c-white" [class.disabled]="!torchOn"></Label>
48+
<Switch col="1" [checked]="torchOn" (checkedChange)="toggleTorch($event)"></Switch>
49+
</GridLayout>
50+
4551
</GridLayout>

demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import { Component } from "@angular/core";
22
import { MLKitImageLabelingOnDeviceResult } from "nativescript-plugin-firebase/mlkit/imagelabeling";
3+
import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component";
34

45
@Component({
56
selector: "mlkit-imagelabeling",
67
moduleId: module.id,
78
templateUrl: "./imagelabeling.component.html",
89
})
9-
export class ImageLabelingComponent {
10+
export class ImageLabelingComponent extends AbstractMLKitViewComponent {
1011
labels: Array<{
1112
text: string;
1213
confidence: number;
1314
}>;
1415

16+
constructor() {
17+
super();
18+
// let's start with the torch on, just for show
19+
this.torchOn = true;
20+
}
21+
1522
onImageLabelingResult(scanResult: any): void {
1623
const value: MLKitImageLabelingOnDeviceResult = scanResult.value;
1724
this.labels = value.labels;

0 commit comments

Comments
 (0)