-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[image_picker] add requestFullMetadata for iOS (optional permissions) #4638
Changes from 47 commits
5d3a9aa
4195dca
7d255de
3fd7383
686bc22
1f73191
24d0679
1ba0c73
1084763
a89ad0a
8ff7492
193bbe9
95eef20
e10b24e
f2c2e68
f5f94b2
97efdca
bd3dfeb
b99ba07
3d6c45c
b3e9166
bf3f55c
742b259
d41b390
ead2f62
7b6ace9
0f43653
c6dcc49
9ba71b9
c1fc9da
7f958a6
c825d09
a2ca361
0120c47
0827c80
994e45f
9b39e31
933254e
66f14b2
47098ec
0a811d8
0789a7b
c5966d4
6f32405
217237b
7a4d250
4ee04cb
b3fb220
4d884de
c2240fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
| /// 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,17 @@ class ImagePicker { | |
| double? maxHeight, | ||
| int? imageQuality, | ||
| CameraDevice preferredCameraDevice = CameraDevice.rear, | ||
| bool requestFullMetadata = true, | ||
| }) { | ||
| return platform.getImage( | ||
| return platform.getImageFromSource( | ||
|
Contributor
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, | ||
| options: ImagePickerOptions( | ||
| maxWidth: maxWidth, | ||
| maxHeight: maxHeight, | ||
| imageQuality: imageQuality, | ||
| preferredCameraDevice: preferredCameraDevice, | ||
| requestFullMetadata: requestFullMetadata, | ||
|
Contributor
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. It would also be better to pull the iOS changes into a separate PR and land it first so that you can require that version, otherwise someone who only updates this package will not actually get a working implementation of the new parameter. |
||
| ), | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| 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, | ||
|
||
| }), | ||
| 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, | ||
| }), | ||
| ], | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.