-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[image-picker][ios] Fix unexpected behaviour of quality option on iOS #21361
Conversation
…e it more consistent.
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
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.
Thank you for the fix! The previous behaviour was incorrect indeed.
The actual fix code (switch cases for BMP) looks good! 🎉
But please try doing the filename replacement the Swift way. Personally, I'd create a helper function, which looks sth like this (written by hand, probably wouldn't compile):
func replaceFileExtension(fileName: String?, targetExtension: String) -> String? {
guard let fileName = fileName else { return nil }
if !fileName.lowercased.contains(targetExtension.lowercased()) {
return fileName.deletingPathExtension + targetExtension
}
return fileName
}
Also, please use Swift-specific methods for that, as linter suggests.
If you need more help with this, feel free to ping me
Edit: One more thing. You need to run yarn build
from inside the packages/expo-image-picker
directory and commit the generated build/*
files for CI to pass
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
…ix' into @behenate/image-picker-quality-fix
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com>
…ix' into @behenate/image-picker-quality-fix
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.
LGTM
Why
On iOS when using ImagePicker with
.bmp
files the file would be converted to.png
if any quality is selected, even though the option should be ignored. Therefore setting quality to 0.2 (default value) would yield different results than for not setting it at all #20299How
Updated the
ImagePickerModule
to ignore the quality option with.bmp
files.When opening a
.bmp
image withallowsEditing
set totrue
file has to be converted to.png
, now thefileName
is also updated to have.png
file extension. Docs have been updated to make it more clear when the conversion happens.Test Plan
Tested on a physical device with opening images from gallery and the camera.