diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..e709e0b
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,21 @@
+demo/
+.idea/
+support/
+*.tar
+*.tgz
+.npmignore
+*.map
+*.ts
+tsconfig.json
+scripts
+.DS_Store
+*.aar
+node_modules
+*.esm.json
+!extractTGZ.js
+*.js.map
+*.log
+
+# Editor directories and files
+.idea
+.vscode
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0c63a78
--- /dev/null
+++ b/README.md
@@ -0,0 +1,181 @@
+
+
+# NativeScript Yoonit Camera
+
+![Generic badge](https://img.shields.io/badge/version-v1.2.0-.svg) ![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)
+
+A NativeScript plugin to provide:
+- Modern Android Camera API (Camera X)
+- MLKit integration
+- Camera preview (Front & Back)
+- Face detection (With Min & Max size (Soon))
+- Landmark detection (Soon)
+- Face crop
+- Face capture
+- Frame capture
+- Face ROI (Soon)
+- QR Code scanning
+- Better props to setup the initialization your component
+
+## Installation
+
+```javascript
+npm i -s @yoonit/nativescript-camera
+```
+
+## Usage
+
+All the functionalities that the `@yoonit/nativescript-camera` provides is accessed through the `YoonitCamera` component, that includes the camera preview. Below we have the basic usage code, for more details, your can see the [**Methods**](#methods), [**Events**](#events) or the [**Demo Vue**](https://github.com/Yoonit-Labs/nativescript-yoonit-camera/tree/development/demo-vue).
+
+
+#### VueJS Plugin
+`main.js`
+```javascript
+import Vue from 'nativescript-vue'
+import YoonitCamera from '@yoonit/nativescript-camera/vue'
+
+Vue.use(YoonitCamera)
+```
+
+After that, you can access the camera object in your entire project using `this.$yoo.camera`
+
+#### Vue Component
+`App.vue`
+```vue
+
+
+
+
+
+
+
+```
+
+## API
+
+#### Methods
+
+| Function | Parameters | Valid values | Return Type | Description
+| - | - | - | - | -
+| **`requestPermission`** | - | - | promise | Ask to user to give the permission to access camera.
+| **`hasPermission`** | - | - | boolean | Return if application has camera permission.
+| **`preview`** | - | - | void | Start camera preview if has permission.
+| **`startCapture`** | `captureType: string` | - `"none"`
- `"face"`
- `"barcode"`
- `"frame"`
| void | Set capture type none, face, barcode or frame.
+| **`stopCapture`** | - | - | void | Stop any type of capture.
+| **`toggleLens`** | - | - | void | Set camera lens facing front or back.
+| **`getLens`** | - | - | number | Return `number` that represents lens face state: 0 for front 1 for back camera.
+| **`setFaceNumberOfImages`** | `faceNumberOfImages: number` | Any positive `number` value | void | Default value is 0. For value 0 is saved infinity images. When saved images reached the "face number os images", the `onEndCapture` is triggered.
+| **`setFaceDetectionBox`** | `faceDetectionBox: boolean` | `true` or `false` | void | Set to show face detection box when face detected.
+| **`setFaceTimeBetweenImages`** | `faceTimeBetweenImages: number` | Any positive `number` that represent time in milli seconds | void | Set saving face images time interval in milli seconds.
+| **`setFacePaddingPercent`** | `facePaddingPercent: number` | Any positive `number` value | void | Set face image and bounding box padding in percent.
+| **`setFaceImageSize`** | `faceImageSize: number` | Any positive `number` value | void | Set face image size to be saved.
+| **`setFrameNumberOfImages`** | `frameNumberOfImages: number` | Any positive `number` value | void | Default value is 0. For value 0 is saved infinity images. When saved images reached the "frame number os images", the `onEndCapture` is triggered.
+| **`setFrameTimeBetweenImages`** | `frameTimeBetweenImages: number` | Any positive `number` that represent time in milli seconds | void | Set saving frame images time interval in milli seconds.
+
+
+#### Events
+
+| Event | Parameters | Description
+| - | - | -
+| faceImage | `{ count: number, total: number, image: object = { path: string, source: blob } }` | Must have started capture type of face. Emitted when the face image file is created: - count: current index
- total: total to create
- image.path: the face image path
- image.source: the blob file
+| frameImage | `{ count: number, total: number, image: object = { path: string, source: blob } }` | Must have started capture type of frame. Emitted when the frame image file is created: - count: current index
- total: total to create
- image.path: the frame image path
- image.source: the blob file
+| faceDetected | `{ x: number, y: number, width: number, height: number }` | Must have started capture type of face. Emit the detected face bounding box. Emit all parameters null if no more face detecting.
+| endCapture | - | Must have started capture type of face or frame. Emitted when the number of face or frame image files created is equal of the number of images set (see the method `setFaceNumberOfImages` for face and `setFrameNumberOfImages`for frame).
+| qrCodeContent | `{ content: string }` | Must have started capture type of barcode (see `startCapture`). Emitted when the camera scan a QR Code.
+| status | `{ type: 'error'/'message', status: string }` | Emit message error from native. Used more often for debug purpose.
+| permissionDenied | - | Emit when try to `preview` but there is not camera permission.
+
+
+## To contribute and make it better
+
+Clone the repo, change what you want and send PR.
+
+Contributions are always welcome!
+
+---
+
+Code with ❤ by the [**Cyberlabs AI**](https://cyberlabs.ai/) Front-End Team
diff --git a/Yoonit.Camera.android.d.ts b/Yoonit.Camera.android.d.ts
new file mode 100644
index 0000000..d9e4c40
--- /dev/null
+++ b/Yoonit.Camera.android.d.ts
@@ -0,0 +1,17 @@
+import { CameraBase } from './Yoonit.Camera.common';
+export declare class YoonitCamera extends CameraBase {
+ nativeView: ai.cyberlabs.yoonit.camera.CameraView;
+ createNativeView(): Object;
+ initNativeView(): void;
+ disposeNativeView(): void;
+ startCapture(captureType: string): void;
+ setFaceNumberOfImages(faceNumberOfImages: number): void;
+ setFaceDetectionBox(faceDetectionBox: boolean): void;
+ setFaceTimeBetweenImages(faceTimeBetweenImages: number): void;
+ setFacePaddingPercent(facePaddingPercent: number): void;
+ setFaceImageSize(width: number, height: number): void;
+ setFrameNumberOfImages(frameNumberOfImages: number): void;
+ setFrameTimeBetweenImages(frameTimeBetweenImages: number): void;
+ requestPermission(explanation?: string): Promise;
+ hasPermission(): boolean;
+}
diff --git a/Yoonit.Camera.android.js b/Yoonit.Camera.android.js
new file mode 100644
index 0000000..598ec3d
--- /dev/null
+++ b/Yoonit.Camera.android.js
@@ -0,0 +1,194 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Yoonit_Camera_common_1 = require("./Yoonit.Camera.common");
+var permissions = require("nativescript-permissions");
+var image_source_1 = require("tns-core-modules/image-source");
+var CAMERA = function () { return android.Manifest.permission.CAMERA; };
+var YoonitCamera = (function (_super) {
+ __extends(YoonitCamera, _super);
+ function YoonitCamera() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ YoonitCamera.prototype.createNativeView = function () {
+ this.nativeView = new ai.cyberlabs.yoonit.camera.CameraView(this._context);
+ this.nativeView.setCameraEventListener(CameraEventListener.initWithOwner(new WeakRef(this)));
+ return this.nativeView;
+ };
+ YoonitCamera.prototype.initNativeView = function () {
+ this.nativeView.owner = this;
+ _super.prototype.initNativeView.call(this);
+ };
+ YoonitCamera.prototype.disposeNativeView = function () {
+ this.nativeView.stopCapture();
+ this.nativeView.setCameraEventListener(null);
+ this.nativeView.owner = null;
+ _super.prototype.disposeNativeView.call(this);
+ };
+ YoonitCamera.prototype.startCapture = function (captureType) {
+ this.nativeView.startCaptureType(captureType);
+ };
+ YoonitCamera.prototype.setFaceNumberOfImages = function (faceNumberOfImages) {
+ this.nativeView.setFaceNumberOfImages(faceNumberOfImages);
+ };
+ YoonitCamera.prototype.setFaceDetectionBox = function (faceDetectionBox) {
+ this.nativeView.setFaceDetectionBox(faceDetectionBox);
+ };
+ YoonitCamera.prototype.setFaceTimeBetweenImages = function (faceTimeBetweenImages) {
+ this.nativeView.setFaceTimeBetweenImages(faceTimeBetweenImages);
+ };
+ YoonitCamera.prototype.setFacePaddingPercent = function (facePaddingPercent) {
+ this.nativeView.setFacePaddingPercent(facePaddingPercent);
+ };
+ YoonitCamera.prototype.setFaceImageSize = function (width, height) {
+ this.nativeView.setFaceImageSize(width, height);
+ };
+ YoonitCamera.prototype.setFrameNumberOfImages = function (frameNumberOfImages) {
+ this.nativeView.setFrameNumberOfImages(frameNumberOfImages);
+ };
+ YoonitCamera.prototype.setFrameTimeBetweenImages = function (frameTimeBetweenImages) {
+ this.nativeView.setFrameTimeBetweenImages(frameTimeBetweenImages);
+ };
+ YoonitCamera.prototype.requestPermission = function (explanation) {
+ if (explanation === void 0) { explanation = ''; }
+ return new Promise(function (resolve, reject) { return permissions
+ .requestPermission(CAMERA(), explanation)
+ .then(function () { return resolve(true); })
+ .catch(function (err) { return reject(false); }); });
+ };
+ YoonitCamera.prototype.hasPermission = function () {
+ return permissions.hasPermission(CAMERA());
+ };
+ return YoonitCamera;
+}(Yoonit_Camera_common_1.CameraBase));
+exports.YoonitCamera = YoonitCamera;
+var CameraEventListener = (function (_super) {
+ __extends(CameraEventListener, _super);
+ function CameraEventListener(owner) {
+ var _this = _super.call(this) || this;
+ _this.owner = owner;
+ return global.__native(_this);
+ }
+ CameraEventListener_1 = CameraEventListener;
+ CameraEventListener.initWithOwner = function (owner) {
+ return new CameraEventListener_1(owner);
+ };
+ CameraEventListener.prototype.onFaceImageCreated = function (count, total, imagePath) {
+ var owner = this.owner.get();
+ var imageSource = image_source_1.ImageSource.fromFileSync(imagePath);
+ if (owner) {
+ owner.notify({
+ eventName: 'faceImage',
+ object: owner,
+ count: count,
+ total: total,
+ image: {
+ path: imagePath,
+ source: imageSource
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onFrameImageCreated = function (count, total, imagePath) {
+ var owner = this.owner.get();
+ var imageSource = image_source_1.ImageSource.fromFileSync(imagePath);
+ if (owner) {
+ owner.notify({
+ eventName: 'frameImage',
+ object: owner,
+ count: count,
+ total: total,
+ image: {
+ path: imagePath,
+ source: imageSource
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onFaceDetected = function (x, y, width, height) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: x,
+ y: y,
+ width: width,
+ height: height
+ });
+ }
+ };
+ CameraEventListener.prototype.onFaceUndetected = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: null,
+ y: null,
+ width: null,
+ height: null
+ });
+ }
+ };
+ CameraEventListener.prototype.onEndCapture = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'endCapture',
+ object: owner,
+ });
+ }
+ };
+ CameraEventListener.prototype.onBarcodeScanned = function (content) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'qrCodeContent',
+ object: owner,
+ content: content
+ });
+ }
+ };
+ CameraEventListener.prototype.onError = function (error) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'error',
+ status: error
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onMessage = function (message) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'message',
+ status: message
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onPermissionDenied = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'permissionDenied',
+ object: owner,
+ });
+ }
+ };
+ var CameraEventListener_1;
+ CameraEventListener = CameraEventListener_1 = __decorate([
+ Interfaces([ai.cyberlabs.yoonit.camera.interfaces.CameraEventListener]),
+ __metadata("design:paramtypes", [WeakRef])
+ ], CameraEventListener);
+ return CameraEventListener;
+}(java.lang.Object));
+//# sourceMappingURL=Yoonit.Camera.android.js.map
\ No newline at end of file
diff --git a/Yoonit.Camera.android.js.map b/Yoonit.Camera.android.js.map
new file mode 100644
index 0000000..d818cac
--- /dev/null
+++ b/Yoonit.Camera.android.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"Yoonit.Camera.android.js","sourceRoot":"","sources":["Yoonit.Camera.android.ts"],"names":[],"mappings":";;AAiBA,+DAAoD;AACpD,sDAAwD;AAExD,8DAA4D;AAE5D,IAAM,MAAM,GAAG,cAAM,OAAC,OAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAA3C,CAA2C,CAAC;AAEjE;IAAkC,gCAAU;IAA5C;;IAsFA,CAAC;IA/EU,uCAAgB,GAAvB;QACI,IAAI,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,aAA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,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAE/B,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,MAAM,CAAC;gBACT,SAAS,EAAE,kBAAkB;gBAC7B,MAAM,EAAE,KAAK;aACH,CAAC,CAAC;SACnB;IACL,CAAC;;IA7IC,mBAAmB;QADxB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;yCAGzC,OAAO;OAFhC,mBAAmB,CA8IxB;IAAD,0BAAC;CAAA,AA9ID,CAAkC,IAAI,CAAC,IAAI,CAAC,MAAM,GA8IjD"}
\ No newline at end of file
diff --git a/Yoonit.Camera.android.ts b/Yoonit.Camera.android.ts
new file mode 100644
index 0000000..de0c57e
--- /dev/null
+++ b/Yoonit.Camera.android.ts
@@ -0,0 +1,257 @@
+// +-+-+-+-+-+-+
+// |y|o|o|n|i|t|
+// +-+-+-+-+-+-+
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Yoonit Camera Plugin for NativeScript applications |
+// | Luigui Delyer, Haroldo Teruya, |
+// | Victor Goulart & Márcio Bruffato @ Cyberlabs AI 2020 |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+import {
+ StatusEventData,
+ FaceImageCreatedEventData,
+ FaceDetectedEventData,
+ BarcodeScannedEventData,
+ FrameImageCreatedEventData
+} from '.';
+import { CameraBase } from './Yoonit.Camera.common';
+import * as permissions from 'nativescript-permissions';
+import { EventData } from 'tns-core-modules/ui/content-view';
+import { ImageSource } from 'tns-core-modules/image-source';
+
+const CAMERA = () => (android as any).Manifest.permission.CAMERA;
+
+export class YoonitCamera extends CameraBase {
+
+ nativeView: ai.cyberlabs.yoonit.camera.CameraView;
+
+ /**
+ * Creates new native button.
+ */
+ public createNativeView(): Object {
+ this.nativeView = new ai.cyberlabs.yoonit.camera.CameraView(this._context);
+ this.nativeView.setCameraEventListener(CameraEventListener.initWithOwner(new WeakRef(this)));
+
+ return this.nativeView;
+ }
+
+ /**
+ * Initializes properties/listeners of the native view.
+ */
+ initNativeView(): void {
+ // Attach the owner to nativeView.
+ // When nativeView is tapped we get the owning JS object through this field.
+ (this.nativeView).owner = this;
+ super.initNativeView();
+ }
+
+ /**
+ * Clean up references to the native view and resets nativeView to its original state.
+ * If you have changed nativeView in some other way except through setNative callbacks
+ * you have a chance here to revert it back to its original state
+ * so that it could be reused later.
+ */
+ disposeNativeView(): void {
+ this.nativeView.stopCapture();
+ this.nativeView.setCameraEventListener(null);
+
+ // Remove reference from native view to this instance.
+ (this.nativeView).owner = null;
+
+ // If you want to recycle nativeView and have modified the nativeView
+ // without using Property or CssProperty (e.g. outside our property system - 'setNative' callbacks)
+ // you have to reset it to its initial state here.
+ super.disposeNativeView();
+ }
+
+ public startCapture(captureType: string): void {
+ this.nativeView.startCaptureType(captureType);
+ }
+
+ public setFaceNumberOfImages(faceNumberOfImages: number): void {
+ this.nativeView.setFaceNumberOfImages(faceNumberOfImages);
+ }
+
+ public setFaceDetectionBox(faceDetectionBox: boolean): void {
+ this.nativeView.setFaceDetectionBox(faceDetectionBox);
+ }
+
+ public setFaceTimeBetweenImages(faceTimeBetweenImages: number): void {
+ this.nativeView.setFaceTimeBetweenImages(faceTimeBetweenImages);
+ }
+
+ public setFacePaddingPercent(facePaddingPercent: number): void {
+ this.nativeView.setFacePaddingPercent(facePaddingPercent);
+ }
+
+ public setFaceImageSize(width: number, height: number): void {
+ this.nativeView.setFaceImageSize(width, height);
+ }
+
+ public setFrameNumberOfImages(frameNumberOfImages: number): void {
+ this.nativeView.setFrameNumberOfImages(frameNumberOfImages);
+ }
+
+ public setFrameTimeBetweenImages(frameTimeBetweenImages: number): void {
+ this.nativeView.setFrameTimeBetweenImages(frameTimeBetweenImages);
+ }
+
+ public requestPermission(explanation: string = ''): Promise {
+ return new Promise((resolve, reject) => permissions
+ .requestPermission(CAMERA(), explanation)
+ .then(() => resolve(true))
+ .catch(err => reject(false))
+ );
+ }
+
+ public hasPermission(): boolean {
+ return permissions.hasPermission(CAMERA());
+ }
+}
+
+// Interfaces decorator with implemented interfaces on this class
+@Interfaces([ai.cyberlabs.yoonit.camera.interfaces.CameraEventListener])
+class CameraEventListener extends java.lang.Object implements ai.cyberlabs.yoonit.camera.interfaces.CameraEventListener {
+
+ constructor(private owner: WeakRef) {
+ super();
+
+ // Required by Android runtime when native class is extended through TypeScript.
+ return global.__native(this);
+ }
+
+ public static initWithOwner(owner: WeakRef): CameraEventListener {
+ return new CameraEventListener(owner);
+ }
+
+ public onFaceImageCreated(count: number, total: number, imagePath: string): void {
+ const owner = this.owner.get();
+ const imageSource: ImageSource = ImageSource.fromFileSync(imagePath);
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceImage',
+ object: owner,
+ count,
+ total,
+ image: {
+ path: imagePath,
+ source: imageSource
+ }
+ } as FaceImageCreatedEventData);
+ }
+ }
+
+ public onFrameImageCreated(count: number, total: number, imagePath: string): void {
+ const owner = this.owner.get();
+ const imageSource: ImageSource = ImageSource.fromFileSync(imagePath);
+
+ if (owner) {
+ owner.notify({
+ eventName: 'frameImage',
+ object: owner,
+ count,
+ total,
+ image: {
+ path: imagePath,
+ source: imageSource
+ }
+ } as FrameImageCreatedEventData);
+ }
+ }
+
+ public onFaceDetected(x: number, y: number, width: number, height: number): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x,
+ y,
+ width,
+ height
+ } as FaceDetectedEventData);
+ }
+ }
+
+ public onFaceUndetected(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: null,
+ y: null,
+ width: null,
+ height: null
+ } as EventData);
+ }
+ }
+
+ public onEndCapture(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'endCapture',
+ object: owner,
+ } as EventData);
+ }
+ }
+
+ public onBarcodeScanned(content: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'qrCodeContent',
+ object: owner,
+ content
+ } as BarcodeScannedEventData);
+ }
+ }
+
+ public onError(error: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'error',
+ status: error
+ }
+ } as StatusEventData);
+ }
+ }
+
+ public onMessage(message: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'message',
+ status: message
+ }
+ } as StatusEventData);
+ }
+ }
+
+ public onPermissionDenied(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'permissionDenied',
+ object: owner,
+ } as EventData);
+ }
+ }
+}
diff --git a/Yoonit.Camera.common.d.ts b/Yoonit.Camera.common.d.ts
new file mode 100644
index 0000000..8749fd7
--- /dev/null
+++ b/Yoonit.Camera.common.d.ts
@@ -0,0 +1,26 @@
+import { ContentView, EventData } from 'tns-core-modules/ui/content-view';
+import { Camera as CameraDefinition, StatusEventData, FaceImageCreatedEventData, FaceDetectedEventData, BarcodeScannedEventData, FrameImageCreatedEventData } from '.';
+export declare abstract class CameraBase extends ContentView implements CameraDefinition {
+ preview(): void;
+ stopCapture(): void;
+ toggleLens(): void;
+ getLens(): number;
+ startCapture(captureType: string): void;
+ setFaceNumberOfImages(faceNumberOfImages: number): void;
+ setFaceDetectionBox(faceDetectionBox: Boolean): void;
+ setFaceTimeBetweenImages(faceTimeBetweenImages: number): void;
+ setFacePaddingPercent(facePaddingPercent: number): void;
+ setFaceImageSize(width: number, height: number): void;
+ requestPermission(explanationText?: string): Promise;
+ hasPermission(): boolean;
+}
+export interface CameraBase {
+ on(eventNames: string, callback: (data: EventData) => void, thisArg?: any): any;
+ on(event: "faceImage", callback: (args: FaceImageCreatedEventData) => void, thisArg?: any): any;
+ on(event: "frameImage", callback: (args: FrameImageCreatedEventData) => void, thisArg?: any): any;
+ on(event: "faceDetected", callback: (args: FaceDetectedEventData) => void, thisArg?: any): any;
+ on(event: "endCapture", callback: () => void, thisArg?: any): any;
+ on(event: "qrCodeContent", callback: (args: BarcodeScannedEventData) => void, thisArg?: any): any;
+ on(event: "status", callback: (args: StatusEventData) => void, thisArg?: any): any;
+ on(event: "permissionDenied", callback: () => void, thisArg?: any): any;
+}
diff --git a/Yoonit.Camera.common.js b/Yoonit.Camera.common.js
new file mode 100644
index 0000000..bfe6199
--- /dev/null
+++ b/Yoonit.Camera.common.js
@@ -0,0 +1,34 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var content_view_1 = require("tns-core-modules/ui/content-view");
+var CameraBase = (function (_super) {
+ __extends(CameraBase, _super);
+ function CameraBase() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ CameraBase.prototype.preview = function () {
+ this.nativeView.startPreview();
+ };
+ CameraBase.prototype.stopCapture = function () {
+ this.nativeView.stopCapture();
+ };
+ CameraBase.prototype.toggleLens = function () {
+ this.nativeView.toggleCameraLens();
+ };
+ CameraBase.prototype.getLens = function () {
+ return this.nativeView.getCameraLens();
+ };
+ CameraBase.prototype.startCapture = function (captureType) { };
+ CameraBase.prototype.setFaceNumberOfImages = function (faceNumberOfImages) { };
+ CameraBase.prototype.setFaceDetectionBox = function (faceDetectionBox) { };
+ CameraBase.prototype.setFaceTimeBetweenImages = function (faceTimeBetweenImages) { };
+ CameraBase.prototype.setFacePaddingPercent = function (facePaddingPercent) { };
+ CameraBase.prototype.setFaceImageSize = function (width, height) { };
+ CameraBase.prototype.requestPermission = function (explanationText) {
+ return new Promise(function (resolve, reject) { return resolve(); });
+ };
+ CameraBase.prototype.hasPermission = function () { return false; };
+ return CameraBase;
+}(content_view_1.ContentView));
+exports.CameraBase = CameraBase;
+//# sourceMappingURL=Yoonit.Camera.common.js.map
\ No newline at end of file
diff --git a/Yoonit.Camera.common.js.map b/Yoonit.Camera.common.js.map
new file mode 100644
index 0000000..44f1ed7
--- /dev/null
+++ b/Yoonit.Camera.common.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"Yoonit.Camera.common.js","sourceRoot":"","sources":["Yoonit.Camera.common.ts"],"names":[],"mappings":";;AAUA,iEAA0E;AAU1E;IAAyC,8BAAW;IAApD;;IAmCA,CAAC;IAjCQ,4BAAO,GAAd;QACE,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC;IAEM,gCAAW,GAAlB;QACE,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IAEM,+BAAU,GAAjB;QACE,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;IACrC,CAAC;IAEM,4BAAO,GAAd;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC;IAEM,iCAAY,GAAnB,UAAoB,WAAmB,IAAS,CAAC;IAE1C,0CAAqB,GAA5B,UAA6B,kBAA0B,IAAS,CAAC;IAE1D,wCAAmB,GAA1B,UAA2B,gBAAyB,IAAS,CAAC;IAEvD,6CAAwB,GAA/B,UAAgC,qBAA6B,IAAS,CAAC;IAEhE,0CAAqB,GAA5B,UAA6B,kBAA0B,IAAS,CAAC;IAE1D,qCAAgB,GAAvB,UAAwB,KAAa,EAAE,MAAc,IAAS,CAAC;IAExD,sCAAiB,GAAxB,UAAyB,eAAwB;QAC/C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM,IAAK,OAAA,OAAO,EAAE,EAAT,CAAS,CAAC,CAAC;IACrD,CAAC;IAEM,kCAAa,GAApB,cAAkC,OAAO,KAAK,CAAC,CAAC,CAAC;IACnD,iBAAC;AAAD,CAAC,AAnCD,CAAyC,0BAAW,GAmCnD;AAnCqB,gCAAU"}
\ No newline at end of file
diff --git a/Yoonit.Camera.common.ts b/Yoonit.Camera.common.ts
new file mode 100644
index 0000000..3c8a44a
--- /dev/null
+++ b/Yoonit.Camera.common.ts
@@ -0,0 +1,67 @@
+// +-+-+-+-+-+-+
+// |y|o|o|n|i|t|
+// +-+-+-+-+-+-+
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Yoonit Camera Plugin for NativeScript applications |
+// | Luigui Delyer, Haroldo Teruya, |
+// | Victor Goulart & Márcio Bruffato @ Cyberlabs AI 2020 |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+import { ContentView, EventData } from 'tns-core-modules/ui/content-view';
+import {
+ Camera as CameraDefinition,
+ StatusEventData,
+ FaceImageCreatedEventData,
+ FaceDetectedEventData,
+ BarcodeScannedEventData,
+ FrameImageCreatedEventData,
+} from '.';
+
+export abstract class CameraBase extends ContentView implements CameraDefinition {
+
+ public preview(): void {
+ this.nativeView.startPreview();
+ }
+
+ public stopCapture(): void {
+ this.nativeView.stopCapture();
+ }
+
+ public toggleLens(): void {
+ this.nativeView.toggleCameraLens();
+ }
+
+ public getLens(): number {
+ return this.nativeView.getCameraLens();
+ }
+
+ public startCapture(captureType: string): void {}
+
+ public setFaceNumberOfImages(faceNumberOfImages: number): void {}
+
+ public setFaceDetectionBox(faceDetectionBox: Boolean): void {}
+
+ public setFaceTimeBetweenImages(faceTimeBetweenImages: number): void {}
+
+ public setFacePaddingPercent(facePaddingPercent: number): void {}
+
+ public setFaceImageSize(width: number, height: number): void {}
+
+ public requestPermission(explanationText?: string): Promise {
+ return new Promise((resolve, reject) => resolve());
+ }
+
+ public hasPermission(): boolean { return false; }
+}
+
+export interface CameraBase {
+ on(eventNames: string, callback: (data: EventData) => void, thisArg?: any);
+ on(event: "faceImage", callback: (args: FaceImageCreatedEventData) => void, thisArg?: any);
+ on(event: "frameImage", callback: (args: FrameImageCreatedEventData) => void, thisArg?: any);
+ on(event: "faceDetected", callback: (args: FaceDetectedEventData) => void, thisArg?: any);
+ on(event: "endCapture", callback: () => void, thisArg?: any);
+ on(event: "qrCodeContent", callback: (args: BarcodeScannedEventData) => void, thisArg?: any);
+ on(event: "status", callback: (args: StatusEventData) => void, thisArg?: any);
+ on(event: "permissionDenied", callback: () => void, thisArg?: any);
+}
diff --git a/Yoonit.Camera.ios.d.ts b/Yoonit.Camera.ios.d.ts
new file mode 100644
index 0000000..b5c20c4
--- /dev/null
+++ b/Yoonit.Camera.ios.d.ts
@@ -0,0 +1,18 @@
+import { CameraBase } from './Yoonit.Camera.common';
+export declare class YoonitCamera extends CameraBase {
+ nativeView: CameraView;
+ private permission;
+ createNativeView(): Object;
+ initNativeView(): void;
+ disposeNativeView(): void;
+ startCapture(captureType: string): void;
+ setFaceNumberOfImages(faceNumberOfImages: number): void;
+ setFaceDetectionBox(faceDetectionBox: boolean): void;
+ setFaceTimeBetweenImages(faceTimeBetweenImages: number): void;
+ setFacePaddingPercent(facePaddingPercent: number): void;
+ setFaceImageSize(width: number, height: number): void;
+ setFrameNumberOfImages(frameNumberOfImages: number): void;
+ setFrameTimeBetweenImages(frameTimeBetweenImages: number): void;
+ requestPermission(explanation?: string): Promise;
+ hasPermission(): boolean;
+}
diff --git a/Yoonit.Camera.ios.js b/Yoonit.Camera.ios.js
new file mode 100644
index 0000000..8b8c658
--- /dev/null
+++ b/Yoonit.Camera.ios.js
@@ -0,0 +1,226 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var Yoonit_Camera_common_1 = require("./Yoonit.Camera.common");
+var image_source_1 = require("tns-core-modules/image-source");
+var file_system_1 = require("tns-core-modules/file-system");
+var YoonitCamera = (function (_super) {
+ __extends(YoonitCamera, _super);
+ function YoonitCamera() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.permission = false;
+ return _this;
+ }
+ YoonitCamera.prototype.createNativeView = function () {
+ this.nativeView = CameraView.new();
+ this.nativeView.cameraEventListener = CameraEventListener.initWithOwner(new WeakRef(this));
+ return this.nativeView;
+ };
+ YoonitCamera.prototype.initNativeView = function () {
+ this.nativeView.owner = this;
+ _super.prototype.initNativeView.call(this);
+ };
+ YoonitCamera.prototype.disposeNativeView = function () {
+ this.nativeView.stopCapture();
+ this.nativeView.cameraEventListener = null;
+ this.nativeView.owner = null;
+ _super.prototype.disposeNativeView.call(this);
+ };
+ YoonitCamera.prototype.startCapture = function (captureType) {
+ this.nativeView.startCaptureTypeWithCaptureType(captureType);
+ };
+ YoonitCamera.prototype.setFaceNumberOfImages = function (faceNumberOfImages) {
+ this.nativeView.setFaceNumberOfImagesWithFaceNumberOfImages(faceNumberOfImages);
+ };
+ YoonitCamera.prototype.setFaceDetectionBox = function (faceDetectionBox) {
+ this.nativeView.setFaceDetectionBoxWithFaceDetectionBox(faceDetectionBox);
+ };
+ YoonitCamera.prototype.setFaceTimeBetweenImages = function (faceTimeBetweenImages) {
+ this.nativeView.setFaceTimeBetweenImagesWithFaceTimeBetweenImages(faceTimeBetweenImages);
+ };
+ YoonitCamera.prototype.setFacePaddingPercent = function (facePaddingPercent) {
+ this.nativeView.setFacePaddingPercentWithFacePaddingPercent(facePaddingPercent);
+ };
+ YoonitCamera.prototype.setFaceImageSize = function (width, height) {
+ this.nativeView.setFaceImageSizeWithWidthHeight(width, height);
+ };
+ YoonitCamera.prototype.setFrameNumberOfImages = function (frameNumberOfImages) {
+ this.nativeView.setFrameNumberOfImagesWithFrameNumberOfImages(frameNumberOfImages);
+ };
+ YoonitCamera.prototype.setFrameTimeBetweenImages = function (frameTimeBetweenImages) {
+ this.nativeView.setFrameTimeBetweenImagesWithFrameTimeBetweenImages(frameTimeBetweenImages);
+ };
+ YoonitCamera.prototype.requestPermission = function (explanation) {
+ var _this = this;
+ if (explanation === void 0) { explanation = ''; }
+ return new Promise(function (resolve, reject) {
+ var cameraStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo);
+ switch (cameraStatus) {
+ case 0: {
+ AVCaptureDevice.requestAccessForMediaTypeCompletionHandler(AVMediaTypeVideo, function (granted) {
+ if (granted) {
+ _this.permission = true;
+ resolve(true);
+ }
+ else {
+ _this.permission = false;
+ reject(false);
+ }
+ });
+ break;
+ }
+ case 3: {
+ _this.permission = true;
+ resolve(true);
+ break;
+ }
+ case 1:
+ case 2: {
+ _this.permission = false;
+ reject(false);
+ break;
+ }
+ }
+ });
+ };
+ YoonitCamera.prototype.hasPermission = function () {
+ return this.permission;
+ };
+ return YoonitCamera;
+}(Yoonit_Camera_common_1.CameraBase));
+exports.YoonitCamera = YoonitCamera;
+var CameraEventListener = (function (_super) {
+ __extends(CameraEventListener, _super);
+ function CameraEventListener() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ CameraEventListener_1 = CameraEventListener;
+ CameraEventListener.initWithOwner = function (owner) {
+ var delegate = CameraEventListener_1.new();
+ delegate.owner = owner;
+ return delegate;
+ };
+ CameraEventListener.prototype.onFaceImageCreatedWithCountTotalImagePath = function (count, total, imagePath) {
+ var owner = this.owner.get();
+ var imageName = imagePath.split('/');
+ imageName = imageName[imageName.length - 1];
+ var finalPath = file_system_1.path.join(file_system_1.knownFolders.documents().path, imageName);
+ var imageSource = image_source_1.ImageSource.fromFileSync(finalPath);
+ if (owner) {
+ owner.notify({
+ eventName: 'faceImage',
+ object: owner,
+ count: count,
+ total: total,
+ image: {
+ path: finalPath,
+ source: imageSource
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onFrameImageCreatedWithCountTotalImagePath = function (count, total, imagePath) {
+ var owner = this.owner.get();
+ var imageName = imagePath.split('/');
+ imageName = imageName[imageName.length - 1];
+ var finalPath = file_system_1.path.join(file_system_1.knownFolders.documents().path, imageName);
+ var imageSource = image_source_1.ImageSource.fromFileSync(finalPath);
+ if (owner) {
+ owner.notify({
+ eventName: 'frameImage',
+ object: owner,
+ count: count,
+ total: total,
+ image: {
+ path: finalPath,
+ source: imageSource
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onFaceDetectedWithXYWidthHeight = function (x, y, width, height) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: x,
+ y: y,
+ width: width,
+ height: height
+ });
+ }
+ };
+ CameraEventListener.prototype.onFaceUndetected = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: null,
+ y: null,
+ width: null,
+ height: null
+ });
+ }
+ };
+ CameraEventListener.prototype.onEndCapture = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'endCapture',
+ object: owner,
+ });
+ }
+ };
+ CameraEventListener.prototype.onErrorWithError = function (error) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'error',
+ status: error
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onMessageWithMessage = function (message) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'message',
+ status: message
+ }
+ });
+ }
+ };
+ CameraEventListener.prototype.onPermissionDenied = function () {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'permissionDenied',
+ object: owner,
+ });
+ }
+ };
+ CameraEventListener.prototype.onBarcodeScannedWithContent = function (content) {
+ var owner = this.owner.get();
+ if (owner) {
+ owner.notify({
+ eventName: 'qrCodeContent',
+ object: owner,
+ content: content
+ });
+ }
+ };
+ var CameraEventListener_1;
+ CameraEventListener = CameraEventListener_1 = __decorate([
+ ObjCClass(CameraEventListenerDelegate)
+ ], CameraEventListener);
+ return CameraEventListener;
+}(NSObject));
+//# sourceMappingURL=Yoonit.Camera.ios.js.map
\ No newline at end of file
diff --git a/Yoonit.Camera.ios.js.map b/Yoonit.Camera.ios.js.map
new file mode 100644
index 0000000..a285f2a
--- /dev/null
+++ b/Yoonit.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,CAAC;SACnB;IACL,CAAC;IAEM,yDAA2B,GAAlC,UAAmC,OAAe;QAC9C,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAE/B,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,MAAM,CAAC;gBACT,SAAS,EAAE,eAAe;gBAC1B,MAAM,EAAE,KAAK;gBACb,OAAO,SAAA;aACiB,CAAC,CAAC;SACjC;IACL,CAAC;;IAtJC,mBAAmB;QADxB,SAAS,CAAC,2BAA2B,CAAC;OACjC,mBAAmB,CAuJxB;IAAD,0BAAC;CAAA,AAvJD,CAAkC,QAAQ,GAuJzC"}
\ No newline at end of file
diff --git a/Yoonit.Camera.ios.ts b/Yoonit.Camera.ios.ts
new file mode 100644
index 0000000..fab3512
--- /dev/null
+++ b/Yoonit.Camera.ios.ts
@@ -0,0 +1,298 @@
+// +-+-+-+-+-+-+
+// |y|o|o|n|i|t|
+// +-+-+-+-+-+-+
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Yoonit Camera Plugin for NativeScript applications |
+// | Luigui Delyer, Haroldo Teruya, |
+// | Victor Goulart & Márcio Bruffato @ Cyberlabs AI 2020 |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+import {
+ StatusEventData,
+ FaceImageCreatedEventData,
+ FaceDetectedEventData,
+ BarcodeScannedEventData,
+ FrameImageCreatedEventData
+} from '.';
+import { CameraBase } from './Yoonit.Camera.common';
+import { EventData } from 'tns-core-modules/ui/content-view';
+import { ImageSource } from 'tns-core-modules/image-source';
+import { knownFolders, path } from 'tns-core-modules/file-system';
+
+export class YoonitCamera extends CameraBase {
+
+ nativeView: CameraView;
+
+ private permission: boolean = false;
+
+ /**
+ * Creates new native button.
+ */
+ public createNativeView(): Object {
+ this.nativeView = CameraView.new();
+ this.nativeView.cameraEventListener = CameraEventListener.initWithOwner(new WeakRef(this));
+
+ return this.nativeView;
+ }
+
+ /**
+ * Initializes properties/listeners of the native view.
+ */
+ initNativeView(): void {
+ // Attach the owner to nativeView.
+ // When nativeView is tapped we get the owning JS object through this field.
+ (this.nativeView).owner = this;
+ super.initNativeView();
+ }
+
+ /**
+ * Clean up references to the native view and resets nativeView to its original state.
+ * If you have changed nativeView in some other way except through setNative callbacks
+ * you have a chance here to revert it back to its original state
+ * so that it could be reused later.
+ */
+ disposeNativeView(): void {
+ this.nativeView.stopCapture();
+ this.nativeView.cameraEventListener = null;
+
+ // Remove reference from native listener to this instance.
+ (this.nativeView).owner = null;
+
+ // If you want to recycle nativeView and have modified the nativeView
+ // without using Property or CssProperty (e.g. outside our property system - 'setNative' callbacks)
+ // you have to reset it to its initial state here.
+ super.disposeNativeView();
+ }
+
+ public startCapture(captureType: string) {
+ this.nativeView.startCaptureTypeWithCaptureType(captureType);
+ }
+
+ public setFaceNumberOfImages(faceNumberOfImages: number) {
+ this.nativeView.setFaceNumberOfImagesWithFaceNumberOfImages(faceNumberOfImages);
+ }
+
+ public setFaceDetectionBox(faceDetectionBox: boolean) {
+ this.nativeView.setFaceDetectionBoxWithFaceDetectionBox(faceDetectionBox);
+ }
+
+ public setFaceTimeBetweenImages(faceTimeBetweenImages: number) {
+ this.nativeView.setFaceTimeBetweenImagesWithFaceTimeBetweenImages(faceTimeBetweenImages);
+ }
+
+ public setFacePaddingPercent(facePaddingPercent: number) {
+ this.nativeView.setFacePaddingPercentWithFacePaddingPercent(facePaddingPercent);
+ }
+
+ public setFaceImageSize(width: number, height: number) {
+ this.nativeView.setFaceImageSizeWithWidthHeight(width, height);
+ }
+
+ public setFrameNumberOfImages(frameNumberOfImages: number) {
+ this.nativeView.setFrameNumberOfImagesWithFrameNumberOfImages(frameNumberOfImages);
+ }
+
+ public setFrameTimeBetweenImages(frameTimeBetweenImages: number) {
+ this.nativeView.setFrameTimeBetweenImagesWithFrameTimeBetweenImages(frameTimeBetweenImages);
+ }
+
+ public requestPermission(explanation: string = ''): Promise {
+ return new Promise((resolve, reject) => {
+ const cameraStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo);
+ switch (cameraStatus) {
+
+ // Not determined: Explicit user permission is required for media capture,
+ // but the user has not yet granted or denied such permission..
+ case 0: {
+ AVCaptureDevice.requestAccessForMediaTypeCompletionHandler(AVMediaTypeVideo, (granted) => {
+ if (granted) {
+ this.permission = true;
+ resolve(true);
+ } else {
+ this.permission = false;
+ reject(false);
+ }
+ });
+ break;
+ }
+
+ // Authorized: The user has explicitly granted permission for media capture,
+ // or explicit user permission is not necessary for the media type in question.
+ case 3: {
+ this.permission = true;
+ resolve(true);
+ break;
+ }
+
+ // Restricted: the user is not allowed to access media capture devices.
+ case 1:
+
+ // Denied: The user has explicitly denied permission for media capture.
+ case 2: {
+ this.permission = false;
+ reject(false);
+ break;
+ }
+ }
+ });
+ }
+
+ public hasPermission(): boolean {
+ return this.permission;
+ }
+}
+
+@ObjCClass(CameraEventListenerDelegate)
+class CameraEventListener extends NSObject implements CameraEventListenerDelegate {
+
+ private owner: WeakRef;
+
+ public static initWithOwner(owner: WeakRef): CameraEventListener {
+ const delegate = CameraEventListener.new() as CameraEventListener;
+ delegate.owner = owner;
+ return delegate;
+ }
+
+ public onFaceImageCreatedWithCountTotalImagePath(count: number, total: number, imagePath: string): void {
+ const owner = this.owner.get();
+ let imageName: any = imagePath.split('/');
+
+ imageName = imageName[imageName.length - 1];
+
+ const finalPath: string = path.join(knownFolders.documents().path, imageName);
+
+ const imageSource: ImageSource = ImageSource.fromFileSync(finalPath);
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceImage',
+ object: owner,
+ count,
+ total,
+ image: {
+ path: finalPath,
+ source: imageSource
+ }
+ } as FaceImageCreatedEventData);
+ }
+ }
+
+ public onFrameImageCreatedWithCountTotalImagePath(count: number, total: number, imagePath: string): void {
+ const owner = this.owner.get();
+ let imageName: any = imagePath.split('/');
+
+ imageName = imageName[imageName.length - 1];
+
+ const finalPath: string = path.join(knownFolders.documents().path, imageName);
+
+ const imageSource: ImageSource = ImageSource.fromFileSync(finalPath);
+
+ if (owner) {
+ owner.notify({
+ eventName: 'frameImage',
+ object: owner,
+ count,
+ total,
+ image: {
+ path: finalPath,
+ source: imageSource
+ }
+ } as FrameImageCreatedEventData);
+ }
+ }
+
+ public onFaceDetectedWithXYWidthHeight(x: number, y: number, width: number, height: number): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x,
+ y,
+ width,
+ height
+ } as FaceDetectedEventData);
+ }
+ }
+
+ public onFaceUndetected(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'faceDetected',
+ object: owner,
+ x: null,
+ y: null,
+ width: null,
+ height: null
+ } as EventData);
+ }
+ }
+
+ public onEndCapture(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'endCapture',
+ object: owner,
+ } as EventData);
+ }
+ }
+
+ public onErrorWithError(error: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'error',
+ status: error
+ }
+ } as StatusEventData);
+ }
+ }
+
+ public onMessageWithMessage(message: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'status',
+ object: owner,
+ status: {
+ type: 'message',
+ status: message
+ }
+ } as StatusEventData);
+ }
+ }
+
+ public onPermissionDenied(): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'permissionDenied',
+ object: owner,
+ } as EventData);
+ }
+ }
+
+ public onBarcodeScannedWithContent(content: string): void {
+ const owner = this.owner.get();
+
+ if (owner) {
+ owner.notify({
+ eventName: 'qrCodeContent',
+ object: owner,
+ content
+ } as BarcodeScannedEventData);
+ }
+ }
+}
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 0000000..a995fc8
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1,62 @@
+// +-+-+-+-+-+-+
+// |y|o|o|n|i|t|
+// +-+-+-+-+-+-+
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Yoonit Camera Plugin for NativeScript applications |
+// | Luigui Delyer, Haroldo Teruya, |
+// | Victor Goulart & Márcio Bruffato @ Cyberlabs AI 2020 |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+import { ContentView, EventData } from 'tns-core-modules/ui/content-view';
+
+export interface FaceImageCreatedEventData extends EventData {
+ count: number;
+ total: number;
+ image: any;
+}
+
+export interface FrameImageCreatedEventData extends EventData {
+ count: number;
+ total: number;
+ image: any;
+}
+
+export interface FaceDetectedEventData extends EventData {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+}
+
+export interface BarcodeScannedEventData extends EventData {
+ content: string;
+}
+
+export interface StatusEventData extends EventData {
+ status: any;
+}
+
+export declare class Camera extends ContentView {
+ requestPermission(explanationText?: string): Promise;
+ hasPermission(): boolean;
+ preview(): void;
+ startCapture(captureType: string): void;
+ stopCapture(): void;
+ toggleLens(): void;
+ getLens(): number;
+ setFaceNumberOfImages(faceNumberOfImages: number): void;
+ setFaceDetectionBox(faceDetectionBox: boolean): void;
+ setFaceTimeBetweenImages(faceTimeBetweenImages: number): void;
+ setFacePaddingPercent(facePaddingPercent: number): void;
+ setFaceImageSize(width: number, height: number): void;
+
+ on(eventNames: string, callback: (data: EventData) => void, thisArg?: any);
+ on(event: faceImage, callback: (args: FaceImageCreatedEventData) => void, thisArg?: any);
+ on(event: frameImage, callback: (args: FrameImageCreatedEventData) => void, thisArg?: any);
+ on(event: faceDetected, callback: (args: FaceDetectedEventData) => void, thisArg?: any);
+ on(event: endCapture, callback: () => void, thisArg?: any);
+ on(event: qrCodeContent, callback: (args: BarCodeScannedEventData) => void, thisArg?: any);
+ on(event: status, callback: (args: MessageEventData) => void, thisArg?: any);
+ on(event: permissionDenied, callback: () => void, thisArg?: any);
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..64dcd08
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,581 @@
+{
+ "name": "@yoonit/nativescript-camera",
+ "version": "1.2.1",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@babel/code-frame": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
+ "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
+ "dev": true,
+ "requires": {
+ "@babel/highlight": "^7.10.4"
+ }
+ },
+ "@babel/helper-validator-identifier": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
+ "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
+ "dev": true
+ },
+ "@babel/highlight": {
+ "version": "7.10.4",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
+ "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-validator-identifier": "^7.10.4",
+ "chalk": "^2.0.0",
+ "js-tokens": "^4.0.0"
+ }
+ },
+ "@nativescript/core": {
+ "version": "6.5.8",
+ "resolved": "https://registry.npmjs.org/@nativescript/core/-/core-6.5.8.tgz",
+ "integrity": "sha512-zxghkuVIXuWCtrPCnlq4eKbM2xNUPMxl+3NHu3gIE7eIcUVVZyoIbUdIEWfIYtt+Q7plHZ93xT/haJHWvsVMWg==",
+ "dev": true,
+ "requires": {
+ "css-tree": "^1.0.0-alpha.37",
+ "nativescript-hook": "0.2.5",
+ "reduce-css-calc": "^2.1.6",
+ "semver": "6.3.0",
+ "tns-core-modules-widgets": "^6.6.0-next-2020-05-08-112112-01",
+ "tslib": "1.10.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "async": {
+ "version": "0.9.2",
+ "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
+ "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=",
+ "dev": true
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
+ },
+ "colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "dev": true
+ },
+ "commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "css-tree": {
+ "version": "1.0.0-alpha.39",
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.39.tgz",
+ "integrity": "sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA==",
+ "dev": true,
+ "requires": {
+ "mdn-data": "2.0.6",
+ "source-map": "^0.6.1"
+ }
+ },
+ "css-unit-converter": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz",
+ "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==",
+ "dev": true
+ },
+ "cycle": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
+ "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=",
+ "dev": true
+ },
+ "deep-equal": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz",
+ "integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0=",
+ "dev": true
+ },
+ "diff": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
+ "eyes": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
+ "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=",
+ "dev": true
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.6",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
+ "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
+ },
+ "i": {
+ "version": "0.3.6",
+ "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz",
+ "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
+ "dev": true
+ },
+ "js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "3.14.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
+ "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
+ "dev": true,
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "mdn-data": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz",
+ "integrity": "sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA==",
+ "dev": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "mute-stream": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
+ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
+ "dev": true
+ },
+ "nativescript-hook": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.5.tgz",
+ "integrity": "sha512-ciGJtNbtMB2lGv8jAkUripkRjd3g8atX9VYPSt6e8PI6YPiOKeoma3xjcXoW66pFMYpHnfrbp6Mq9U/QtiQrVg==",
+ "dev": true,
+ "requires": {
+ "glob": "^6.0.1",
+ "mkdirp": "^0.5.1"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "6.0.4",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
+ "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
+ "dev": true,
+ "requires": {
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "2 || 3",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ }
+ }
+ },
+ "nativescript-permissions": {
+ "version": "1.3.9",
+ "resolved": "https://registry.npmjs.org/nativescript-permissions/-/nativescript-permissions-1.3.9.tgz",
+ "integrity": "sha512-Xrt7uN/+nNMOsPziw17VQAgFe5oQX0klEqJVaoM6G7MQm5mgnySaHbVGlupcgNNib+rAgFlrmqTW0LlzuQxtIg=="
+ },
+ "ncp": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz",
+ "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-parse": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "dev": true
+ },
+ "pkginfo": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz",
+ "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=",
+ "dev": true
+ },
+ "postcss-value-parser": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
+ "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
+ "dev": true
+ },
+ "prompt": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz",
+ "integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=",
+ "dev": true,
+ "requires": {
+ "colors": "^1.1.2",
+ "pkginfo": "0.x.x",
+ "read": "1.0.x",
+ "revalidator": "0.1.x",
+ "utile": "0.3.x",
+ "winston": "2.1.x"
+ }
+ },
+ "read": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
+ "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=",
+ "dev": true,
+ "requires": {
+ "mute-stream": "~0.0.4"
+ }
+ },
+ "reduce-css-calc": {
+ "version": "2.1.7",
+ "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.7.tgz",
+ "integrity": "sha512-fDnlZ+AybAS3C7Q9xDq5y8A2z+lT63zLbynew/lur/IR24OQF5x98tfNwf79mzEdfywZ0a2wpM860FhFfMxZlA==",
+ "dev": true,
+ "requires": {
+ "css-unit-converter": "^1.1.1",
+ "postcss-value-parser": "^3.3.0"
+ }
+ },
+ "resolve": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
+ "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "revalidator": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz",
+ "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "stack-trace": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
+ "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ },
+ "tns-core-modules": {
+ "version": "6.5.8",
+ "resolved": "https://registry.npmjs.org/tns-core-modules/-/tns-core-modules-6.5.8.tgz",
+ "integrity": "sha512-PNyq7QI+COkd1OVtuhwPlcz0sTLEfGIck8e9VLwZ2sjSIAb6i9kyf9KBA/fwbqdRzOUM1F1SsLXXxdEIaWnEog==",
+ "dev": true,
+ "requires": {
+ "@nativescript/core": "*"
+ }
+ },
+ "tns-core-modules-widgets": {
+ "version": "6.6.0-next-2020-05-08-112112-01",
+ "resolved": "https://registry.npmjs.org/tns-core-modules-widgets/-/tns-core-modules-widgets-6.6.0-next-2020-05-08-112112-01.tgz",
+ "integrity": "sha512-aW30j6gKiXP48XOs6qdO2SiPx61pUYOlMmQVovQbG6vBB8WbUR9k9UviY1cY/DExNUBOSh3cMe8uLOpDWiR49A==",
+ "dev": true
+ },
+ "tns-platform-declarations": {
+ "version": "6.5.8",
+ "resolved": "https://registry.npmjs.org/tns-platform-declarations/-/tns-platform-declarations-6.5.8.tgz",
+ "integrity": "sha512-QNgRlNO9gsEnq4PHYhT/zqo6sES4Vcd1yE5Oc6NxG0Jiz6lbMv3UKdtmSsGNJxxBeRdWlNj/jrAWq58Nz2GU9w==",
+ "dev": true
+ },
+ "tslib": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
+ "dev": true
+ },
+ "tslint": {
+ "version": "5.20.1",
+ "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz",
+ "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.0.0",
+ "builtin-modules": "^1.1.1",
+ "chalk": "^2.3.0",
+ "commander": "^2.12.1",
+ "diff": "^4.0.1",
+ "glob": "^7.1.1",
+ "js-yaml": "^3.13.1",
+ "minimatch": "^3.0.4",
+ "mkdirp": "^0.5.1",
+ "resolve": "^1.3.2",
+ "semver": "^5.3.0",
+ "tslib": "^1.8.0",
+ "tsutils": "^2.29.0"
+ }
+ },
+ "tsutils": {
+ "version": "2.29.0",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
+ "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.8.1"
+ }
+ },
+ "typescript": {
+ "version": "3.4.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
+ "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
+ "dev": true
+ },
+ "utile": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz",
+ "integrity": "sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo=",
+ "dev": true,
+ "requires": {
+ "async": "~0.9.0",
+ "deep-equal": "~0.2.1",
+ "i": "0.3.x",
+ "mkdirp": "0.x.x",
+ "ncp": "1.0.x",
+ "rimraf": "2.x.x"
+ }
+ },
+ "winston": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz",
+ "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=",
+ "dev": true,
+ "requires": {
+ "async": "~1.0.0",
+ "colors": "1.0.x",
+ "cycle": "1.0.x",
+ "eyes": "0.1.x",
+ "isstream": "0.1.x",
+ "pkginfo": "0.3.x",
+ "stack-trace": "0.0.x"
+ },
+ "dependencies": {
+ "async": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
+ "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=",
+ "dev": true
+ },
+ "colors": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
+ "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
+ "dev": true
+ },
+ "pkginfo": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
+ "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=",
+ "dev": true
+ }
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..929b64a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,53 @@
+{
+ "name": "@yoonit/nativescript-camera",
+ "version": "1.2.1",
+ "description": "Yoonit Camera have a custom view that shows a preview layer of the front/back camera and detects human faces in it and read qr code.",
+ "main": "Yoonit.Camera",
+ "typings": "index.d.ts",
+ "nativescript": {
+ "platforms": {
+ "android": "1.0.0",
+ "ios": "1.0.0"
+ }
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/Yoonit-Labs/nativescript-yoonit-camera"
+ },
+ "scripts": {
+ "tsc": "npm i && tsc",
+ "build": "npm run tsc && npm run build:native",
+ "build:native": "node scripts/build-native.js",
+ "tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
+ "ci:tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'",
+ "demo:ios": "npm i && cd ../demo-vue && tns run ios",
+ "demo:android": "cd ../demo-vue && tns debug android --debug-brk",
+ "demo:reset": "cd ../demo-vue && npx rimraf -- hooks node_modules platforms",
+ "plugin:prepare": "npm run build && cd ../demo-vue && tns plugin add ../src && tns plugin remove nativescript-yoonit-camera && npm i && tns plugin add ../src",
+ "clean": "npm run demo:reset && npx rimraf -- node_modules && npm i"
+ },
+ "keywords": [
+ "NativeScript",
+ "JavaScript",
+ "TypeScript",
+ "Android",
+ "iOS"
+ ],
+ "author": {
+ "name": "Luigui Delyer, Haroldo Teruya, Victor Goulart & Márcio Bruffato @ Cyberlabs AI - 2020",
+ "email": "contato@cyberlabs.ai"
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "tns-core-modules": "^6.0.0",
+ "tns-platform-declarations": "^6.0.0",
+ "typescript": "~3.4.5",
+ "prompt": "^1.0.0",
+ "rimraf": "^2.6.3",
+ "tslint": "^5.12.1",
+ "semver": "^5.6.0"
+ },
+ "dependencies": {
+ "nativescript-permissions": "^1.3.8"
+ }
+}
diff --git a/platforms/android/AndroidManifest.xml b/platforms/android/AndroidManifest.xml
new file mode 100644
index 0000000..f9bc23e
--- /dev/null
+++ b/platforms/android/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/platforms/android/include.gradle b/platforms/android/include.gradle
new file mode 100644
index 0000000..d16b00a
--- /dev/null
+++ b/platforms/android/include.gradle
@@ -0,0 +1,25 @@
+/* Include.gradle configuration: http://docs.nativescript.org/plugins/plugins#includegradle-specification */
+
+android {
+
+}
+
+repositories {
+ google()
+ jcenter()
+ maven { url "https://jitpack.io" }
+}
+
+dependencies {
+ api fileTree(dir: 'libs', include: ['*.aar'])
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+
+ implementation "androidx.camera:camera-view:1.0.0-alpha15"
+ implementation "androidx.camera:camera-camera2:1.0.0-beta08"
+
+ implementation 'com.google.mlkit:barcode-scanning:16.0.3'
+ implementation 'com.google.mlkit:face-detection:16.0.2'
+
+ implementation 'com.github.Yoonit-Labs:android-yoonit-camera:1.1.0'
+}
diff --git a/platforms/android/nativescript_camera.aar b/platforms/android/nativescript_camera.aar
new file mode 100644
index 0000000..d3caffb
Binary files /dev/null and b/platforms/android/nativescript_camera.aar differ
diff --git a/platforms/ios/Info.plist b/platforms/ios/Info.plist
new file mode 100644
index 0000000..9f7bbc8
--- /dev/null
+++ b/platforms/ios/Info.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ NSCameraUsageDescription
+ Requires access to camera.
+
+
diff --git a/platforms/ios/Podfile b/platforms/ios/Podfile
new file mode 100644
index 0000000..8bcbdcb
--- /dev/null
+++ b/platforms/ios/Podfile
@@ -0,0 +1,13 @@
+pod 'YoonitCamera', :git => "https://github.com/Yoonit-Labs/ios-yoonit-camera.git", :tag => '1.1.0'
+
+platform :ios, '12.0'
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ if target.name == 'yoonit-camera'
+ target.build_configurations.each do |config|
+ config.build_settings['SWIFT_VERSION'] = '5.0'
+ end
+ end
+ end
+end
diff --git a/references.d.ts b/references.d.ts
new file mode 100644
index 0000000..1e5e961
--- /dev/null
+++ b/references.d.ts
@@ -0,0 +1,2 @@
+///
+///
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..5e33b3f
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,27 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "declaration": true,
+ "removeComments": true,
+ "noLib": false,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "skipLibCheck": true,
+ "lib": ["es6", "dom"],
+ "sourceMap": true,
+ "pretty": true,
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "noEmitHelpers": true,
+ "noEmitOnError": false,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitUseStrict": false,
+ "noFallthroughCasesInSwitch": true
+ },
+ "exclude": [
+ "node_modules"
+ ],
+ "compileOnSave": false
+}
diff --git a/typings/android-declarations.d.ts b/typings/android-declarations.d.ts
new file mode 100644
index 0000000..972ba08
--- /dev/null
+++ b/typings/android-declarations.d.ts
@@ -0,0 +1,4 @@
+declare module native { export class Array { constructor(); length: number; [index: number]: T; } }
+
+import globalAndroid = android;
+
diff --git a/typings/android.d.ts b/typings/android.d.ts
new file mode 100644
index 0000000..e32895f
--- /dev/null
+++ b/typings/android.d.ts
@@ -0,0 +1,95 @@
+///
+
+declare module ai {
+ export module cyberlabs {
+ export module yoonit {
+ export module camera {
+ export class BuildConfig {
+ public static class: java.lang.Class;
+ public static DEBUG: boolean;
+ public static LIBRARY_PACKAGE_NAME: string;
+ public static APPLICATION_ID: string;
+ public static BUILD_TYPE: string;
+ public static FLAVOR: string;
+ public static VERSION_CODE: number;
+ public static VERSION_NAME: string;
+ public constructor();
+ }
+ }
+ }
+ }
+}
+
+declare module ai {
+ export module cyberlabs {
+ export module yoonit {
+ export module camera {
+ export class CameraView {
+ public static class: java.lang.Class;
+ public constructor(param0: globalAndroid.content.Context, param1: globalAndroid.util.AttributeSet);
+ public start(param0: ai.cyberlabs.yoonit.camera.CaptureOptions): void;
+ public startPreview(): void;
+ public startCaptureType(param0: string): void;
+ public stopCapture(): void;
+ public toggleCameraLens(): void;
+ public getCameraLens(): number;
+ public setCameraEventListener(param0: ai.cyberlabs.yoonit.camera.interfaces.CameraEventListener): void;
+ public setFaceNumberOfImages(param0: number): void;
+ public setFaceDetectionBox(param0: Boolean): void;
+ public setFaceTimeBetweenImages(param0: number): void;
+ public setFacePaddingPercent(param0: number): void;
+ public setFaceImageSize(param0: number, param1: number): void;
+ public setFrameNumberOfImages(param0: number): void;
+ public setFrameTimeBetweenImages(param0: number): void;
+ public constructor(param0: globalAndroid.content.Context);
+ }
+ export module CameraView {
+ export class DetectorCallback {
+ public static class: java.lang.Class;
+ public handleMessage(param0: globalAndroid.os.Message): boolean;
+ }
+ }
+ }
+ }
+ }
+}
+
+declare module ai {
+ export module cyberlabs {
+ export module yoonit {
+ export module camera {
+ export class CameraGraphicView extends ai.cyberlabs.yoonit.camera.CameraGraphicView {
+ public static class: java.lang.Class;
+ public draw(param0: globalAndroid.graphics.Canvas): void;
+ public drawBoundingBox(param0: globqalAndroid.graphics.RectF);
+ public clear();
+ }
+ }
+ }
+ }
+}
+
+
+declare module ai {
+ export module cyberlabs {
+ export module yoonit {
+ export module camera {
+ export module interfaces {
+ export class CameraEventListener {
+ public static class: java.lang.Class;
+ public onFaceImageCreated(param0: number, param1: number, param2: string): void;
+ public onFrameImageCreated(param0: number, param1: number, param2: string): void;
+ public onFaceDetected(param0: number, param1: number, param2: number, param3: number): void;
+ public onFaceUndetected(): void;
+ public onEndCapture(): void;
+ public onError(param0: string): void;
+ public onMessage(param0: string): void;
+ public onPermissionDenied(): void;
+ public onBarcodeScanned(param0: string);
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/typings/objc!FaceTracker.d.ts b/typings/objc!FaceTracker.d.ts
new file mode 100644
index 0000000..b20f1c4
--- /dev/null
+++ b/typings/objc!FaceTracker.d.ts
@@ -0,0 +1,75 @@
+/**
+ * File generated by this command in the demo-vue project:
+ * TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios
+ */
+
+interface CameraEventListenerDelegate {
+
+ onFaceImageCreatedWithCountTotalImagePath(count: number, total: number, imagePath: string): void;
+
+ onFaceDetectedWithXYWidthHeight(x: number, y: number, width: number, height: number): void;
+
+ onFaceUndetected(): void;
+
+ onEndCapture(): void;
+
+ onErrorWithError(error: string): void;
+
+ onMessageWithMessage(message: string): void;
+
+ onPermissionDenied(): void;
+
+ onBarcodeScannedWithContent(content: string): void;
+
+ onFrameImageCreatedWithCountTotalImagePath(count: number, total: number, imagePath: string): void;
+}
+
+declare var CameraEventListenerDelegate: {
+
+ prototype: CameraEventListenerDelegate;
+};
+
+declare class CameraView extends UIView {
+
+ static alloc(): CameraView; // inherited from NSObject
+
+ static appearance(): CameraView; // inherited from UIAppearance
+
+ static appearanceForTraitCollection(trait: UITraitCollection): CameraView; // inherited from UIAppearance
+
+ static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): CameraView; // inherited from UIAppearance
+
+ static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray | typeof NSObject[]): CameraView; // inherited from UIAppearance
+
+ static appearanceWhenContainedIn(ContainerClass: typeof NSObject): CameraView; // inherited from UIAppearance
+
+ static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray | typeof NSObject[]): CameraView; // inherited from UIAppearance
+
+ static new(): CameraView; // inherited from NSObject
+
+ cameraEventListener: CameraEventListenerDelegate;
+
+ getCameraLens(): number;
+
+ setFaceDetectionBoxWithFaceDetectionBox(faceDetectionBox: boolean): void;
+
+ setFaceImageSizeWithWidthHeight(width: number, height: number): void;
+
+ setFaceNumberOfImagesWithFaceNumberOfImages(faceNumberOfImages: number): void;
+
+ setFacePaddingPercentWithFacePaddingPercent(facePaddingPercent: number): void;
+
+ setFaceTimeBetweenImagesWithFaceTimeBetweenImages(faceTimeBetweenImages: number): void;
+
+ setFrameNumberOfImagesWithFrameNumberOfImages(frameNumberOfImages: number): void;
+
+ setFrameTimeBetweenImagesWithFrameTimeBetweenImages(frameTimeBetweenImages: number): void;
+
+ startCaptureTypeWithCaptureType(captureType: string): void;
+
+ startPreview(): void;
+
+ stopCapture(): void;
+
+ toggleCameraLens(): void;
+}
diff --git a/vue.js b/vue.js
new file mode 100644
index 0000000..6647dfd
--- /dev/null
+++ b/vue.js
@@ -0,0 +1,90 @@
+// +-+-+-+-+-+-+
+// |y|o|o|n|i|t|
+// +-+-+-+-+-+-+
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Yoonit Camera Plugin for NativeScript applications |
+// | Luigui Delyer, Haroldo Teruya, |
+// | Victor Goulart & Márcio Bruffato @ Cyberlabs AI 2020 |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+import { YoonitCamera } from './Yoonit.Camera'
+
+export default {
+ install (Vue) {
+ Vue.registerElement(
+ 'YoonitCamera',
+ () => require('./Yoonit.Camera')
+ .YoonitCamera
+ )
+
+ Vue.prototype.$yoo = {
+ ...Vue.prototype.$yoo,
+ camera: undefined
+ }
+
+ const destroy = () => {
+ if (Vue.prototype.$yoo.camera &&
+ Vue.prototype.$yoo.camera.stopCapture instanceof Function) {
+ Vue.prototype.$yoo.camera.stopCapture()
+ }
+
+ Vue.prototype.$yoo = {
+ ...Vue.prototype.$yoo,
+ camera: {
+ registerElement
+ }
+ }
+
+ return Vue.prototype.$yoo.camera
+ }
+
+ const registerElement = element => {
+ if (!element.nativeView) {
+ return
+ }
+
+ const {
+ nativeView,
+ preview,
+ stopCapture,
+ toggleLens,
+ getLens,
+ startCapture,
+ setFaceNumberOfImages,
+ setFaceDetectionBox,
+ setFaceTimeBetweenImages,
+ setFacePaddingPercent,
+ setFaceImageSize,
+ setFrameNumberOfImages,
+ setFrameTimeBetweenImages,
+ requestPermission,
+ hasPermission
+ } = element.nativeView
+
+ Vue.prototype.$yoo.camera = {
+ ...Vue.prototype.$yoo.camera,
+ destroy,
+ nativeView,
+ requestPermission,
+ hasPermission,
+ preview,
+ startCapture,
+ stopCapture,
+ toggleLens,
+ getLens,
+ setFaceNumberOfImages,
+ setFaceDetectionBox,
+ setFaceTimeBetweenImages,
+ setFacePaddingPercent,
+ setFaceImageSize,
+ setFrameNumberOfImages,
+ setFrameTimeBetweenImages
+ }
+
+ return Vue.prototype.$yoo.camera
+ }
+
+ return destroy()
+ }
+}