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
4 changes: 4 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.6

* Fixes crash when an image in the gallery is tapped more than once.

## 0.6.5+1

* Fix CocoaPods podspec lint warnings.
Expand Down
7 changes: 5 additions & 2 deletions packages/image_picker/ios/Classes/FLTImagePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker
}
self.result(videoURL.path);
self.result = nil;

_arguments = nil;
} else {
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
if (image == nil) {
Expand Down Expand Up @@ -322,7 +322,6 @@ - (void)imagePickerController:(UIImagePickerController *)picker
}];
}
}
_arguments = nil;
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
Expand Down Expand Up @@ -357,6 +356,9 @@ - (void)saveImageWithPickerInfo:(NSDictionary *)info
}

- (void)handleSavedPath:(NSString *)path {
if (!self.result) {
return;
}
if (path) {
self.result(path);
} else {
Expand All @@ -365,6 +367,7 @@ - (void)handleSavedPath:(NSString *)path {
details:nil]);
}
self.result = nil;
_arguments = nil;
}

@end
21 changes: 21 additions & 0 deletions packages/image_picker/ios/Tests/ImagePickerPluginTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
@import image_picker;
@import XCTest;

@interface FLTImagePickerPlugin (Test)
@property(copy, nonatomic) FlutterResult result;
- (void)handleSavedPath:(NSString *)path;
@end

@interface ImagePickerPluginTests : XCTestCase
@end

Expand Down Expand Up @@ -90,4 +95,20 @@ - (void)testPickingVideoWithDuration {
XCTAssertEqual([plugin getImagePickerController].videoMaximumDuration, 95);
}

- (void)testPluginPickImageSelectMultipleTimes {
FLTImagePickerPlugin *plugin =
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
FlutterMethodCall *call =
[FlutterMethodCall methodCallWithMethodName:@"pickImage"
arguments:@{@"source" : @(0), @"cameraDevice" : @(0)}];
[plugin handleMethodCall:call
result:^(id _Nullable r){
}];
plugin.result = ^(id result) {

};
[plugin handleSavedPath:@"test"];
[plugin handleSavedPath:@"test"];
}

@end
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: image_picker
description: Flutter plugin for selecting images from the Android and iOS image
library, and taking new pictures with the camera.
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
version: 0.6.5+1
version: 0.6.6

flutter:
plugin:
Expand Down