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

Fix poor iOS permissions error message #633

Closed
wants to merge 1 commit into from

Conversation

n-arms
Copy link

@n-arms n-arms commented Sep 23, 2023

This PR fixes #624 by adding another condition under which a permissions error is reported.

On iOS, if camera permissions are turned off in settings, react-native-vision-camera will send a device/invalid-device error followed by a number of session/camera-not-ready errors. If either of those errors are encountered and camera permissions are disabled, a permissions error is reported instead of a device or session error.

- check for conditions that produce a device error instead of a
permissions error, reporting the correct error
@kueda kueda requested a review from jtklein September 25, 2023 16:50
Copy link
Contributor

@jtklein jtklein left a comment

Choose a reason for hiding this comment

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

Hello,
and thank you for your contribution.

I have not yet looked at the code yet, because:

This does work on iOS in the following sense: When you have the app installed, change the app settings to not give permissions for the camera, then open the camera, it does show the correct error message now.

However, on my test devices it does not work for the very first time you navigate to the camera after a fresh install and press Disable/Not Allow in the native camera permission modal. The camera component just stays black with no error message. I realize that it was like this before your PR already, so we can still merge your changes in and post another issue about this. Or if you want you could have a stab at it.

Anyways, on Android, on my test device, now when navigating to the camera on a fresh install and pressing Disable/Not Allow on the native camera permission modal, the app crashes and quits. Before your PR the app showed the "no permission" error text succesfully in this circumstance, so this PR would need to make sure not to break this behaviour.

@jtklein
Copy link
Contributor

jtklein commented Oct 16, 2023

I have included those changes in a different PR where I also updated the vision-camera library. Closing this one here.

@jtklein jtklein closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Incorrect error message for disabled iOS camera permissions
2 participants