1
1
import { ImageAsset } from '@nativescript/core' ;
2
-
2
+ import { PermissionsResult , PermissionResult } from './common' ;
3
3
/**
4
4
* Take a photo using the camera.
5
5
* @param options - Optional parameter for setting different camera options.
@@ -9,56 +9,55 @@ export function takePicture(options?: CameraOptions): Promise<ImageAsset>;
9
9
/**
10
10
* Check required permissions for using device camera.
11
11
*/
12
- export function requestPermissions ( ) : Promise < any > ;
13
- export function requestCameraPermissions ( ) : Promise < any > ;
14
- export function requestPhotosPermissions ( ) : Promise < any > ;
12
+ export function requestPermissions ( ) : Promise < PermissionsResult > ;
13
+ export function requestCameraPermissions ( ) : Promise < PermissionResult > ;
14
+ export function requestPhotosPermissions ( ) : Promise < PermissionResult > ;
15
15
16
16
/**
17
17
* Is the camera available to use
18
18
*/
19
19
export function isAvailable ( ) : Boolean ;
20
20
21
21
export interface CameraOptions {
22
- /**
23
- * Defines the desired width (in device independent pixels) of the taken image. It should be used with height property.
24
- * If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image.
25
- * The actual image width will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions).
26
- */
27
- width ?: number ;
28
-
29
- /**
30
- * Defines the desired height (in device independent pixels) of the taken image. It should be used with width property.
31
- * If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image.
32
- * The actual image height will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions).
33
- */
34
- height ?: number ;
35
-
36
- /**
37
- * Defines if camera picture aspect ratio should be kept during picture resizing.
38
- * This property could affect width or height return values.
39
- */
40
- keepAspectRatio ?: boolean ;
41
-
42
- /**
43
- * Defines if camera picture should be copied to photo Gallery (Android) or Photos (iOS)
44
- */
45
- saveToGallery ?: boolean ;
46
-
47
- /**
48
- * iOS Only
49
- * Defines if camera "Retake" or "Use Photo" screen forces user to crop camera picture to a square and optionally lets them zoom in.
50
- */
51
- allowsEditing ?: boolean ;
52
-
53
- /**
54
- * The initial camera. Default "rear".
55
- * The current implementation doesn't work on all Android devices, in which case it falls back to the default behavior.
56
- */
57
- cameraFacing ?: "front" | "rear" ;
58
-
59
-
60
- /**
61
- * (iOS Only) Specify a custom UIModalPresentationStyle (Defaults to UIModalPresentationStyle.FullScreen)
62
- */
63
- modalPresentationStyle ?: number ;
22
+ /**
23
+ * Defines the desired width (in device independent pixels) of the taken image. It should be used with height property.
24
+ * If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image.
25
+ * The actual image width will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions).
26
+ */
27
+ width ?: number ;
28
+
29
+ /**
30
+ * Defines the desired height (in device independent pixels) of the taken image. It should be used with width property.
31
+ * If `keepAspectRatio` actual image width could be different in order to keep the aspect ratio of the original camera image.
32
+ * The actual image height will be greater than requested if the display density of the device is higher (than 1) (full HD+ resolutions).
33
+ */
34
+ height ?: number ;
35
+
36
+ /**
37
+ * Defines if camera picture aspect ratio should be kept during picture resizing.
38
+ * This property could affect width or height return values.
39
+ */
40
+ keepAspectRatio ?: boolean ;
41
+
42
+ /**
43
+ * Defines if camera picture should be copied to photo Gallery (Android) or Photos (iOS)
44
+ */
45
+ saveToGallery ?: boolean ;
46
+
47
+ /**
48
+ * iOS Only
49
+ * Defines if camera "Retake" or "Use Photo" screen forces user to crop camera picture to a square and optionally lets them zoom in.
50
+ */
51
+ allowsEditing ?: boolean ;
52
+
53
+ /**
54
+ * The initial camera. Default "rear".
55
+ * The current implementation doesn't work on all Android devices, in which case it falls back to the default behavior.
56
+ */
57
+ cameraFacing ?: 'front' | 'rear' ;
58
+
59
+ /**
60
+ * (iOS Only) Specify a custom UIModalPresentationStyle (Defaults to UIModalPresentationStyle.FullScreen)
61
+ */
62
+ modalPresentationStyle ?: number ;
64
63
}
0 commit comments