-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
[iOS]: Crash on adding photo from camera if “Access to photos” permission not granted #3813
Comments
When access is not granted,an alert should be shown asking for permissions. |
Sure, thank you! There’s one thing I hadn’t pointed out in my initial comment (and I’ll write up something more tomorrow; I’m currently typing on mobile, so not as quickly, and should sleep soon as it’s 1:30 in the morning). The native alert requesting permissions did actually display correctly, following the iOS quirk I mention in #3814, but the crash happened anyway. The crash also happens when you decline that permission, start up the app, and try again, when the native alert does not show up (again, following that quirk). |
On android, I cleared my data and didn't gave permissions to access photos but app didn't crashed . |
Ok! 🙂 I believe the issue you’re addressing is slightly different (maybe related to #3787?); this issue describes a complete crash of the app process on iOS, forcing a user to reopen the app, and it seems like that’s not happening on Android. |
I'll do some digging and see if I can come up with a fix for this today. |
Fixes zulip#3813. On iOS, it appears that the fileName is not included in the response given by ImagePicker.launchCamera if the user has not granted read access to their photo library. The case where fileName is undefined was handled correctly, but it turns out it's coming through as null, which was not handled. Neither the types nor the docs from react-native-image-picker are clear on this point, so that was filed as react-native-image-picker/react-native-image-picker#1271. I did not create a local copy of react-native-image-picker with the correct type, since it's very likely that we'll need to upgrade to later versions frequently as we're on an early version of this library which is known to have limitations and bugs. I added tests for fileName being undefined and being null.
Just made a PR -- looks like fileName is not available when this permission is not granted, and instead of coming through as undefined, which is handled, it's null. The PR lets it handle null. |
Fixes zulip#3813. On iOS, it appears that the fileName is not included in the response given by ImagePicker.launchCamera if the user has not granted read access to their photo library. The case where fileName is undefined was handled correctly, but it turns out it's coming through as null, which was not handled. Neither the types nor the docs from react-native-image-picker are clear on this point, so that was filed as react-native-image-picker/react-native-image-picker#1271. I did not create a local copy of react-native-image-picker with the correct type, since it's very likely that we'll need to upgrade to later versions frequently as we're on an early version of this library which is known to have limitations and bugs. But this can be done, if preferred. I added tests for fileName being undefined and being null.
Fixes: zulip#3813. On iOS, it appears that the fileName is not included in the response given by ImagePicker.launchCamera if the user has not granted read access to their photo library. The case where fileName is undefined was handled correctly, but it turns out it's coming through as null, which was not handled, so, handle null. Neither the types nor the docs from react-native-image-picker are clear on this point, so that was filed as react-native-image-picker/react-native-image-picker#1271. Do this without creating a local copy of react-native-image-picker with our own, correct type, since it's very likely that we'll need to upgrade to later versions frequently as we're on an early version of this library which is known to have limitations and bugs. Add tests for fileName being undefined and being null.
Fixes: #3813. On iOS, it appears that the fileName is not included in the response given by ImagePicker.launchCamera if the user has not granted read access to their photo library. The case where fileName is undefined was handled correctly, but it turns out it's coming through as null, which was not handled, so, handle null. Neither the types nor the docs from react-native-image-picker are clear on this point, so that was filed as react-native-image-picker/react-native-image-picker#1271. Do this without creating a local copy of react-native-image-picker with our own, correct type, since it's very likely that we'll need to upgrade to later versions frequently as we're on an early version of this library which is known to have limitations and bugs. Add tests for fileName being undefined and being null.
I’ll fill this in with more detail tomorrow, but on iOS it seems that we have a crash when trying to add photos from the camera (not the media library!) when read access to photos (i.e., the media library) is not granted. Seen on iPhone 6s with iOS 13.3 on v26.20.143.
The text was updated successfully, but these errors were encountered: