Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DENIED~ish permission statuses aren't similar across platforms #230

Closed
josh-m-sharpe opened this issue Sep 7, 2017 · 5 comments
Closed

Comments

@josh-m-sharpe
Copy link

It seems that DENIED on ios is that same as DENIED_ALWAYS on android. So, if I wanted to check for this "never can ask again" status and direct the user to their settings page, I would need to check different constants on different platforms.

Proposed changes:

Make both platforms have the same constant for the state where the permission is denied and cannot be prompted again. (DENIED_ALWAYS)
On Android, change DENIED to DENIED_PREVIOUSLY.

@dpa99c
Copy link
Owner

dpa99c commented Sep 7, 2017

Thanks for suggesting this and it's is true that DENIED on ios is that same as DENIED_ALWAYS. It arises historically from earlier versions of this plugin where the constants were separate enums. However, this would be a backwardly-incompatible change that would break the many apps out there which are already using this plugin and its constants as they are currently defined. For this reason, I don't think that making this change is a good idea, given that the workaround needed is fairly trivial:

function isPermanentlyDenied(status){
  return (device.platform === "iOS" && status === cordova.plugins.diagnostic.permissionStatus.DENIED) 
  || (device.platform === "Android" && status === cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS);
}

if(isPermanentlyDenied(status){
  ...
}

@dpa99c dpa99c closed this as completed Sep 7, 2017
@ciekawy
Copy link

ciekawy commented May 30, 2019

what about creating new non confusing enum names and deprecate old ones keeping deprecated ones long enough for people to switch?

I found this plugin to be great help also to hide platform inconsistencies and here even if trivial thats not a nice piece of code...

@dpa99c
Copy link
Owner

dpa99c commented May 31, 2019

Ok, let's address this in the next plugin version

@dpa99c dpa99c reopened this May 31, 2019
@dpa99c
Copy link
Owner

dpa99c commented May 31, 2019

I propose that DENIED on Android is deprecated in favour of DENIED_ONCE and DENIED on iOS is deprecated in favour of DENIED_ALWAYS which means DENIED_ALWAYS is semantically the same on both platforms.

@dpa99c
Copy link
Owner

dpa99c commented Jun 4, 2019

I propose that DENIED on Android is deprecated in favour of DENIED_ONCE and DENIED on iOS is deprecated in favour of DENIED_ALWAYS which means DENIED_ALWAYS is semantically the same on both platforms.

During implementation I realised that deprecating DENIED is not possible since it's a return value, therefore this is going to be a hard, breaking change to the API and therefore a major version bump. Brace yourselves!

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

No branches or pull requests

3 participants