Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5d3a9aa
Added new image picking method with flag for controlling metadata
PiotrMitkowski Jan 3, 2022
4195dca
Updated tests with cases for the new method
PiotrMitkowski Jan 3, 2022
7d255de
Updated changelog in platform interface and app-facing package to mat…
PiotrMitkowski Jan 3, 2022
3fd7383
Updated app-facing package to call new method from platform interface
PiotrMitkowski Jan 3, 2022
686bc22
Merge branch 'master' of github.com:flutter/plugins into ios-optional…
PiotrMitkowski Jan 12, 2022
1f73191
Fixed version in changelog file
PiotrMitkowski Jan 12, 2022
24d0679
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski Jan 18, 2022
1ba0c73
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski Jan 18, 2022
1084763
PR remarks
PiotrMitkowski Jan 24, 2022
a89ad0a
Renamed flag to better specify its purpose
PiotrMitkowski Jan 24, 2022
8ff7492
Renamed flag in remaining occurences
PiotrMitkowski Jan 24, 2022
193bbe9
Merge branch 'main' into ios-optional-permissions
PiotrMitkowski Jan 24, 2022
95eef20
Fixed formatting and originalAsset assignment
PiotrMitkowski Jan 24, 2022
e10b24e
Merge remote-tracking branch 'origin/ios-optional-permissions' into i…
PiotrMitkowski Jan 24, 2022
f2c2e68
Resolved merge conflicts
PiotrMitkowski Feb 1, 2022
f5f94b2
PR remarks
PiotrMitkowski Feb 14, 2022
97efdca
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Feb 14, 2022
bd3dfeb
Fixed issues after merge
PiotrMitkowski Feb 14, 2022
b99ba07
Added a test for picking image without full metadata
PiotrMitkowski Feb 14, 2022
3d6c45c
Fixed code formatting
PiotrMitkowski Feb 14, 2022
b3e9166
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Apr 7, 2022
bf3f55c
PR remarks
PiotrMitkowski Apr 7, 2022
742b259
Fixed linter warnings
PiotrMitkowski Apr 7, 2022
d41b390
Added dependency overrides for missing modules
PiotrMitkowski Apr 7, 2022
ead2f62
Fixed formatting
PiotrMitkowski Apr 7, 2022
7b6ace9
Added options class for handling image picking settings
PiotrMitkowski Apr 8, 2022
0f43653
Added missing license comment
PiotrMitkowski Apr 8, 2022
c6dcc49
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Apr 13, 2022
9ba71b9
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Apr 14, 2022
c1fc9da
PR remarks
PiotrMitkowski Apr 15, 2022
7f958a6
pbxproj version revert
PiotrMitkowski Apr 15, 2022
c825d09
PR remarks
PiotrMitkowski Apr 27, 2022
a2ca361
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Apr 27, 2022
0120c47
Resolved merge conflicts
PiotrMitkowski Apr 27, 2022
0827c80
Generated Pigeon files for new API and metadata flag
PiotrMitkowski Apr 27, 2022
994e45f
Switched to use options object in private picking method
PiotrMitkowski Apr 28, 2022
9b39e31
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Apr 28, 2022
933254e
Fixed failing unit tests
PiotrMitkowski Apr 28, 2022
66f14b2
Added missing tests for a new method and request full metadata parameter
PiotrMitkowski Apr 28, 2022
47098ec
Fixed failing native tests
PiotrMitkowski Apr 28, 2022
0a811d8
PR remarks
PiotrMitkowski Apr 29, 2022
0789a7b
Fixed linting
PiotrMitkowski Apr 29, 2022
c5966d4
Removed dependency overrides
PiotrMitkowski May 12, 2022
6f32405
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski May 12, 2022
217237b
PR remarks
PiotrMitkowski May 12, 2022
7a4d250
Fixed linter warnings and failing tests
PiotrMitkowski May 12, 2022
4ee04cb
Removed remaining dependency override
PiotrMitkowski May 12, 2022
b3fb220
Enforcing proper platform interface version having required API changes
PiotrMitkowski May 13, 2022
4d884de
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski May 13, 2022
c2240fa
Fixed failing test in app-facing plugin
PiotrMitkowski May 13, 2022
2fea4be
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Sep 1, 2022
839b574
Added missing tests
PiotrMitkowski Sep 1, 2022
b0b1d1b
Fixed formatting and linter issues
PiotrMitkowski Sep 1, 2022
0c3fe02
Restored original interface version in Android example
PiotrMitkowski Sep 1, 2022
f9c8ea3
Fixed formatting in mocks
PiotrMitkowski Sep 1, 2022
24a504b
Fixed docs lines length
PiotrMitkowski Sep 1, 2022
f842d76
PR remarks
PiotrMitkowski Sep 5, 2022
b45b4e6
PR remarks
PiotrMitkowski Sep 5, 2022
e357c56
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Sep 7, 2022
5567f8c
PR remarks
PiotrMitkowski Sep 7, 2022
58d6b10
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Sep 20, 2022
f80f09d
Merge branch 'main' of github.com:flutter/plugins into ios-optional-p…
PiotrMitkowski Sep 21, 2022
39e8d37
Updated package with iOS implementation to fix a bug
PiotrMitkowski Sep 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR remarks
Added missing native implementation of the new flag
  • Loading branch information
PiotrMitkowski committed Jan 24, 2022
commit 10847632a7c62ca50d3c15def0b2bbb11aaeda47
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ - (void)pickImageWithPHPicker:(int)maxImagesAllowed API_AVAILABLE(ios(14)) {

self.maxImagesAllowed = maxImagesAllowed;

[self checkPhotoAuthorizationForAccessLevel];
BOOL usePhaAsset = [[_arguments objectForKey:@"forceFullMetadata"] boolValue];
if (usePhaAsset) {
[self checkPhotoAuthorizationForAccessLevel];
} else {
[self showPhotoLibrary:PHPickerClassType];
}
}

- (void)pickImageWithUIImagePicker {
Expand All @@ -107,6 +112,7 @@ - (void)pickImageWithUIImagePicker {
_imagePickerController.mediaTypes = @[ (NSString *)kUTTypeImage ];

int imageSource = [[_arguments objectForKey:@"source"] intValue];
BOOL usePhaAsset = [[_arguments objectForKey:@"forceFullMetadata"] boolValue];

self.maxImagesAllowed = 1;

Expand All @@ -115,7 +121,11 @@ - (void)pickImageWithUIImagePicker {
[self checkCameraAuthorization];
break;
case SOURCE_GALLERY:
[self checkPhotoAuthorization];
if (usePhaAsset) {
[self checkPhotoAuthorization];
} else {
[self showPhotoLibrary:UIImagePickerClassType];
}
break;
default:
self.result([FlutterError errorWithCode:@"invalid_source"
Expand All @@ -132,13 +142,14 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
details:nil]);
self.result = nil;
}
BOOL usePhaAsset = [[_arguments objectForKey:@"forceFullMetadata"] boolValue];

if ([@"pickImage" isEqualToString:call.method]) {
self.result = result;
_arguments = call.arguments;
int imageSource = [[_arguments objectForKey:@"source"] intValue];

if (imageSource == SOURCE_GALLERY) { // Capture is not possible with PHPicker
if (usePhaAsset && imageSource == SOURCE_GALLERY) { // Capture is not possible with PHPicker
if (@available(iOS 14, *)) {
// PHPicker is used
[self pickImageWithPHPicker:1];
Expand Down Expand Up @@ -181,6 +192,11 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
[self checkCameraAuthorization];
break;
case SOURCE_GALLERY:
if (usePhaAsset) {
[self checkPhotoAuthorization];
} else {
[self showPhotoLibrary:UIImagePickerClassType];
}
[self checkPhotoAuthorization];
break;
default:
Expand Down Expand Up @@ -484,8 +500,12 @@ - (void)imagePickerController:(UIImagePickerController *)picker
NSNumber *maxHeight = [_arguments objectForKey:@"maxHeight"];
NSNumber *imageQuality = [_arguments objectForKey:@"imageQuality"];
NSNumber *desiredImageQuality = [self getDesiredImageQuality:imageQuality];
BOOL usePhaAsset = [[_arguments objectForKey:@"forceFullMetadata"] boolValue];

PHAsset *originalAsset = [FLTImagePickerPhotoAssetUtil getAssetFromImagePickerInfo:info];
PHAsset *originalAsset;
if(usePhaAsset) {
PHAsset *originalAsset = [FLTImagePickerPhotoAssetUtil getAssetFromImagePickerInfo:info];
}

if (maxWidth != (id)[NSNull null] || maxHeight != (id)[NSNull null]) {
image = [FLTImagePickerImageUtil scaledImage:image
Expand Down
9 changes: 3 additions & 6 deletions packages/image_picker/image_picker/lib/image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,9 @@ class ImagePicker {
/// the front or rear camera should be opened, this function is not guaranteed
/// to work on an Android device.
///
/// Use `forceFullMetadata` (defaults to `true`) to control, how much additional information the plugin tries to get on iOS.
/// If `forceFullMetadata` is set to `true`, the plugin tries to get the full image metadata which may require
/// extra permission requests.
/// If `forceFullMetadata` is set to `false`, the plugin fetches the image in a way that reduces permission requests
/// from the iOS platform (it won’t ask for the `Photo Library Usage` permission).
///
/// Use `requestFullMetadata` (defaults to `true`) to control how much additional information the plugin tries to get on iOS.
/// 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 2.5.0

* Re-adding `forceFullMetadata` option, but as a parameter of a new `pickImageFromSource`
method (non-breaking change approach).
* Re-adds `forceFullMetadata` option, but as a parameter of a new `pickImageFromSource`
method.

## 2.4.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,26 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
return path != null ? XFile(path) : null;
}

@override
Future<XFile?> getImageFromSource({
required ImageSource source,
double? maxWidth,
double? maxHeight,
int? imageQuality,
CameraDevice preferredCameraDevice = CameraDevice.rear,
bool forceFullMetadata = true,
}) async {
String? path = await _getImagePath(
source: source,
maxWidth: maxWidth,
maxHeight: maxHeight,
imageQuality: imageQuality,
preferredCameraDevice: preferredCameraDevice,
forceFullMetadata: forceFullMetadata,
);
return path != null ? XFile(path) : null;
}

@override
Future<List<XFile>?> getMultiImage({
double? maxWidth,
Expand Down Expand Up @@ -272,24 +292,4 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
files: pickedFileList,
);
}

@override
Future<XFile?> getImageFromSource({
required ImageSource source,
double? maxWidth,
double? maxHeight,
int? imageQuality,
CameraDevice preferredCameraDevice = CameraDevice.rear,
bool forceFullMetadata = true,
}) async {
String? path = await _getImagePath(
source: source,
maxWidth: maxWidth,
maxHeight: maxHeight,
imageQuality: imageQuality,
preferredCameraDevice: preferredCameraDevice,
forceFullMetadata: forceFullMetadata,
);
return path != null ? XFile(path) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
throw UnimplementedError('retrieveLostData() has not been implemented.');
}

/// This method is deprecated in favor of [getImageFromSource] and will be removed in a future update
/// This method is deprecated in favor of [getImageFromSource] and will be removed in a future update.
///
/// Returns an [XFile] with the image that was picked.
///
Expand Down