-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[image_picker] Support reading WebP images for iOS #4448
[image_picker] Support reading WebP images for iOS #4448
Conversation
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.
The meat of the PR looks good.
Test are required for this PR to move forward
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
@cyanglaz
I have replaced the WebP identifier with apple's const value. I'm not sure how I can write a good test here. My idea was to pick an image from the library (PHPickerResult) and give it to FLTPHPickerSaveImageToPathOperation, but then we should provide a WebP photo to iOS Photos App because there aren't any WebP photos there. How do you think? |
@TrGiLong I'm not sure if there's a way to programmatically add photos to camera roll in XCUITests. At minimum, we can probably unit test this with a mock image picker result? |
I have added the test for the FLTPHPickerSaveImageToPathOperation class. The test case for WebP image works but if I try to use JPEG or PNG images, the test will be failed. I can not say the reason for that since I didn't change any code for handling those images. Maybe the instance of NSItemProvider, that I have loaded from the bundle, it's not identical with instance, that PHPickerViewControllerDelegate returns. |
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.
cc @stuartmorgan For 2nd reviewer
packages/image_picker/image_picker/example/ios/Runner.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
packages/image_picker/image_picker/example/ios/Runner.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
packages/image_picker/image_picker/example/ios/Runner.xcodeproj/project.pbxproj
Show resolved
Hide resolved
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.h
Outdated
Show resolved
Hide resolved
...ages/image_picker/image_picker/example/ios/RunnerTests/PickerSaveImageToPathOperationTests.m
Outdated
Show resolved
Hide resolved
...ages/image_picker/image_picker/example/ios/RunnerTests/PickerSaveImageToPathOperationTests.m
Outdated
Show resolved
Hide resolved
@cyanglaz |
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.
A few more small notes. Also, this needs the autoformatter run on it.
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
...ages/image_picker/image_picker/example/ios/RunnerTests/PickerSaveImageToPathOperationTests.m
Outdated
Show resolved
Hide resolved
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
The PR is ready to be reviewed. Can you please check it? 😅 |
Hi @cyanglaz, Are you still working on this PR? 😅 |
@TrGiLong I apologize for the delay. I will make sure to squeeze in some time this week to take a look at it. Thank you for being patient. |
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Show resolved
Hide resolved
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Show resolved
Hide resolved
what's new on the PR? 😄 |
Hi @cyanglaz, I have tried to improve error handling for image picking but it makes this PR enormous. I think we have to do it in separate PR. There reasons are:
|
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.
You have formatting issues that need to be fixed.
You also need to update your unit tests for recent changes in the test structure of this package, as they are currently failing in CI.
packages/image_picker/image_picker/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
Outdated
Show resolved
Hide resolved
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!
This pull request is not suitable for automatic merging in its current state.
|
This pull request is not suitable for automatic merging in its current state.
|
Filed flutter/flutter#99033 to investigate why the bot won't land this. (Other team members: please don't land it manually for now.) |
This pull request is not suitable for automatic merging in its current state.
|
This pull request is not suitable for automatic merging in its current state.
|
This pull request is not suitable for automatic merging in its current state.
|
Hi,
This PR adds separate handling for WebP images. The reason is that the
loadObjectOfClass:completionHandler:
method ofNSItemProvider
class doesn't support direct reading of WebP images and returnsCould not coerce an item to class UIImage
error.Before adding this handling, the platform code doesn't emit any WebP images to the flutter app. After adding this handling, the platform emits WebP images.
Fixes #88094
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.