This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
[image_picker] Implement methods for picking both images and videos simultaneously. #4676
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…from the same UI.
11 tasks
BeMacized
commented
Jan 20, 2022
Comment on lines
+77
to
+118
- (void)processImage API_AVAILABLE(ios(14)) { | ||
[self.result.itemProvider | ||
loadObjectOfClass:[UIImage class] | ||
completionHandler:^(__kindof id<NSItemProviderReading> _Nullable data, | ||
NSError *_Nullable error) { | ||
if ([data isKindOfClass:[UIImage class]]) { | ||
__block UIImage *localImage = data; | ||
PHAsset *originalAsset = [self getAssetFromPHPickerResult:self.result]; | ||
if (self.maxWidth != (id)[NSNull null] || self.maxHeight != (id)[NSNull null]) { | ||
localImage = [FLTImagePickerImageUtil scaledImage:localImage | ||
maxWidth:self.maxWidth | ||
maxHeight:self.maxHeight | ||
isMetadataAvailable:originalAsset != nil]; | ||
} | ||
__block NSString *savedPath; | ||
if (!originalAsset) { | ||
// Image picked without an original asset (e.g. User picked an image without | ||
// permission). | ||
savedPath = [self saveImageWithPickerInfo:nil | ||
image:localImage | ||
imageQuality:self.desiredImageQuality]; | ||
[self completeOperationWithPath:savedPath]; | ||
} else { | ||
[[PHImageManager defaultManager] | ||
requestImageDataForAsset:originalAsset | ||
options:nil | ||
resultHandler:^(NSData *_Nullable imageData, NSString *_Nullable dataUTI, | ||
UIImageOrientation orientation, | ||
NSDictionary *_Nullable info) { | ||
// maxWidth and maxHeight are used only for GIF images. | ||
savedPath = | ||
[self saveImageWithOriginalImageData:imageData | ||
image:localImage | ||
maxWidth:self.maxWidth | ||
maxHeight:self.maxHeight | ||
imageQuality:self.desiredImageQuality]; | ||
[self completeOperationWithPath:savedPath]; | ||
}]; | ||
} | ||
} | ||
}]; | ||
} |
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.
This method was already in here, it's simply moved over from FLTPHPickerSaveImageToPathOperation
.
It sounds like this is obsolete with #4675 now, so I'm going to close this PR. Please don't hesitate to submit it again if I'm wrong about this. |
Reopening this as I've picked this (and #4675) back up again. |
@BeMacized Is this PR read for review? |
No, it's not (also because the changes to the platform interface have not been merged yet). It will be superceded by two new PRs that I'll submit in a moment. Closing. |
This was referenced Jun 1, 2022
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements
bothpickImageOrVideo
andpickMultiImageAndVideo
pickMedia
on both Android and iOS.This PR is still in draft mode due
to the lack of unit tests, as well asthe dependency on the changes to the platform interface: #4675.I will be adding tests later.Relevant issue:
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].CHANGELOG.md
to add a description of the change, [following repository CHANGELOG style].///
).