Skip to content

Commit

Permalink
feat(diagnostic): update to support latest signatures (#1458)
Browse files Browse the repository at this point in the history
* refactor(diagnostic plugin): update camera API function signatures to support cordova.plugins.diagnostic@3.6.0. See dpa99c/cordova-diagnostic-plugin@515317e

* 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 #1458 (comment)

* fix(diagnostic plugin): fix incorrect return type on getCameraRollAuthorizationStatus()
  • Loading branch information
dpa99c authored and ihadeed committed May 9, 2017
1 parent 6cc6393 commit a4151ab
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/@ionic-native/plugins/diagnostic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a4151ab

Please sign in to comment.