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 all commits
Commits
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
3 changes: 2 additions & 1 deletion packages/image_picker/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.8.3+3

* Fix pickImage not returning a value on iOS when dismissing PHPicker sheet by swiping.
* Updated Android lint settings.

## 0.8.3+2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

@interface FLTImagePickerPlugin () <UINavigationControllerDelegate,
UIImagePickerControllerDelegate,
PHPickerViewControllerDelegate>
PHPickerViewControllerDelegate,
UIAdaptivePresentationControllerDelegate>

@property(copy, nonatomic) FlutterResult result;

Expand Down Expand Up @@ -92,6 +93,7 @@ - (void)pickImageWithPHPicker:(int)maxImagesAllowed API_AVAILABLE(ios(14)) {

_pickerViewController = [[PHPickerViewController alloc] initWithConfiguration:config];
_pickerViewController.delegate = self;
_pickerViewController.presentationController.delegate = self;

self.maxImagesAllowed = maxImagesAllowed;

Expand Down Expand Up @@ -373,18 +375,28 @@ - (NSNumber *)getDesiredImageQuality:(NSNumber *)imageQuality {
return imageQuality;
}

- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController {
if (self.result != nil) {
self.result(nil);
self.result = nil;
self->_arguments = nil;
}
}

- (void)picker:(PHPickerViewController *)picker
didFinishPicking:(NSArray<PHPickerResult *> *)results API_AVAILABLE(ios(14)) {
[picker dismissViewControllerAnimated:YES completion:nil];
dispatch_queue_t backgroundQueue =
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(backgroundQueue, ^{
if (results.count == 0) {
if (results.count == 0) {
if (self.result != nil) {
self.result(nil);
self.result = nil;
self->_arguments = nil;
return;
}
return;
}
dispatch_queue_t backgroundQueue =
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(backgroundQueue, ^{
NSNumber *maxWidth = [self->_arguments objectForKey:@"maxWidth"];
NSNumber *maxHeight = [self->_arguments objectForKey:@"maxHeight"];
NSNumber *imageQuality = [self->_arguments objectForKey:@"imageQuality"];
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for selecting images from the Android and iOS image
library, and taking new pictures with the camera.
repository: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
version: 0.8.3+2
version: 0.8.3+3

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down