Skip to content

Conversation

@l0stpenguin
Copy link

No description provided.

@ombr
Copy link

ombr commented Nov 16, 2019

Could you provide more information on this change ?

@l0stpenguin
Copy link
Author

Could you provide more information on this change ?

The original plugin did not wait for the request permission callback as denoted in those comments:

//This method executes async and we seem to have no known way to receive the result
// that's why these methods were later added to Cordova), so simply returning ok now.

The methods were later added by cordova (which was not available when the orignal plugin was developed):
cordova.requestPermissions

@ombr ombr merged commit 5cf0c5e into master Nov 23, 2019
// This method executes async and we seem to have no known way to receive the result
// (that's why these methods were later added to Cordova), so simply returning ok now.
callbackContext.success();
callbackContext.success(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu aurais pu inverser la logique
if (hasReadPerm) {
...
} else {
...
}
pas besoin du return non plus

// For now we just have one permission, so things can be kept simple...
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
cordova.startActivityForResult(this, imagePickerIntent, 0);
callbackContext.success(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on envoie 1 en cas de succès ? dans le else aussi c'est un cas de succès ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oui la method est successful, le 1/0 represente la statue de permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants