From 5a68d3df4e784f4bc36838e7f558d35918ee999f Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Sun, 5 Sep 2021 14:35:53 -0700 Subject: [PATCH 1/3] Revert "[image_picker] add forceFullMetadata to interface (#4288)" This reverts commit 998f51f8e8abc6a31366dd3338590c2e2ff99e06. --- .../lib/image_picker_for_web.dart | 2 - .../CHANGELOG.md | 8 --- .../method_channel_image_picker.dart | 6 -- .../image_picker_platform.dart | 12 ---- .../pubspec.yaml | 2 +- .../new_method_channel_image_picker_test.dart | 58 ++++++------------- 6 files changed, 19 insertions(+), 69 deletions(-) diff --git a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart index e1ade78d997d..b170ee3256ab 100644 --- a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart +++ b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart @@ -53,7 +53,6 @@ class ImagePickerPlugin extends ImagePickerPlatform { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) { String? capture = computeCaptureAttribute(source, preferredCameraDevice); @@ -116,7 +115,6 @@ class ImagePickerPlugin extends ImagePickerPlatform { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) async { String? capture = computeCaptureAttribute(source, preferredCameraDevice); diff --git a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md index 3c14e404e4d1..97480e044284 100644 --- a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md +++ b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md @@ -1,11 +1,3 @@ -## 2.4.0 - -* Add `forceFullMetadata` option to `pickImage`. - * To keep this non-breaking `forceFullMetadata` defaults to `true`, so the plugin tries - to get the full image metadata which may require extra permission requests on certain platforms. - * If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces - permission requests from the platform (e.g on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission). - ## 2.3.0 * Updated `LostDataResponse` to include a `files` property, in case more than one file was recovered. diff --git a/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart b/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart index 082b40357a1f..b02284e957fa 100644 --- a/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart +++ b/packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart @@ -24,7 +24,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) async { String? path = await _getImagePath( @@ -32,7 +31,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, - forceFullMetadata: forceFullMetadata, preferredCameraDevice: preferredCameraDevice, ); return path != null ? PickedFile(path) : null; @@ -87,7 +85,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) { if (imageQuality != null && (imageQuality < 0 || imageQuality > 100)) { @@ -110,7 +107,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { 'maxWidth': maxWidth, 'maxHeight': maxHeight, 'imageQuality': imageQuality, - 'forceFullMetadata': forceFullMetadata, 'cameraDevice': preferredCameraDevice.index }, ); @@ -187,7 +183,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) async { String? path = await _getImagePath( @@ -195,7 +190,6 @@ class MethodChannelImagePicker extends ImagePickerPlatform { maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, - forceFullMetadata: forceFullMetadata, preferredCameraDevice: preferredCameraDevice, ); return path != null ? XFile(path) : null; diff --git a/packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart b/packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart index 60fa784c22a3..5c1c8b698442 100644 --- a/packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart +++ b/packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart @@ -58,11 +58,6 @@ abstract class ImagePickerPlatform extends PlatformInterface { /// image types such as JPEG. If compression is not supported for the image that is picked, /// a warning message will be logged. /// - /// `forceFullMetadata` defaults to `true`, so the plugin tries to get the full image metadata which may require - /// extra permission requests on certain platforms. - /// If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces permission requests - /// from the platform (e.g. on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission). - /// /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. /// Defaults to [CameraDevice.rear]. Note that Android has no documented parameter for an intent to specify if @@ -78,7 +73,6 @@ abstract class ImagePickerPlatform extends PlatformInterface { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) { throw UnimplementedError('pickImage() has not been implemented.'); @@ -170,11 +164,6 @@ abstract class ImagePickerPlatform extends PlatformInterface { /// image types such as JPEG. If compression is not supported for the image that is picked, /// a warning message will be logged. /// - /// `forceFullMetadata` defaults to `true`, so the plugin tries to get the full image metadata which may require - /// extra permission requests on certain platforms. - /// If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces permission requests - /// from the platform (e.g. on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission). - /// /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. /// Defaults to [CameraDevice.rear]. Note that Android has no documented parameter for an intent to specify if @@ -190,7 +179,6 @@ abstract class ImagePickerPlatform extends PlatformInterface { double? maxWidth, double? maxHeight, int? imageQuality, - bool forceFullMetadata = true, CameraDevice preferredCameraDevice = CameraDevice.rear, }) { throw UnimplementedError('getImage() has not been implemented.'); diff --git a/packages/image_picker/image_picker_platform_interface/pubspec.yaml b/packages/image_picker/image_picker_platform_interface/pubspec.yaml index 53852de4f1d3..2168ff0f778a 100644 --- a/packages/image_picker/image_picker_platform_interface/pubspec.yaml +++ b/packages/image_picker/image_picker_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/image_picker issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.4.0 +version: 2.3.0 environment: sdk: ">=2.12.0 <3.0.0" diff --git a/packages/image_picker/image_picker_platform_interface/test/new_method_channel_image_picker_test.dart b/packages/image_picker/image_picker_platform_interface/test/new_method_channel_image_picker_test.dart index a2d9568fc85d..17caa8456621 100644 --- a/packages/image_picker/image_picker_platform_interface/test/new_method_channel_image_picker_test.dart +++ b/packages/image_picker/image_picker_platform_interface/test/new_method_channel_image_picker_test.dart @@ -40,16 +40,14 @@ void main() { 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 1, 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), ], ); @@ -95,56 +93,49 @@ void main() { 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': null, 'maxHeight': 10.0, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': 20.0, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': null, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': null, 'maxHeight': 10.0, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': 20.0, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), ], ); @@ -205,7 +196,6 @@ void main() { 'maxHeight': null, 'imageQuality': null, 'cameraDevice': 0, - 'forceFullMetadata': true, }), ], ); @@ -225,7 +215,6 @@ void main() { 'maxHeight': null, 'imageQuality': null, 'cameraDevice': 1, - 'forceFullMetadata': true, }), ], ); @@ -520,16 +509,14 @@ void main() { 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 1, 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), ], ); @@ -575,56 +562,49 @@ void main() { 'maxWidth': null, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': null, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': null, 'maxHeight': 10.0, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': 20.0, 'imageQuality': null, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': null, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': null, 'maxHeight': 10.0, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), isMethodCall('pickImage', arguments: { 'source': 0, 'maxWidth': 10.0, 'maxHeight': 20.0, 'imageQuality': 70, - 'cameraDevice': 0, - 'forceFullMetadata': true, + 'cameraDevice': 0 }), ], ); @@ -684,7 +664,6 @@ void main() { 'maxHeight': null, 'imageQuality': null, 'cameraDevice': 0, - 'forceFullMetadata': true, }), ], ); @@ -704,7 +683,6 @@ void main() { 'maxHeight': null, 'imageQuality': null, 'cameraDevice': 1, - 'forceFullMetadata': true, }), ], ); From 244bc2f0df3df3132e8bffd4db34d6afb5cf32d4 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Sun, 5 Sep 2021 16:44:14 -0700 Subject: [PATCH 2/3] Change package version number to 2.4.1 --- .../image_picker/image_picker_platform_interface/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_platform_interface/pubspec.yaml b/packages/image_picker/image_picker_platform_interface/pubspec.yaml index 2168ff0f778a..e41137fcb06b 100644 --- a/packages/image_picker/image_picker_platform_interface/pubspec.yaml +++ b/packages/image_picker/image_picker_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/image_picker issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.3.0 +version: 2.4.1 environment: sdk: ">=2.12.0 <3.0.0" From eac61c49ea74887f1b060ee683e6f547593acb7a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Sun, 5 Sep 2021 17:08:58 -0700 Subject: [PATCH 3/3] Update CHANGELOG.md --- .../image_picker_platform_interface/CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md index 97480e044284..d637ac1a277e 100644 --- a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md +++ b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md @@ -1,3 +1,16 @@ +## 2.4.1 + +* Reverts the changes from 2.4.0, which was a breaking change that + was incorrectly marked as a non-breaking change. + +## 2.4.0 + +* Add `forceFullMetadata` option to `pickImage`. + * To keep this non-breaking `forceFullMetadata` defaults to `true`, so the plugin tries + to get the full image metadata which may require extra permission requests on certain platforms. + * If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces + permission requests from the platform (e.g on iOS the plugin won’t ask for the `NSPhotoLibraryUsageDescription` permission). + ## 2.3.0 * Updated `LostDataResponse` to include a `files` property, in case more than one file was recovered.