Skip to content

Commit

Permalink
feat(diagnostic): addisCameraRollAuthorized and getCameraRollAuthoriz…
Browse files Browse the repository at this point in the history
…ationStatus functions (WIP) (#4362)
  • Loading branch information
ryaa authored Oct 22, 2022
1 parent 81a8b42 commit cd81cfa
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions src/@awesome-cordova-plugins/plugins/diagnostic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ export class Diagnostic extends AwesomeCordovaNativePlugin {
UNKNOWN: string;
};

/**
* Access to the photo library (iOS 14+)
*
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
*
*/
photoLibraryAccessLevel = {
ADD_ONLY: 'add_only',
READ_WRITE: 'read_write',
};

/**
* Checks if app is able to access device location.
*
Expand Down Expand Up @@ -814,20 +826,34 @@ export class Diagnostic extends AwesomeCordovaNativePlugin {
/**
* Checks if the application is authorized to use the Camera Roll in Photos app.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<boolean>}
*/
@Cordova({ platforms: ['iOS'] })
isCameraRollAuthorized(): Promise<boolean> {
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
isCameraRollAuthorized(accessLevel?: string): Promise<boolean> {
return;
}

/**
* Returns the authorization status for the application to use the Camera Roll in Photos app.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<string>}
*/
@Cordova({ platforms: ['iOS'] })
getCameraRollAuthorizationStatus(): Promise<string> {
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
getCameraRollAuthorizationStatus(accessLevel?: string): Promise<string> {
return;
}

Expand All @@ -836,10 +862,17 @@ export class Diagnostic extends AwesomeCordovaNativePlugin {
* Should only be called if authorization status is NOT_REQUESTED.
* Calling it when in any other state will have no effect.
*
* @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel`
* Possible values are:
* ADD_ONLY - can add to but not read from Photo Library
* READ_WRITE - can both add to and read from Photo Library
* Defaults to ADD_ONLY if not specified
* Has no effect on iOS 13 or below
*
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['iOS'] })
requestCameraRollAuthorization(): Promise<any> {
@Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' })
requestCameraRollAuthorization(accessLevel?: string): Promise<any> {
return;
}

Expand Down Expand Up @@ -1006,13 +1039,13 @@ export class Diagnostic extends AwesomeCordovaNativePlugin {
}

/**
* Returns the location accuracy authorization for the application on iOS 14+. Note: calling on iOS <14 will result in the Promise being rejected.
* Returns the location accuracy authorization for the application on iOS 14+ and Android 12+. Note: calling on iOS <14 or Android <12 will always return cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL
*
* Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getlocationaccuracyauthorization)
*
* @returns {Promise<string>}
*/
@Cordova({ platform: ['iOS'] })
@Cordova({ platforms: ['iOS', 'Android'] })
getLocationAccuracyAuthorization(): Promise<string> {
return;
}
Expand Down

0 comments on commit cd81cfa

Please sign in to comment.