feat(diagnostic): update to support latest signatures (#1458)

* refactor(diagnostic plugin): update camera API function signatures to support cordova.plugins.diagnostic@3.6.0. See 515317e89a

* fix(diagnostic plugin): fix whitespace linting errors in previous commit

* * fix(diagnostic plugin): add callback indices to Cordova decorator in camera API so externalStorage parameter can be optionally omitted.
See https://github.com/driftyco/ionic-native/pull/1458#issuecomment-299030833

* fix(diagnostic plugin): fix incorrect return type on getCameraRollAuthorizationStatus()
This commit is contained in:
Dave Alden 2017-05-09 22:30:11 +01:00 committed by Ibby Hadeed
parent 6cc6393712
commit a4151abebf

View File

@ -144,10 +144,12 @@ export class Diagnostic extends IonicNativePlugin {
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova()
isCameraAvailable(): Promise<any> { return; }
@Cordova({ successIndex: 1, errorIndex: 2 })
isCameraAvailable( externalStorage?: boolean ): Promise<any> { return; }
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
@ -251,24 +253,30 @@ export class Diagnostic extends IonicNativePlugin {
/**
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
isCameraAuthorized(): Promise<any> { return; }
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
isCameraAuthorized( externalStorage?: boolean ): Promise<any> { return; }
/**
* Returns the camera authorization status for the application.
* @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
getCameraAuthorizationStatus(): Promise<any> { return; }
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
getCameraAuthorizationStatus( externalStorage?: boolean ): Promise<any> { return; }
/**
* Requests camera authorization for the application.
* @param {boolean} [externalStorage] Android only: If true, requests permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission.
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'] })
requestCameraAuthorization(): Promise<any> { return; }
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
requestCameraAuthorization( externalStorage?: boolean ): Promise<any> { return; }
/**
* Checks if the application is authorized to use the microphone.
@ -614,10 +622,10 @@ export class Diagnostic extends IonicNativePlugin {
/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
* @returns {Promise<boolean>}
* @returns {Promise<string>}
*/
@Cordova({ platforms: ['iOS'] })
getCameraRollAuthorizationStatus(): Promise<boolean> { return; }
getCameraRollAuthorizationStatus(): Promise<string> { return; }
/**
* Requests camera roll authorization for the application.