1
- import { BarcodeFormats , barcodeFormatsProperty , CameraPosition , cameraPositionProperty , DetectionType , faceDetectionMinFaceSizeProperty , faceDetectionPerformanceModeProperty , faceDetectionTrackingEnabledProperty , imageLablerConfidenceThresholdProperty , MLKitViewBase , objectDetectionClassifyProperty , objectDetectionMultipleProperty } from "./common" ;
1
+ import { BarcodeFormats , barcodeFormatsProperty , CameraPosition , cameraPositionProperty , DetectionType , faceDetectionMinFaceSizeProperty , faceDetectionPerformanceModeProperty , faceDetectionTrackingEnabledProperty , imageLablerConfidenceThresholdProperty , MLKitViewBase , objectDetectionClassifyProperty , objectDetectionMultipleProperty , onDetectionProperty } from "./common" ;
2
2
import { Application , Device , Utils , AndroidActivityRequestPermissionsEventData } from '@nativescript/core' ;
3
3
import lazy from '@nativescript/core/utils/lazy' ;
4
4
@@ -19,12 +19,11 @@ const IMAGE_LABELING_SUPPORTED = lazy(() => typeof io.github.triniwiz.fancycamer
19
19
const OBJECT_DETECTION_SUPPORTED = lazy ( ( ) => typeof io . github . triniwiz . fancycamera ?. objectdetection ?. ObjectDetection ) ;
20
20
const POSE_DETECTION_SUPPORTED = lazy ( ( ) => typeof io . github . triniwiz . fancycamera ?. posedetection ?. PoseDetection ) ;
21
21
22
- export { BarcodeFormats , barcodeFormatsProperty , CameraPosition , cameraPositionProperty , DetectionType , faceDetectionMinFaceSizeProperty , faceDetectionPerformanceModeProperty , faceDetectionTrackingEnabledProperty , imageLablerConfidenceThresholdProperty , objectDetectionClassifyProperty , objectDetectionMultipleProperty } from './common' ;
22
+ export { BarcodeFormats , barcodeFormatsProperty , CameraPosition , cameraPositionProperty , DetectionType , faceDetectionMinFaceSizeProperty , faceDetectionPerformanceModeProperty , faceDetectionTrackingEnabledProperty , imageLabelerConfidenceThresholdProperty , objectDetectionClassifyProperty , objectDetectionMultipleProperty } from './common' ;
23
23
24
24
export class MLKitView extends MLKitViewBase {
25
25
#camera: io . github . triniwiz . fancycamera . FancyCamera ;
26
26
static #hasCamera: boolean ;
27
- #onDetection: ( data : { [ key : string ] : any } ) => void ;
28
27
#onTextListener: io . github . triniwiz . fancycamera . ImageAnalysisCallback ;
29
28
#onBarcodeListener: io . github . triniwiz . fancycamera . ImageAnalysisCallback ;
30
29
#onDigitalInkListener: io . github . triniwiz . fancycamera . ImageAnalysisCallback ;
@@ -87,11 +86,9 @@ export class MLKitView extends MLKitViewBase {
87
86
return this . #hasCamera;
88
87
}
89
88
90
- //@ts -ignore
91
- set onDetection ( value ) {
92
- this . #onDetection = value ;
89
+ [ onDetectionProperty . setNative ] ( value ) {
93
90
const ref = new WeakRef ( this ) ;
94
- if ( ! this . #onTextListener && ( this . dectectionType === DetectionType . Text || this . dectectionType === DetectionType . All ) ) {
91
+ if ( ! this . #onTextListener && ( this . detectionType === DetectionType . Text || this . detectionType === DetectionType . All ) ) {
95
92
this . #onTextListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
96
93
onSuccess ( param0 : string ) {
97
94
try {
@@ -105,7 +102,7 @@ export class MLKitView extends MLKitViewBase {
105
102
this . #camera. setOnTextRecognitionListener ( this . #onTextListener) ;
106
103
}
107
104
108
- if ( ! this . #onBarcodeListener && ( this . dectectionType === DetectionType . Barcode || this . dectectionType === DetectionType . All ) ) {
105
+ if ( ! this . #onBarcodeListener && ( this . detectionType . includes ( DetectionType . Barcode ) || this . detectionType . includes ( DetectionType . All ) ) ) {
109
106
this . #onBarcodeListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
110
107
onSuccess ( param0 : string ) {
111
108
try {
@@ -120,7 +117,7 @@ export class MLKitView extends MLKitViewBase {
120
117
}
121
118
122
119
// todo
123
- if ( ! this . #onDigitalInkListener && ( this . dectectionType === DetectionType . DigitalInk || this . dectectionType === DetectionType . All ) ) {
120
+ if ( ! this . #onDigitalInkListener && ( this . detectionType === DetectionType . DigitalInk || this . detectionType === DetectionType . All ) ) {
124
121
/* this.#onDigitalInkListener = new io.github.triniwiz.fancycamera.ImageAnalysisCallback({
125
122
onSuccess(param0: string) {
126
123
try {
@@ -133,7 +130,7 @@ export class MLKitView extends MLKitViewBase {
133
130
}); */
134
131
}
135
132
136
- if ( ! this . #onFaceListener && ( this . dectectionType === DetectionType . Face || this . dectectionType === DetectionType . All ) ) {
133
+ if ( ! this . #onFaceListener && ( this . detectionType === DetectionType . Face || this . detectionType === DetectionType . All ) ) {
137
134
this . #faceDetectionOptions = new io . github . triniwiz . fancycamera . facedetection . FaceDetection . Options ( ) ;
138
135
this . #onFaceListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
139
136
onSuccess ( param0 : string ) {
@@ -148,7 +145,7 @@ export class MLKitView extends MLKitViewBase {
148
145
this . #camera. setOnFacesDetectedListener ( this . #onFaceListener) ;
149
146
}
150
147
151
- if ( ! this . #onImageListener && ( this . dectectionType === DetectionType . Image || this . dectectionType === DetectionType . All ) ) {
148
+ if ( ! this . #onImageListener && ( this . detectionType === DetectionType . Image || this . detectionType === DetectionType . All ) ) {
152
149
this . #onImageListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
153
150
onSuccess ( param0 : string ) {
154
151
try {
@@ -162,7 +159,7 @@ export class MLKitView extends MLKitViewBase {
162
159
this . #camera. setOnImageLabelingListener ( this . #onImageListener) ;
163
160
}
164
161
165
- if ( ! this . #onObjectListener && ( this . dectectionType === DetectionType . Object || this . dectectionType === DetectionType . All ) ) {
162
+ if ( ! this . #onObjectListener && ( this . detectionType === DetectionType . Object || this . detectionType === DetectionType . All ) ) {
166
163
this . #onObjectListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
167
164
onSuccess ( param0 : string ) {
168
165
try {
@@ -176,7 +173,7 @@ export class MLKitView extends MLKitViewBase {
176
173
this . #camera. setOnObjectDetectedListener ( this . #onObjectListener) ;
177
174
}
178
175
179
- if ( ! this . #onPoseListener && ( this . dectectionType === DetectionType . Pose || this . dectectionType === DetectionType . All ) ) {
176
+ if ( ! this . #onPoseListener && ( this . detectionType === DetectionType . Pose || this . detectionType === DetectionType . All ) ) {
180
177
this . #onPoseListener = new io . github . triniwiz . fancycamera . ImageAnalysisCallback ( {
181
178
onSuccess ( param0 : string ) {
182
179
try {
@@ -191,7 +188,7 @@ export class MLKitView extends MLKitViewBase {
191
188
}
192
189
193
190
let type = DetectorType_None ( ) ;
194
- switch ( this . dectectionType ) {
191
+ switch ( this . detectionType ) {
195
192
case DetectionType . All :
196
193
type = DetectorType_All ( ) ;
197
194
break ;
@@ -219,14 +216,8 @@ export class MLKitView extends MLKitViewBase {
219
216
}
220
217
221
218
this . #camera. setDetectorType ( type ) ;
222
-
223
- }
224
-
225
- get onDetection ( ) {
226
- return this . #onDetection;
227
219
}
228
220
229
-
230
221
[ barcodeFormatsProperty . setNative ] ( value : BarcodeFormats [ ] ) {
231
222
if ( ! BARCODE_SCANNER_SUPPORTED ( ) ) {
232
223
return ;
0 commit comments