[iOS permission bug] wrong logic in didChangeAuthorizationStatus hook, permission can be asked in some unexpected cases
Bug Report
iOS native permission can be asked in some unexpected cases and iOS app can be declined in App Store and it is can be affect user experience with unexpected cases, if we will ask client about location access but now user do not use any location features.
Problem
If plugin added but if you did not call yet any methods, for example "watchPosition", plugin can ask iOS permission, see https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.m#L363
What is expected to happen?
We do not need to call "startLocation" if __locationStarted="NO". Because only if anyone call "watchPosition" only now we need to check permission and ask user, in other cases user can see native location permission but it is not expected in all
Version information
last plugin version and iOS version is 16.0
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Can you provide a sample app and steps to reproduce?
@jcesarmobile I think sample app no need it is easy case. About steps: I think you agree with me ,that if I add plugin in app and will change location access on ios from plugin will be called didChangeAuthorizationStatus -> startLocation. If applicaiton status will be true here https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.m#L73 , from plugin will be call here https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.m#L124 and on ios system return kCLAuthorizationStatusNotDetermined status if you disable in all location services and after that enable
If you want to get help you have to make it easier for people to help you, so if you provide a sample app there are more chances of getting help.
@jcesarmobile agree with you, and thank you, but I think it is easy case , and any developer can see bug after my description, and I think you agree with me that do not need to create project for after that description
please let me know if I can help in any way
Please, don't ping me, and no, I don't agree with you, I wouldn't have requested the sample app twice if I agreed. I only help people that at least do some effort and provides a sample app. I have told you how you can help, by creating a sample app, but you don't want to do that. If you are not willing to spend 10-15 minutes in providing a sample app that reproduces the issue, why would I spend hours trying to fix it? We are all volunteers that do this for free and there are thousands of issues open across all the cordova repositories, so I prioritize issues with sample apps that help reproducing the issue. I can't speak for the other maintainers, but they probably do the same.
If you create a sample app, maybe another maintainer takes a look, but I won't, I've spent enough time arguing with you.
@jcesarmobile agree with you, I've spent enough time arguing with you too. I fixed that issue in my fork, and only after that created issue here, because I want to contribute to cordova and your plugin which I use myself. We are all volunteers that do this for free - I am too.
free to resolve
Please, stop harassing me, I told you to stop pinging me.
sorry it was unintentional