@symbiote-native/camera 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/build/angular/camera-view/index.d.ts +43 -0
- package/build/angular/camera-view/index.js +101 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +4 -0
- package/build/angular/services/camera-permissions.service.d.ts +8 -0
- package/build/angular/services/camera-permissions.service.js +82 -0
- package/build/core/android-barcode.d.ts +50 -0
- package/build/core/android-barcode.js +2 -0
- package/build/core/camera-api.d.ts +35 -0
- package/build/core/camera-api.js +68 -0
- package/build/core/camera-view-events.d.ts +3 -0
- package/build/core/camera-view-events.js +60 -0
- package/build/core/camera-view-handle.d.ts +26 -0
- package/build/core/camera-view-handle.js +40 -0
- package/build/core/camera-view.d.ts +12 -0
- package/build/core/camera-view.js +38 -0
- package/build/core/constants.d.ts +6 -0
- package/build/core/constants.js +7 -0
- package/build/core/index.d.ts +9 -0
- package/build/core/index.js +5 -0
- package/build/core/native-module.d.ts +28 -0
- package/build/core/native-module.js +3 -0
- package/build/core/picture-options.d.ts +9 -0
- package/build/core/picture-options.js +29 -0
- package/build/core/picture-ref.d.ts +2 -0
- package/build/core/picture-ref.js +3 -0
- package/build/core/props.d.ts +4 -0
- package/build/core/props.js +26 -0
- package/build/core/types.d.ts +170 -0
- package/build/core/types.js +1 -0
- package/build/react/camera-view.d.ts +8 -0
- package/build/react/camera-view.js +6 -0
- package/build/react/index.d.ts +5 -0
- package/build/react/index.js +4 -0
- package/build/react/use-camera-permissions.d.ts +9 -0
- package/build/react/use-camera-permissions.js +5 -0
- package/build/solid/camera-view.d.ts +33 -0
- package/build/solid/camera-view.js +4 -0
- package/build/solid/index.d.ts +4 -0
- package/build/solid/index.js +4 -0
- package/build/solid/use-camera-permissions.d.ts +10 -0
- package/build/solid/use-camera-permissions.js +5 -0
- package/build/svelte/camera-view.svelte +32 -0
- package/build/svelte/camera-view.svelte.d.ts +22 -0
- package/build/svelte/index.d.ts +4 -0
- package/build/svelte/index.js +4 -0
- package/build/svelte/use-camera-permissions.svelte.d.ts +9 -0
- package/build/svelte/use-camera-permissions.svelte.js +5 -0
- package/build/vue/camera-view.d.ts +2 -0
- package/build/vue/camera-view.js +4 -0
- package/build/vue/index.d.ts +4 -0
- package/build/vue/index.js +4 -0
- package/build/vue/use-camera-permissions.d.ts +10 -0
- package/build/vue/use-camera-permissions.js +5 -0
- package/build-ngc/angular/camera-view/index.d.ts +46 -0
- package/build-ngc/angular/camera-view/index.js +60 -0
- package/build-ngc/angular/camera-view/index.js.map +1 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/camera-permissions.service.d.ts +13 -0
- package/build-ngc/angular/services/camera-permissions.service.js +28 -0
- package/build-ngc/angular/services/camera-permissions.service.js.map +1 -0
- package/build-ngc/core/android-barcode.d.ts +50 -0
- package/build-ngc/core/android-barcode.js +3 -0
- package/build-ngc/core/android-barcode.js.map +1 -0
- package/build-ngc/core/camera-api.d.ts +35 -0
- package/build-ngc/core/camera-api.js +69 -0
- package/build-ngc/core/camera-api.js.map +1 -0
- package/build-ngc/core/camera-view-events.d.ts +3 -0
- package/build-ngc/core/camera-view-events.js +61 -0
- package/build-ngc/core/camera-view-events.js.map +1 -0
- package/build-ngc/core/camera-view-handle.d.ts +26 -0
- package/build-ngc/core/camera-view-handle.js +41 -0
- package/build-ngc/core/camera-view-handle.js.map +1 -0
- package/build-ngc/core/camera-view.d.ts +12 -0
- package/build-ngc/core/camera-view.js +39 -0
- package/build-ngc/core/camera-view.js.map +1 -0
- package/build-ngc/core/constants.d.ts +6 -0
- package/build-ngc/core/constants.js +8 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/index.d.ts +9 -0
- package/build-ngc/core/index.js +6 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +28 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/picture-options.d.ts +9 -0
- package/build-ngc/core/picture-options.js +30 -0
- package/build-ngc/core/picture-options.js.map +1 -0
- package/build-ngc/core/picture-ref.d.ts +2 -0
- package/build-ngc/core/picture-ref.js +4 -0
- package/build-ngc/core/picture-ref.js.map +1 -0
- package/build-ngc/core/props.d.ts +4 -0
- package/build-ngc/core/props.js +27 -0
- package/build-ngc/core/props.js.map +1 -0
- package/build-ngc/core/types.d.ts +170 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +22 -0
- package/package.json +144 -3
- package/src/angular/camera-view/index.ts +95 -0
- package/src/angular/index.ts +8 -0
- package/src/angular/services/camera-permissions.service.ts +28 -0
- package/src/core/android-barcode.ts +48 -0
- package/src/core/camera-api.ts +99 -0
- package/src/core/camera-view-events.ts +103 -0
- package/src/core/camera-view-handle.ts +93 -0
- package/src/core/camera-view.ts +56 -0
- package/src/core/constants.ts +11 -0
- package/src/core/index.ts +57 -0
- package/src/core/native-module.ts +57 -0
- package/src/core/picture-options.ts +46 -0
- package/src/core/picture-ref.ts +4 -0
- package/src/core/props.ts +31 -0
- package/src/core/types.ts +223 -0
- package/src/react/camera-view.ts +17 -0
- package/src/react/index.ts +7 -0
- package/src/react/use-camera-permissions.ts +21 -0
- package/src/solid/camera-view.ts +9 -0
- package/src/solid/index.ts +6 -0
- package/src/solid/use-camera-permissions.ts +22 -0
- package/src/svelte/camera-view.svelte +32 -0
- package/src/svelte/index.ts +9 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/svelte/use-camera-permissions.svelte.ts +21 -0
- package/src/vue/camera-view.ts +5 -0
- package/src/vue/index.ts +6 -0
- package/src/vue/use-camera-permissions.ts +22 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
+
import type { ICameraViewHandle, ICameraViewProps } from '../../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** Angular twin of `expo-camera`'s `CameraView` */
|
|
6
|
+
export declare class CameraView extends NativeViewBase {
|
|
7
|
+
facing?: ICameraViewProps['facing'];
|
|
8
|
+
flash?: ICameraViewProps['flash'];
|
|
9
|
+
zoom?: ICameraViewProps['zoom'];
|
|
10
|
+
mode?: ICameraViewProps['mode'];
|
|
11
|
+
mute?: ICameraViewProps['mute'];
|
|
12
|
+
mirror?: ICameraViewProps['mirror'];
|
|
13
|
+
autofocus?: ICameraViewProps['autofocus'];
|
|
14
|
+
active?: ICameraViewProps['active'];
|
|
15
|
+
videoQuality?: ICameraViewProps['videoQuality'];
|
|
16
|
+
videoBitrate?: ICameraViewProps['videoBitrate'];
|
|
17
|
+
animateShutter?: ICameraViewProps['animateShutter'];
|
|
18
|
+
pictureSize?: ICameraViewProps['pictureSize'];
|
|
19
|
+
selectedLens?: ICameraViewProps['selectedLens'];
|
|
20
|
+
enableTorch?: ICameraViewProps['enableTorch'];
|
|
21
|
+
videoStabilizationMode?: ICameraViewProps['videoStabilizationMode'];
|
|
22
|
+
barcodeScannerSettings?: ICameraViewProps['barcodeScannerSettings'];
|
|
23
|
+
responsiveOrientationWhenOrientationLocked?: ICameraViewProps['responsiveOrientationWhenOrientationLocked'];
|
|
24
|
+
ratio?: ICameraViewProps['ratio'];
|
|
25
|
+
onCameraReady?: ICameraViewProps['onCameraReady'];
|
|
26
|
+
onMountError?: ICameraViewProps['onMountError'];
|
|
27
|
+
onBarcodeScanned?: ICameraViewProps['onBarcodeScanned'];
|
|
28
|
+
onResponsiveOrientationChanged?: ICameraViewProps['onResponsiveOrientationChanged'];
|
|
29
|
+
onAvailableLensesChanged?: ICameraViewProps['onAvailableLensesChanged'];
|
|
30
|
+
private readonly view;
|
|
31
|
+
readonly takePictureAsync: ICameraViewHandle['takePictureAsync'];
|
|
32
|
+
readonly recordAsync: ICameraViewHandle['recordAsync'];
|
|
33
|
+
readonly toggleRecordingAsync: ICameraViewHandle['toggleRecordingAsync'];
|
|
34
|
+
readonly stopRecording: ICameraViewHandle['stopRecording'];
|
|
35
|
+
readonly pausePreview: ICameraViewHandle['pausePreview'];
|
|
36
|
+
readonly resumePreview: ICameraViewHandle['resumePreview'];
|
|
37
|
+
readonly getAvailablePictureSizesAsync: ICameraViewHandle['getAvailablePictureSizesAsync'];
|
|
38
|
+
readonly getAvailableLensesAsync: ICameraViewHandle['getAvailableLensesAsync'];
|
|
39
|
+
readonly getSupportedFeatures: ICameraViewHandle['getSupportedFeatures'];
|
|
40
|
+
readonly getHostNode: ICameraViewHandle['getHostNode'];
|
|
41
|
+
constructor();
|
|
42
|
+
protected readonly propNames: readonly ["facing", "flash", "zoom", "mode", "mute", "mirror", "autofocus", "active", "videoQuality", "videoBitrate", "animateShutter", "pictureSize", "selectedLens", "enableTorch", "videoStabilizationMode", "barcodeScannerSettings", "responsiveOrientationWhenOrientationLocked", "ratio", "onCameraReady", "onMountError", "onBarcodeScanned", "onResponsiveOrientationChanged", "onAvailableLensesChanged"];
|
|
43
|
+
protected renderView(props: object): IDescriptor | null;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CameraView, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CameraView, "CameraView", never, { "facing": { "alias": "facing"; "required": false; }; "flash": { "alias": "flash"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "mute": { "alias": "mute"; "required": false; }; "mirror": { "alias": "mirror"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "active": { "alias": "active"; "required": false; }; "videoQuality": { "alias": "videoQuality"; "required": false; }; "videoBitrate": { "alias": "videoBitrate"; "required": false; }; "animateShutter": { "alias": "animateShutter"; "required": false; }; "pictureSize": { "alias": "pictureSize"; "required": false; }; "selectedLens": { "alias": "selectedLens"; "required": false; }; "enableTorch": { "alias": "enableTorch"; "required": false; }; "videoStabilizationMode": { "alias": "videoStabilizationMode"; "required": false; }; "barcodeScannerSettings": { "alias": "barcodeScannerSettings"; "required": false; }; "responsiveOrientationWhenOrientationLocked": { "alias": "responsiveOrientationWhenOrientationLocked"; "required": false; }; "ratio": { "alias": "ratio"; "required": false; }; "onCameraReady": { "alias": "onCameraReady"; "required": false; }; "onMountError": { "alias": "onMountError"; "required": false; }; "onBarcodeScanned": { "alias": "onBarcodeScanned"; "required": false; }; "onResponsiveOrientationChanged": { "alias": "onResponsiveOrientationChanged"; "required": false; }; "onAvailableLensesChanged": { "alias": "onAvailableLensesChanged"; "required": false; }; }, {}, never, never, true, never>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { DescriptorOutlet, NativeViewBase } from '@symbiote-native/angular';
|
|
3
|
+
import { createCameraView } from '../../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// One list is the inputs of the component and the props it hands to the native view
|
|
6
|
+
const CAMERA_VIEW_INPUTS = [
|
|
7
|
+
'facing',
|
|
8
|
+
'flash',
|
|
9
|
+
'zoom',
|
|
10
|
+
'mode',
|
|
11
|
+
'mute',
|
|
12
|
+
'mirror',
|
|
13
|
+
'autofocus',
|
|
14
|
+
'active',
|
|
15
|
+
'videoQuality',
|
|
16
|
+
'videoBitrate',
|
|
17
|
+
'animateShutter',
|
|
18
|
+
'pictureSize',
|
|
19
|
+
'selectedLens',
|
|
20
|
+
'enableTorch',
|
|
21
|
+
'videoStabilizationMode',
|
|
22
|
+
'barcodeScannerSettings',
|
|
23
|
+
'responsiveOrientationWhenOrientationLocked',
|
|
24
|
+
'ratio',
|
|
25
|
+
'onCameraReady',
|
|
26
|
+
'onMountError',
|
|
27
|
+
'onBarcodeScanned',
|
|
28
|
+
'onResponsiveOrientationChanged',
|
|
29
|
+
'onAvailableLensesChanged',
|
|
30
|
+
];
|
|
31
|
+
/** Angular twin of `expo-camera`'s `CameraView` */
|
|
32
|
+
export class CameraView extends NativeViewBase {
|
|
33
|
+
view = createCameraView(() => this.hostNode());
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
Object.assign(this, this.view.handle);
|
|
37
|
+
}
|
|
38
|
+
propNames = CAMERA_VIEW_INPUTS;
|
|
39
|
+
renderView(props) {
|
|
40
|
+
return this.view.render(props);
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CameraView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: CameraView, isStandalone: true, selector: "CameraView", inputs: { facing: "facing", flash: "flash", zoom: "zoom", mode: "mode", mute: "mute", mirror: "mirror", autofocus: "autofocus", active: "active", videoQuality: "videoQuality", videoBitrate: "videoBitrate", animateShutter: "animateShutter", pictureSize: "pictureSize", selectedLens: "selectedLens", enableTorch: "enableTorch", videoStabilizationMode: "videoStabilizationMode", barcodeScannerSettings: "barcodeScannerSettings", responsiveOrientationWhenOrientationLocked: "responsiveOrientationWhenOrientationLocked", ratio: "ratio", onCameraReady: "onCameraReady", onMountError: "onMountError", onBarcodeScanned: "onBarcodeScanned", onResponsiveOrientationChanged: "onResponsiveOrientationChanged", onAvailableLensesChanged: "onAvailableLensesChanged" }, usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
|
|
44
|
+
<symbiote-descriptor-outlet [node]="node" />
|
|
45
|
+
}`, isInline: true, dependencies: [{ kind: "component", type: DescriptorOutlet, selector: "symbiote-descriptor-outlet", inputs: ["node"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CameraView, decorators: [{
|
|
48
|
+
type: Component,
|
|
49
|
+
args: [{
|
|
50
|
+
selector: 'CameraView',
|
|
51
|
+
standalone: true,
|
|
52
|
+
imports: [DescriptorOutlet],
|
|
53
|
+
inputs: [...CAMERA_VIEW_INPUTS],
|
|
54
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
55
|
+
template: `@if (descriptor; as node) {
|
|
56
|
+
<symbiote-descriptor-outlet [node]="node" />
|
|
57
|
+
}`,
|
|
58
|
+
}]
|
|
59
|
+
}], ctorParameters: () => [] });
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/camera-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;;AAG9C,oFAAoF;AACpF,MAAM,kBAAkB,GAAG;IACzB,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,aAAa;IACb,wBAAwB;IACxB,wBAAwB;IACxB,4CAA4C;IAC5C,OAAO;IACP,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,gCAAgC;IAChC,0BAA0B;CAClB,CAAC;AAEX,mDAAmD;AAWnD,MAAM,OAAO,UAAW,SAAQ,cAAc;IA0B3B,IAAI,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAchE;QACE,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAE2B,SAAS,GAAG,kBAAkB,CAAC;IAExC,UAAU,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;uGAjDU,UAAU;2FAAV,UAAU,+0BAJX;;IAER,4DALQ,gBAAgB;;2FAOf,UAAU;kBAVtB,SAAS;mBAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,MAAM,EAAE,CAAC,GAAG,kBAAkB,CAAC;oBAC/B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;IAER;iBACH"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/camera/angular: камера, съёмка, запись видео и сканирование кодов на общем ядре
|
|
2
|
+
export { CameraView } from './camera-view';
|
|
3
|
+
export { CameraPermissionsService, MicrophonePermissionsService, } from './services/camera-permissions.service';
|
|
4
|
+
export * from '../core';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PermissionsServiceBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class CameraPermissionsService extends PermissionsServiceBase<PermissionResponse> {
|
|
5
|
+
constructor();
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CameraPermissionsService, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CameraPermissionsService>;
|
|
8
|
+
}
|
|
9
|
+
export declare class MicrophonePermissionsService extends PermissionsServiceBase<PermissionResponse> {
|
|
10
|
+
constructor();
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MicrophonePermissionsService, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MicrophonePermissionsService>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { PermissionsServiceBase } from '@symbiote-native/angular';
|
|
3
|
+
import { cameraPermissionMethods, microphonePermissionMethods, } from '../../core/camera-api';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// Angular twin of `../../react`'s camera permission hooks
|
|
6
|
+
export class CameraPermissionsService extends PermissionsServiceBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(cameraPermissionMethods.getMethod, cameraPermissionMethods.requestMethod);
|
|
9
|
+
}
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CameraPermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
11
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CameraPermissionsService, providedIn: 'root' });
|
|
12
|
+
}
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CameraPermissionsService, decorators: [{
|
|
14
|
+
type: Injectable,
|
|
15
|
+
args: [{ providedIn: 'root' }]
|
|
16
|
+
}], ctorParameters: () => [] });
|
|
17
|
+
export class MicrophonePermissionsService extends PermissionsServiceBase {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(microphonePermissionMethods.getMethod, microphonePermissionMethods.requestMethod);
|
|
20
|
+
}
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MicrophonePermissionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
22
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MicrophonePermissionsService, providedIn: 'root' });
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: MicrophonePermissionsService, decorators: [{
|
|
25
|
+
type: Injectable,
|
|
26
|
+
args: [{ providedIn: 'root' }]
|
|
27
|
+
}], ctorParameters: () => [] });
|
|
28
|
+
//# sourceMappingURL=camera-permissions.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-permissions.service.js","sourceRoot":"","sources":["../../../src/angular/services/camera-permissions.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;;AAG/B,0DAA0D;AAE1D,MAAM,OAAO,wBAAyB,SAAQ,sBAA0C;IACtF;QACE,KAAK,CACH,uBAAuB,CAAC,SAAS,EACjC,uBAAuB,CAAC,aAAa,CACtC,CAAC;IACJ,CAAC;uGANU,wBAAwB;2GAAxB,wBAAwB,cADX,MAAM;;2FACnB,wBAAwB;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAWlC,MAAM,OAAO,4BAA6B,SAAQ,sBAA0C;IAC1F;QACE,KAAK,CACH,2BAA2B,CAAC,SAAS,EACrC,2BAA2B,CAAC,aAAa,CAC1C,CAAC;IACJ,CAAC;uGANU,4BAA4B;2GAA5B,4BAA4B,cADf,MAAM;;2FACnB,4BAA4B;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
type IAndroidBarcodeKind<TType extends string> = {
|
|
2
|
+
type: TType;
|
|
3
|
+
};
|
|
4
|
+
export type IAndroidBarcode = (IAndroidBarcodeKind<'contactInfo'> & {
|
|
5
|
+
firstName?: string;
|
|
6
|
+
middleName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
organization?: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
phone?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
address?: string;
|
|
14
|
+
}) | (IAndroidBarcodeKind<'geoPoint'> & {
|
|
15
|
+
lat: string;
|
|
16
|
+
lng: string;
|
|
17
|
+
}) | (IAndroidBarcodeKind<'sms'> & {
|
|
18
|
+
phoneNumber?: string;
|
|
19
|
+
message?: string;
|
|
20
|
+
}) | (IAndroidBarcodeKind<'url'> & {
|
|
21
|
+
url?: string;
|
|
22
|
+
}) | (IAndroidBarcodeKind<'calendarEvent'> & {
|
|
23
|
+
summary?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
location?: string;
|
|
26
|
+
start?: string;
|
|
27
|
+
end?: string;
|
|
28
|
+
}) | (IAndroidBarcodeKind<'driverLicense'> & {
|
|
29
|
+
firstName?: string;
|
|
30
|
+
middleName?: string;
|
|
31
|
+
lastName?: string;
|
|
32
|
+
licenseNumber?: string;
|
|
33
|
+
expiryDate?: string;
|
|
34
|
+
issueDate?: string;
|
|
35
|
+
addressStreet?: string;
|
|
36
|
+
addressCity?: string;
|
|
37
|
+
addressState?: string;
|
|
38
|
+
}) | (IAndroidBarcodeKind<'email'> & {
|
|
39
|
+
address?: string;
|
|
40
|
+
subject?: string;
|
|
41
|
+
body?: string;
|
|
42
|
+
}) | (IAndroidBarcodeKind<'phone'> & {
|
|
43
|
+
number?: string;
|
|
44
|
+
phoneNumberType?: string;
|
|
45
|
+
}) | (IAndroidBarcodeKind<'wifi'> & {
|
|
46
|
+
ssid?: string;
|
|
47
|
+
password?: string;
|
|
48
|
+
encryptionType?: string;
|
|
49
|
+
});
|
|
50
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android-barcode.js","sourceRoot":"","sources":["../../src/core/android-barcode.ts"],"names":[],"mappings":"AAAA,4DAA4D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EventSubscription, PermissionResponse } from 'expo-modules-core';
|
|
2
|
+
import type { ICameraBarcodeScanningResult, ICameraBarcodeType, ICameraScanningOptions, ICameraScanningResult, ICameraVideoCodec } from './types';
|
|
3
|
+
/** Whether the device has a camera, the permissions are a separate question */
|
|
4
|
+
export declare function isCameraAvailableAsync(): Promise<boolean>;
|
|
5
|
+
/** iOS only */
|
|
6
|
+
export declare function getAvailableVideoCodecsAsync(): Promise<ICameraVideoCodec[]>;
|
|
7
|
+
/** Whether the device has `DataScannerViewController` (iOS 16+) or Google's code scanner */
|
|
8
|
+
export declare function isModernBarcodeScannerAvailable(): boolean;
|
|
9
|
+
/** A device without the modern scanner does nothing here */
|
|
10
|
+
export declare function launchScanner(options?: ICameraScanningOptions): Promise<void>;
|
|
11
|
+
/** Dismisses the scanner on iOS, on Android it closes itself after a scan */
|
|
12
|
+
export declare function dismissScanner(): Promise<void>;
|
|
13
|
+
export declare function onModernBarcodeScanned(listener: (event: ICameraScanningResult) => void): EventSubscription;
|
|
14
|
+
/** Only QR codes are scanned on iOS */
|
|
15
|
+
export declare function scanFromURLAsync(url: string, barcodeTypes?: ICameraBarcodeType[]): Promise<ICameraBarcodeScanningResult[]>;
|
|
16
|
+
declare function getCameraPermissionsAsync(): Promise<PermissionResponse>;
|
|
17
|
+
declare function requestCameraPermissionsAsync(): Promise<PermissionResponse>;
|
|
18
|
+
declare function getMicrophonePermissionsAsync(): Promise<PermissionResponse>;
|
|
19
|
+
declare function requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;
|
|
20
|
+
export declare const Camera: {
|
|
21
|
+
getCameraPermissionsAsync: typeof getCameraPermissionsAsync;
|
|
22
|
+
requestCameraPermissionsAsync: typeof requestCameraPermissionsAsync;
|
|
23
|
+
getMicrophonePermissionsAsync: typeof getMicrophonePermissionsAsync;
|
|
24
|
+
requestMicrophonePermissionsAsync: typeof requestMicrophonePermissionsAsync;
|
|
25
|
+
scanFromURLAsync: typeof scanFromURLAsync;
|
|
26
|
+
};
|
|
27
|
+
export declare const cameraPermissionMethods: {
|
|
28
|
+
getMethod: typeof getCameraPermissionsAsync;
|
|
29
|
+
requestMethod: typeof requestCameraPermissionsAsync;
|
|
30
|
+
};
|
|
31
|
+
export declare const microphonePermissionMethods: {
|
|
32
|
+
getMethod: typeof getMicrophonePermissionsAsync;
|
|
33
|
+
requestMethod: typeof requestMicrophonePermissionsAsync;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
|
+
import { CAMERA_PACKAGE_NAME, MODERN_SCANNER_EVENT } from './constants';
|
|
3
|
+
import { expoCamera } from './native-module';
|
|
4
|
+
/** Whether the device has a camera, the permissions are a separate question */
|
|
5
|
+
export async function isCameraAvailableAsync() {
|
|
6
|
+
if (!expoCamera.isAvailableAsync) {
|
|
7
|
+
throw new UnavailabilityError(CAMERA_PACKAGE_NAME, 'isAvailableAsync');
|
|
8
|
+
}
|
|
9
|
+
return expoCamera.isAvailableAsync();
|
|
10
|
+
}
|
|
11
|
+
/** iOS only */
|
|
12
|
+
export async function getAvailableVideoCodecsAsync() {
|
|
13
|
+
if (!expoCamera.getAvailableVideoCodecsAsync) {
|
|
14
|
+
throw new UnavailabilityError('Camera', 'getAvailableVideoCodecsAsync');
|
|
15
|
+
}
|
|
16
|
+
return expoCamera.getAvailableVideoCodecsAsync();
|
|
17
|
+
}
|
|
18
|
+
/** Whether the device has `DataScannerViewController` (iOS 16+) or Google's code scanner */
|
|
19
|
+
export function isModernBarcodeScannerAvailable() {
|
|
20
|
+
return expoCamera.isModernBarcodeScannerAvailable;
|
|
21
|
+
}
|
|
22
|
+
/** A device without the modern scanner does nothing here */
|
|
23
|
+
export async function launchScanner(options = { barcodeTypes: [] }) {
|
|
24
|
+
if (expoCamera.isModernBarcodeScannerAvailable) {
|
|
25
|
+
await expoCamera.launchScanner(options);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Dismisses the scanner on iOS, on Android it closes itself after a scan */
|
|
29
|
+
export async function dismissScanner() {
|
|
30
|
+
if (expoCamera.isModernBarcodeScannerAvailable) {
|
|
31
|
+
await expoCamera.dismissScanner();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function onModernBarcodeScanned(listener) {
|
|
35
|
+
return expoCamera.addListener(MODERN_SCANNER_EVENT, listener);
|
|
36
|
+
}
|
|
37
|
+
/** Only QR codes are scanned on iOS */
|
|
38
|
+
export async function scanFromURLAsync(url, barcodeTypes = ['qr']) {
|
|
39
|
+
return expoCamera.scanFromURLAsync(url, barcodeTypes);
|
|
40
|
+
}
|
|
41
|
+
async function getCameraPermissionsAsync() {
|
|
42
|
+
return expoCamera.getCameraPermissionsAsync();
|
|
43
|
+
}
|
|
44
|
+
async function requestCameraPermissionsAsync() {
|
|
45
|
+
return expoCamera.requestCameraPermissionsAsync();
|
|
46
|
+
}
|
|
47
|
+
async function getMicrophonePermissionsAsync() {
|
|
48
|
+
return expoCamera.getMicrophonePermissionsAsync();
|
|
49
|
+
}
|
|
50
|
+
async function requestMicrophonePermissionsAsync() {
|
|
51
|
+
return expoCamera.requestMicrophonePermissionsAsync();
|
|
52
|
+
}
|
|
53
|
+
export const Camera = {
|
|
54
|
+
getCameraPermissionsAsync,
|
|
55
|
+
requestCameraPermissionsAsync,
|
|
56
|
+
getMicrophonePermissionsAsync,
|
|
57
|
+
requestMicrophonePermissionsAsync,
|
|
58
|
+
scanFromURLAsync,
|
|
59
|
+
};
|
|
60
|
+
// What every adapter's `createPermissionHook` binds, `useCameraPermissions` and its twin
|
|
61
|
+
export const cameraPermissionMethods = {
|
|
62
|
+
getMethod: getCameraPermissionsAsync,
|
|
63
|
+
requestMethod: requestCameraPermissionsAsync,
|
|
64
|
+
};
|
|
65
|
+
export const microphonePermissionMethods = {
|
|
66
|
+
getMethod: getMicrophonePermissionsAsync,
|
|
67
|
+
requestMethod: requestMicrophonePermissionsAsync,
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=camera-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-api.js","sourceRoot":"","sources":["../../src/core/camera-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,UAAU,CAAC,gBAAgB,EAAE,CAAC;AACvC,CAAC;AAED,eAAe;AACf,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAGhD,IAAI,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC;QAC7C,MAAM,IAAI,mBAAmB,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,UAAU,CAAC,4BAA4B,EAAE,CAAC;AACnD,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,+BAA+B;IAC7C,OAAO,UAAU,CAAC,+BAA+B,CAAC;AACpD,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAAkC,EAAE,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AE,6BAA6B;IACxC,aAAa,EAAE,iCAAiC;CACjD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BARCODE_EVENT_THROTTLE_MS } from './constants';
|
|
2
|
+
import { handlePictureSaved } from './picture-options';
|
|
3
|
+
function hasField(value, key, kind) {
|
|
4
|
+
return typeof Reflect.get(Object(value), key) === kind;
|
|
5
|
+
}
|
|
6
|
+
const isMountError = (value) => hasField(value, 'message', 'string');
|
|
7
|
+
const isOrientation = (value) => hasField(value, 'orientation', 'string');
|
|
8
|
+
const isLenses = (value) => Array.isArray(Reflect.get(Object(value), 'lenses'));
|
|
9
|
+
const isScanningResult = (value) => hasField(value, 'type', 'string') && hasField(value, 'data', 'string');
|
|
10
|
+
function isPictureSaved(value) {
|
|
11
|
+
return hasField(value, 'id', 'number') && hasField(value, 'data', 'object');
|
|
12
|
+
}
|
|
13
|
+
// Hands the callback the payload inside the native event, and only when it has the expected shape
|
|
14
|
+
function forward(props, name, isPayload) {
|
|
15
|
+
return (event) => {
|
|
16
|
+
const callback = Reflect.get(props, name);
|
|
17
|
+
if (typeof callback === 'function' && isPayload(event.nativeEvent)) {
|
|
18
|
+
callback(event.nativeEvent);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** One per view, the throttle of the barcode events belongs to the view */
|
|
23
|
+
export function createCameraViewEvents() {
|
|
24
|
+
const lastScans = new Map();
|
|
25
|
+
// Equal events of one type inside the window are the same scan seen again
|
|
26
|
+
const throttledScan = (callback) => (event) => {
|
|
27
|
+
const result = event.nativeEvent;
|
|
28
|
+
if (!isScanningResult(result))
|
|
29
|
+
return;
|
|
30
|
+
const json = JSON.stringify(result);
|
|
31
|
+
const now = Date.now();
|
|
32
|
+
const last = lastScans.get(result.type);
|
|
33
|
+
if (last?.json === json && now - last.at < BARCODE_EVENT_THROTTLE_MS) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
callback(result);
|
|
37
|
+
lastScans.set(result.type, { json, at: now });
|
|
38
|
+
};
|
|
39
|
+
return props => {
|
|
40
|
+
const onBarcodeScanned = Reflect.get(props, 'onBarcodeScanned');
|
|
41
|
+
const onCameraReady = Reflect.get(props, 'onCameraReady');
|
|
42
|
+
return {
|
|
43
|
+
onCameraReady: () => {
|
|
44
|
+
if (typeof onCameraReady === 'function')
|
|
45
|
+
onCameraReady();
|
|
46
|
+
},
|
|
47
|
+
onMountError: forward(props, 'onMountError', isMountError),
|
|
48
|
+
onBarcodeScanned: typeof onBarcodeScanned === 'function'
|
|
49
|
+
? throttledScan(result => onBarcodeScanned(result))
|
|
50
|
+
: undefined,
|
|
51
|
+
onAvailableLensesChanged: forward(props, 'onAvailableLensesChanged', isLenses),
|
|
52
|
+
onResponsiveOrientationChanged: forward(props, 'onResponsiveOrientationChanged', isOrientation),
|
|
53
|
+
onPictureSaved: (event) => {
|
|
54
|
+
if (isPictureSaved(event.nativeEvent)) {
|
|
55
|
+
handlePictureSaved({ nativeEvent: event.nativeEvent });
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=camera-view-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-view-events.js","sourceRoot":"","sources":["../../src/core/camera-view-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAWvD,SAAS,QAAQ,CAAC,KAAc,EAAE,GAAW,EAAE,IAAY;IACzD,OAAO,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;AACzD,CAAC;AAED,MAAM,YAAY,GAA8B,CAAC,KAAK,EAA8B,EAAE,CACpF,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC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CAAC,KAAqB,EAAQ,EAAE;gBAC9C,IAAI,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;oBACtC,kBAAkB,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ISymbioteNode } from '@symbiote-native/engine';
|
|
2
|
+
import type { ICameraPictureRef } from './native-module';
|
|
3
|
+
import type { ICameraCapturedPicture, ICameraPictureOptions, ICameraRecordingOptions, ICameraSupportedFeatures } from './types';
|
|
4
|
+
export type ICameraViewHandle = {
|
|
5
|
+
/** Waits for `onCameraReady` first. With `pictureRef` it resolves to a native image reference */
|
|
6
|
+
takePictureAsync(options: ICameraPictureOptions & {
|
|
7
|
+
pictureRef: true;
|
|
8
|
+
}): Promise<ICameraPictureRef | undefined>;
|
|
9
|
+
takePictureAsync(options?: ICameraPictureOptions): Promise<ICameraCapturedPicture | undefined>;
|
|
10
|
+
/** Resolves when `stopRecording` runs, a limit is reached or the preview stops */
|
|
11
|
+
recordAsync(options?: ICameraRecordingOptions): Promise<{
|
|
12
|
+
uri: string;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
/** Pauses or resumes the recording, iOS 18 and later on iOS */
|
|
15
|
+
toggleRecordingAsync(): Promise<void>;
|
|
16
|
+
stopRecording(): void;
|
|
17
|
+
pausePreview(): Promise<void>;
|
|
18
|
+
resumePreview(): Promise<void>;
|
|
19
|
+
getAvailablePictureSizesAsync(): Promise<string[]>;
|
|
20
|
+
/** Lenses exist on iOS only */
|
|
21
|
+
getAvailableLensesAsync(): Promise<string[]>;
|
|
22
|
+
getSupportedFeatures(): ICameraSupportedFeatures;
|
|
23
|
+
/** The host node of the mounted view, `createCameraTextureAsync` of a GL view takes it */
|
|
24
|
+
getHostNode(): ISymbioteNode | null;
|
|
25
|
+
};
|
|
26
|
+
export declare function createCameraViewHandle(getNode: () => ISymbioteNode | null | undefined): ICameraViewHandle;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Platform, requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
import { defineExpoViewMethods, getNativeTag } from '@symbiote-native/engine';
|
|
3
|
+
import { CAMERA_MODULE_NAME } from './constants';
|
|
4
|
+
import { expoCamera } from './native-module';
|
|
5
|
+
import { ensurePictureOptions, ensureRecordingOptions } from './picture-options';
|
|
6
|
+
const callViewFunction = defineExpoViewMethods(requireNativeModule, CAMERA_MODULE_NAME);
|
|
7
|
+
export function createCameraViewHandle(getNode) {
|
|
8
|
+
// Like upstream's `ref.current?.`, a view that has not committed yet answers nothing
|
|
9
|
+
function call(method, args = []) {
|
|
10
|
+
const node = getNode();
|
|
11
|
+
if (!node || getNativeTag(node) === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
return callViewFunction(node, method, args);
|
|
14
|
+
}
|
|
15
|
+
async function takePictureAsync(options) {
|
|
16
|
+
const pictureOptions = ensurePictureOptions(options);
|
|
17
|
+
// The picture ref is an iOS feature, Android answers a plain picture
|
|
18
|
+
if (Platform.select({ ios: Boolean(options?.pictureRef), default: false })) {
|
|
19
|
+
return call('takePictureRef', [pictureOptions]);
|
|
20
|
+
}
|
|
21
|
+
return call('takePicture', [pictureOptions]);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
takePictureAsync,
|
|
25
|
+
recordAsync: async (options) => call('record', [ensureRecordingOptions(options)]),
|
|
26
|
+
toggleRecordingAsync: async () => call('toggleRecording'),
|
|
27
|
+
stopRecording: () => {
|
|
28
|
+
call('stopRecording');
|
|
29
|
+
},
|
|
30
|
+
pausePreview: async () => call('pausePreview'),
|
|
31
|
+
resumePreview: async () => call('resumePreview'),
|
|
32
|
+
getAvailablePictureSizesAsync: async () => (await call('getAvailablePictureSizes')) ?? [],
|
|
33
|
+
getAvailableLensesAsync: async () => (await call('getAvailableLenses')) ?? [],
|
|
34
|
+
getSupportedFeatures: () => ({
|
|
35
|
+
isModernBarcodeScannerAvailable: expoCamera.isModernBarcodeScannerAvailable,
|
|
36
|
+
toggleRecordingAsyncAvailable: expoCamera.toggleRecordingAsyncAvailable,
|
|
37
|
+
}),
|
|
38
|
+
getHostNode: () => getNode() ?? null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=camera-view-handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-view-handle.js","sourceRoot":"","sources":["../../src/core/camera-view-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAiCjF,MAAM,gBAAgB,GAAG,qBAAqB,CAC5C,mBAAmB,EACnB,kBAAkB,CACnB,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,OAA+C;IAE/C,qFAAqF;IACrF,SAAS,IAAI,CACX,MAAc,EACd,OAA2B,EAAE;QAE7B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAChE,OAAO,gBAAgB,CAAU,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAQD,KAAK,UAAU,gBAAgB,CAAC,OAA+B;QAC7D,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACrD,qEAAqE;QACrE,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,GA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ine';
|
|
3
|
+
import type { ICameraViewHandle } from './camera-view-handle';
|
|
4
|
+
export declare const cameraViewName: () => string;
|
|
5
|
+
export declare const ensureCameraViewRegistered: () => boolean;
|
|
6
|
+
export type ICameraView = {
|
|
7
|
+
handle: ICameraViewHandle;
|
|
8
|
+
/** `null` means the view cannot register and the caller renders nothing */
|
|
9
|
+
render(props: object): IDescriptor | null;
|
|
10
|
+
};
|
|
11
|
+
/** One per mounted view, `getNode` answers the host node once it exists */
|
|
12
|
+
export declare function createCameraView(getNode: () => ISymbioteNode | null | undefined): ICameraView;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Ядро `CameraView`: нативный view камеры, чьи функции вызываются через `ViewPrototypes`
|
|
2
|
+
import { requireNativeViewManager } from 'expo-modules-core';
|
|
3
|
+
import { el } from '@symbiote-native/components';
|
|
4
|
+
import { defineExpoNativeView, isDevBuild } from '@symbiote-native/engine';
|
|
5
|
+
import { createCameraViewEvents } from './camera-view-events';
|
|
6
|
+
import { createCameraViewHandle } from './camera-view-handle';
|
|
7
|
+
import { CAMERA_MODULE_NAME } from './constants';
|
|
8
|
+
import { ensureNativeProps } from './props';
|
|
9
|
+
// Регистрация идёт при рендере: побочный эффект барреля теряется в release
|
|
10
|
+
const cameraView = defineExpoNativeView(requireNativeViewManager, CAMERA_MODULE_NAME);
|
|
11
|
+
export const cameraViewName = cameraView.name;
|
|
12
|
+
export const ensureCameraViewRegistered = cameraView.ensureRegistered;
|
|
13
|
+
// What upstream's `defaultProps` gave the class component
|
|
14
|
+
const DEFAULT_VIEW_PROPS = {
|
|
15
|
+
zoom: 0,
|
|
16
|
+
facing: 'back',
|
|
17
|
+
enableTorch: false,
|
|
18
|
+
mode: 'picture',
|
|
19
|
+
flash: 'off',
|
|
20
|
+
};
|
|
21
|
+
/** One per mounted view, `getNode` answers the host node once it exists */
|
|
22
|
+
export function createCameraView(getNode) {
|
|
23
|
+
const toEvents = createCameraViewEvents();
|
|
24
|
+
return {
|
|
25
|
+
handle: createCameraViewHandle(getNode),
|
|
26
|
+
render: props => {
|
|
27
|
+
if (!ensureCameraViewRegistered()) {
|
|
28
|
+
if (isDevBuild())
|
|
29
|
+
console.warn("'CameraView' is not available.");
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return el(cameraViewName(), {
|
|
33
|
+
...ensureNativeProps({ ...DEFAULT_VIEW_PROPS, ...props }),
|
|
34
|
+
...toEvents(props),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=camera-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-view.js","sourceRoot":"","sources":["../../src/core/camera-view.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,UAAU,GAAG,oBAAoB,CACrC,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;AAE9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,gBAAgB,CAAC;AAEtE,0DAA0D;AAC1D,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,KAAK;IAClB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,KAAK;CACb,CAAC;AAQF,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAC9B,OAA+C;IAE/C,MAAM,QAAQ,GAAG,sBAAsB,EAAE,CAAC;IAC1C,OAAO;QACL,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC;QACvC,MAAM,EAAE,KAAK,CAAC,EAAE;YACd,IAAI,CAAC,0BAA0B,EAAE,EAAE,CAAC;gBAClC,IAAI,UAAU,EAAE;oBAAE,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;gBACjE,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,EAAE,CAAC,cAAc,EAAE,EAAE;gBAC1B,GAAG,iBAAiB,CAAC,EAAE,GAAG,kBAAkB,EAAE,GAAG,KAAK,EAAE,CAAC;gBACzD,GAAG,QAAQ,CAAC,KAAK,CAAC;aACnB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CAMERA_MODULE_NAME = "ExpoCamera";
|
|
2
|
+
/** The label upstream puts into its `UnavailabilityError` */
|
|
3
|
+
export declare const CAMERA_PACKAGE_NAME = "expo-camera";
|
|
4
|
+
/** Equal barcode events of one type inside this window are dropped */
|
|
5
|
+
export declare const BARCODE_EVENT_THROTTLE_MS = 500;
|
|
6
|
+
export declare const MODERN_SCANNER_EVENT = "onModernBarcodeScanned";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Apart from `native-module`, which resolves the module on import: the view needs the name too
|
|
2
|
+
export const CAMERA_MODULE_NAME = 'ExpoCamera';
|
|
3
|
+
/** The label upstream puts into its `UnavailabilityError` */
|
|
4
|
+
export const CAMERA_PACKAGE_NAME = 'expo-camera';
|
|
5
|
+
/** Equal barcode events of one type inside this window are dropped */
|
|
6
|
+
export const BARCODE_EVENT_THROTTLE_MS = 500;
|
|
7
|
+
export const MODERN_SCANNER_EVENT = 'onModernBarcodeScanned';
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,sEAAsE;AACtE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api';
|
|
2
|
+
export { cameraViewName, createCameraView, ensureCameraViewRegistered, type ICameraView, } from './camera-view';
|
|
3
|
+
export type { ICameraViewHandle } from './camera-view-handle';
|
|
4
|
+
export { CAMERA_MODULE_NAME } from './constants';
|
|
5
|
+
export type { ICameraPictureRef } from './native-module';
|
|
6
|
+
export { PictureRef } from './picture-ref';
|
|
7
|
+
export type { IAndroidBarcode } from './android-barcode';
|
|
8
|
+
export type { ICameraAvailableLenses, ICameraBarcodeBounds, ICameraBarcodePoint, ICameraBarcodeScanningResult, ICameraBarcodeSettings, ICameraBarcodeType, ICameraCapturedPicture, ICameraFlashMode, ICameraFocusMode, ICameraMode, ICameraMountError, ICameraOrientation, ICameraPhotoResult, ICameraPictureOptions, ICameraRatio, ICameraRecordingOptions, ICameraResponsiveOrientation, ICameraSavePictureOptions, ICameraScanningOptions, ICameraScanningResult, ICameraSupportedFeatures, ICameraType, ICameraVideoCodec, ICameraVideoQuality, ICameraVideoStabilization, ICameraViewProps, } from './types';
|
|
9
|
+
export { PermissionStatus, type EventSubscription, type PermissionExpiration, type PermissionResponse, } from 'expo-modules-core';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api';
|
|
2
|
+
export { cameraViewName, createCameraView, ensureCameraViewRegistered, } from './camera-view';
|
|
3
|
+
export { CAMERA_MODULE_NAME } from './constants';
|
|
4
|
+
export { PictureRef } from './picture-ref';
|
|
5
|
+
export { PermissionStatus, } from 'expo-modules-core';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,uBAAuB,EACvB,cAAc,EACd,4BAA4B,EAC5B,sBAAsB,EACtB,+BAA+B,EAC/B,aAAa,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,0BAA0B,GAE3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8B3C,OAAO,EACL,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC"}
|