-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: [Android] Opening camera/gallery does not work on Android 11 #3420
Fix: [Android] Opening camera/gallery does not work on Android 11 #3420
Conversation
3f76120
to
2b4d0d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some notes on the changes
* @param {CameraOptions} options | ||
* @param {function} callback - callback called with the result | ||
*/ | ||
export default function launchCameraAndroid(options, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per react-native-image-picker: https://github.com/react-native-image-picker/react-native-image-picker#android
Note: This library does not require Manifest.permission.CAMERA, if your app declares as using this permission in manifest then you have to obtain the permission before using launchCamera.
E.cash has Manifest.permission.CAMERA
declared in the Manifest
I've also found out that if the user manually revokes the camera permission the "Take Photo" button
would stop working, but the "General" alert "An error occurred while selecting an attachment, please try again" would be displayed for the user, instead the user should see "Expensify.cash does not have access to your camera, please enable the permission and try again." with a link to "Settings". This code achieves the desired behavior
Before extracting launchCamera.android.js
2b4d0d3
to
41cb6f3
Compare
When an user installs E.cash on Android they've automatically granted camera permission since it's included in the manifest, but if they ever revoke the Permission we need to check and request it again as the image-picker library does not handle this
41cb6f3
to
dc447db
Compare
It seems the timeout fix is still needed for this to work on iOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but there are a few conflicts!
…picker-dependencies # Conflicts: # ios/Podfile.lock # package-lock.json # package.json # src/components/AttachmentPicker/index.native.js
Merged |
Bump, @Gonals this is ready |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging in version: 1.0.71-1🚀
|
🚀 Deployed to production in version: 1.0.73-3🚀
|
Details
Update the image picker and document picker libraries to their latest versions
Migrate usages to match the newer version specs
Fixed Issues
Fixes #2531
Tests
Try for both Android 10, 11 and iOS, desktop/web implementation haven't been changed but you can test that as well
QA Steps
Same as above
Tested On
Screenshots
Web
Expensify.cash.-.Google.Chrome.2021-06-10.21-07-36.mp4
Mobile Web
Screen.Recording.2021-06-10.at.21.10.15.mov
Desktop
Screen.Recording.2021-06-10.at.21.04.25.mov
iOS
When a user have manually denied permissions
2021-06-10.20-57-48.mp4
Selecting a file from gallery or documents
Uploading Screen Recording 2021-06-10 at 21.47.51.mov…
Android
Android 11
When a user have manually denied permissions
Android.Emulator.-.Samsung_Galaxy_S10_API_30_5556.2021-06-10.20-39-19.mp4
Selecting a file from gallery or documents
Android.Emulator.-.Samsung_Galaxy_S10_API_30_5556.2021-06-10.20-42-37.mp4
Android 10
When a user have manually denied permissions
Android.Emulator.-.Pixel_2_API_29_5554.2021-06-10.20-27-53.mp4
Selecting a file from gallery or documents
Android.Emulator.-.Pixel_2_API_29_5554.2021-06-10.20-30-39.mp4