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.8k
[image_picker] add requestFullMetadata for iOS (optional permissions) #4638
Closed
PiotrMitkowski
wants to merge
50
commits into
flutter:main
from
PiotrMitkowski:ios-optional-permissions
Closed
Changes from 14 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
5d3a9aa
Added new image picking method with flag for controlling metadata
PiotrMitkowski 4195dca
Updated tests with cases for the new method
PiotrMitkowski 7d255de
Updated changelog in platform interface and app-facing package to mat…
PiotrMitkowski 3fd7383
Updated app-facing package to call new method from platform interface
PiotrMitkowski 686bc22
Merge branch 'master' of github.com:flutter/plugins into ios-optional…
PiotrMitkowski 1f73191
Fixed version in changelog file
PiotrMitkowski 24d0679
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski 1ba0c73
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski 1084763
PR remarks
PiotrMitkowski a89ad0a
Renamed flag to better specify its purpose
PiotrMitkowski 8ff7492
Renamed flag in remaining occurences
PiotrMitkowski 193bbe9
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski 95eef20
Fixed formatting and originalAsset assignment
PiotrMitkowski e10b24e
Merge remote-tracking branch 'origin/ios-optional-permissions' into i…
PiotrMitkowski f2c2e68
Resolved merge conflicts
PiotrMitkowski f5f94b2
PR remarks
PiotrMitkowski 97efdca
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski bd3dfeb
Fixed issues after merge
PiotrMitkowski b99ba07
Added a test for picking image without full metadata
PiotrMitkowski 3d6c45c
Fixed code formatting
PiotrMitkowski b3e9166
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski bf3f55c
PR remarks
PiotrMitkowski 742b259
Fixed linter warnings
PiotrMitkowski d41b390
Added dependency overrides for missing modules
PiotrMitkowski ead2f62
Fixed formatting
PiotrMitkowski 7b6ace9
Added options class for handling image picking settings
PiotrMitkowski 0f43653
Added missing license comment
PiotrMitkowski c6dcc49
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski 9ba71b9
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski c1fc9da
PR remarks
PiotrMitkowski 7f958a6
pbxproj version revert
PiotrMitkowski c825d09
PR remarks
PiotrMitkowski a2ca361
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski 0120c47
Resolved merge conflicts
PiotrMitkowski 0827c80
Generated Pigeon files for new API and metadata flag
PiotrMitkowski 994e45f
Switched to use options object in private picking method
PiotrMitkowski 9b39e31
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski 933254e
Fixed failing unit tests
PiotrMitkowski 66f14b2
Added missing tests for a new method and request full metadata parameter
PiotrMitkowski 47098ec
Fixed failing native tests
PiotrMitkowski 0a811d8
PR remarks
PiotrMitkowski 0789a7b
Fixed linting
PiotrMitkowski c5966d4
Removed dependency overrides
PiotrMitkowski 6f32405
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski 217237b
PR remarks
PiotrMitkowski 7a4d250
Fixed linter warnings and failing tests
PiotrMitkowski 4ee04cb
Removed remaining dependency override
PiotrMitkowski b3fb220
Enforcing proper platform interface version having required API changes
PiotrMitkowski 4d884de
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski c2240fa
Fixed failing test in app-facing plugin
PiotrMitkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,10 @@ class ImagePicker { | |
/// the front or rear camera should be opened, this function is not guaranteed | ||
/// to work on an Android device. | ||
/// | ||
/// Use `requestFullMetadata` (defaults to `true`) to control how much additional information the plugin tries to get on iOS. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the "on iOS" here. |
||
/// If `requestFullMetadata` is set to `true`, the plugin tries to get the full image metadata which may require | ||
/// extra permission requests on some platforms, such as `Photo Library Usage` permission on iOS . | ||
/// | ||
/// In Android, the MainActivity can be destroyed for various reasons. If that happens, the result will be lost | ||
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data. | ||
/// | ||
|
@@ -206,13 +210,15 @@ class ImagePicker { | |
double? maxHeight, | ||
int? imageQuality, | ||
CameraDevice preferredCameraDevice = CameraDevice.rear, | ||
bool requestFullMetadata = true, | ||
stuartmorgan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) { | ||
return platform.getImage( | ||
return platform.getImageFromSource( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to require the version of the platform interface that has this method in pubspec.yaml. |
||
source: source, | ||
maxWidth: maxWidth, | ||
maxHeight: maxHeight, | ||
imageQuality: imageQuality, | ||
preferredCameraDevice: preferredCameraDevice, | ||
requestFullMetadata: requestFullMetadata, | ||
); | ||
} | ||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,14 +57,16 @@ void main() { | |
'maxWidth': null, | ||
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to reconcile the test changes against #5706 once that lands (which is needed to resolve the current tree breakage, so will be before this PR can land). |
||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 1, | ||
'maxWidth': null, | ||
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
], | ||
); | ||
|
@@ -103,49 +105,56 @@ void main() { | |
'maxWidth': null, | ||
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': 10.0, | ||
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': null, | ||
'maxHeight': 10.0, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': 10.0, | ||
'maxHeight': 20.0, | ||
'imageQuality': null, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': 10.0, | ||
'maxHeight': null, | ||
'imageQuality': 70, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': null, | ||
'maxHeight': 10.0, | ||
'imageQuality': 70, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
isMethodCall('pickImage', arguments: <String, dynamic>{ | ||
'source': 0, | ||
'maxWidth': 10.0, | ||
'maxHeight': 20.0, | ||
'imageQuality': 70, | ||
'cameraDevice': 0 | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
], | ||
); | ||
|
@@ -182,6 +191,7 @@ void main() { | |
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 0, | ||
'requestFullMetadata': true, | ||
}), | ||
], | ||
); | ||
|
@@ -201,6 +211,7 @@ void main() { | |
'maxHeight': null, | ||
'imageQuality': null, | ||
'cameraDevice': 1, | ||
'requestFullMetadata': true, | ||
}), | ||
], | ||
); | ||
|
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
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
Oops, something went wrong.
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.
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 type is
PHAsset
, notPHAAsset
, and also ObjC style is to capitalize abbreviations even in variable names, so this, and the similar variables below, should beusePHAsset
rather thanusePhaAsset
.