Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 9.6k
[image_picker] Allow saving photos picked with PHPicker without permissions#6429
Merged
auto-submit
merged 7 commits into
flutter-team-archive:main
from
PiotrMitkowski:ios-optional-permissions-bugfixSep 19, 2022
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4467067
Fixed saving photos picked with PHPicker without permissions
PiotrMitkowski 1bfbb9b
Fixed formatting
PiotrMitkowski 75858ca
Updated package version
PiotrMitkowski 3d67fa0
Fixed build issues in tests
PiotrMitkowski 230297d
Added a test covering the bugfix
PiotrMitkowski 4ed43b8
PR remarks
PiotrMitkowski 1c2f621
Fixed formatting
PiotrMitkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
26 changes: 21 additions & 5 deletions
26 ...age_picker/image_picker_ios/example/ios/RunnerTests/PickerSaveImageToPathOperationTests.m
This file contains hidden or 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
23 changes: 15 additions & 8 deletions
23 packages/image_picker/image_picker_ios/example/lib/main.dart
This file contains hidden or 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
17 changes: 9 additions & 8 deletions
17 packages/image_picker/image_picker_ios/ios/Classes/FLTImagePickerPlugin.m
This file contains hidden or 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
1 change: 1 addition & 0 deletions
1 packages/image_picker/image_picker_ios/ios/Classes/FLTPHPickerSaveImageToPathOperation.h
This file contains hidden or 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
10 changes: 9 additions & 1 deletion
10 packages/image_picker/image_picker_ios/ios/Classes/FLTPHPickerSaveImageToPathOperation.m
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,6 +13,7 @@ @interface FLTPHPickerSaveImageToPathOperation () | ||
| @property(assign, nonatomic) NSNumber *maxHeight; | ||
| @property(assign, nonatomic) NSNumber *maxWidth; | ||
| @property(assign, nonatomic) NSNumber *desiredImageQuality; | ||
| @property(assign, nonatomic) BOOL requestFullMetadata; | ||
| @end | ||
| @@ -28,13 +29,15 @@ - (instancetype)initWithResult:(PHPickerResult *)result | ||
| maxHeight:(NSNumber *)maxHeight | ||
| maxWidth:(NSNumber *)maxWidth | ||
| desiredImageQuality:(NSNumber *)desiredImageQuality | ||
| fullMetadata:(BOOL)fullMetadata | ||
| savedPathBlock:(GetSavedPath)savedPathBlock API_AVAILABLE(ios(14)) { | ||
| if (self = [super init]) { | ||
| if (result) { | ||
| self.result = result; | ||
| self.maxHeight = maxHeight; | ||
| self.maxWidth = maxWidth; | ||
| self.desiredImageQuality = desiredImageQuality; | ||
| self.requestFullMetadata = fullMetadata; | ||
| getSavedPath = savedPathBlock; | ||
| executing = NO; | ||
| finished = NO; | ||
| @@ -113,7 +116,12 @@ - (void)start { | ||
| * Processes the image. | ||
| */ | ||
| - (void)processImage:(UIImage *)localImage API_AVAILABLE(ios(14)) { | ||
| PHAsset *originalAsset = [FLTImagePickerPhotoAssetUtil getAssetFromPHPickerResult:self.result]; | ||
| PHAsset *originalAsset; | ||
| // Only if requested, fetch the full "PHAsset" metadata, which requires "Photo Library Usage" | ||
| // permissions. | ||
| if (self.requestFullMetadata) { | ||
PiotrMitkowski marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| originalAsset = [FLTImagePickerPhotoAssetUtil getAssetFromPHPickerResult:self.result]; | ||
| } | ||
| if (self.maxWidth != nil || self.maxHeight != nil) { | ||
| localImage = [FLTImagePickerImageUtil scaledImage:localImage | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.