From 748c6bd9beaf962cf794b0fab505c0519312a289 Mon Sep 17 00:00:00 2001 From: SVANNER Date: Sun, 30 Apr 2017 19:21:28 +0200 Subject: [PATCH] feat(camera-preview): add new focus methods & getFlashMode() (#1442) 4 new methods are available in the master: - getSupportedFocusModes(); - getFocusMode(); - seFocusMode(); - getFlashMode(); --- .../plugins/camera-preview/index.ts | 59 ++++++++++++++++--- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/src/@ionic-native/plugins/camera-preview/index.ts b/src/@ionic-native/plugins/camera-preview/index.ts index b8f29a8bb..e3804c2e7 100644 --- a/src/@ionic-native/plugins/camera-preview/index.ts +++ b/src/@ionic-native/plugins/camera-preview/index.ts @@ -134,7 +134,18 @@ export interface CameraPreviewPictureOptions { @Injectable() export class CameraPreview extends IonicNativePlugin { - EXPOSURE_MODES = { + FOCUS_MODE = { + FIXED: 'fixed', + AUTO: 'auto', + CONTINUOUS: 'continuous', // IOS Only + CONTINUOUS_PICTURE: 'continuous-picture', // Android Only + CONTINUOUS_VIDEO: 'continuous-video', // Android Only + EDOF: 'edof', // Android Only + INFINITY: 'infinity', // Android Only + MACRO: 'macro' // Android Only + }; + + EXPOSURE_MODE = { LOCK: 'lock', // IOS Only AUTO: 'auto', // IOS Only CONTINUOUS: 'continuous', @@ -265,6 +276,38 @@ export class CameraPreview extends IonicNativePlugin { }) setPreviewSize(dimensions?: CameraPreviewDimensions): Promise { return; } + /** + * Get focus mode + * @return {Promise} + */ + @Cordova() + getFocusMode(): Promise { return; } + + /** + * Set the focus mode + * @param [focusMode] {string} 'fixed', 'auto', 'continuous-picture', 'continuous-video' (iOS & Android), 'edof', 'infinity', 'macro' (Android Only) + * @return {Promise} + */ + @Cordova({ + successIndex: 1, + errorIndex: 2 + }) + setFocusMode(focusMode?: string): Promise { return; } + + /** + * Get supported focus modes + * @return {Promise} + */ + @Cordova() + getSupportedFocusModes(): Promise { return; } + + /** + * Get the current flash mode + * @return {Promise} + */ + @Cordova() + getFlashMode(): Promise { return; } + /** * Set the flashmode * @param [flashMode] {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android) @@ -276,13 +319,6 @@ export class CameraPreview extends IonicNativePlugin { }) setFlashMode(flashMode?: string): Promise { return; } - /** - * Get supported picture sizes - * @return {Promise} - */ - @Cordova() - getSupportedPictureSizes(): Promise { return; } - /** * Get supported flash modes * @return {Promise} @@ -290,6 +326,13 @@ export class CameraPreview extends IonicNativePlugin { @Cordova() getSupportedFlashModes(): Promise { return; } + /** + * Get supported picture sizes + * @return {Promise} + */ + @Cordova() + getSupportedPictureSizes(): Promise { return; } + /** * Get exposure mode * @return {Promise}