This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed
packages/image_picker/image_picker Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.6.6+4
2
+
3
+ * Fix bug, sometimes double click cancel button will crash.
4
+
1
5
## 0.6.6+3
2
6
3
7
* Update README
Original file line number Diff line number Diff line change @@ -326,8 +326,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker
326
326
327
327
- (void )imagePickerControllerDidCancel : (UIImagePickerController *)picker {
328
328
[_imagePickerController dismissViewControllerAnimated: YES completion: nil ];
329
+ if (!self.result ) {
330
+ return ;
331
+ }
329
332
self.result (nil );
330
-
331
333
self.result = nil ;
332
334
_arguments = nil ;
333
335
}
Original file line number Diff line number Diff line change 10
10
@interface FLTImagePickerPlugin (Test)
11
11
@property (copy , nonatomic ) FlutterResult result;
12
12
- (void )handleSavedPath : (NSString *)path ;
13
+ - (void )imagePickerControllerDidCancel : (UIImagePickerController *)picker ;
13
14
@end
14
15
15
16
@interface ImagePickerPluginTests : XCTestCase
@@ -66,6 +67,25 @@ - (void)testPluginPickVideoDeviceBack {
66
67
UIImagePickerControllerCameraDeviceRear);
67
68
}
68
69
70
+ - (void )testPluginPickImageDeviceCancelClickMultipleTimes {
71
+ if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
72
+ return ;
73
+ }
74
+ FLTImagePickerPlugin *plugin =
75
+ [[FLTImagePickerPlugin alloc ] initWithViewController: [UIViewController new ]];
76
+ FlutterMethodCall *call =
77
+ [FlutterMethodCall methodCallWithMethodName: @" pickImage"
78
+ arguments: @{@" source" : @(0 ), @" cameraDevice" : @(1 )}];
79
+ [plugin handleMethodCall: call
80
+ result: ^(id _Nullable r){
81
+ }];
82
+ plugin.result = ^(id result) {
83
+
84
+ };
85
+ [plugin imagePickerControllerDidCancel: [plugin getImagePickerController ]];
86
+ [plugin imagePickerControllerDidCancel: [plugin getImagePickerController ]];
87
+ }
88
+
69
89
- (void )testPluginPickVideoDeviceFront {
70
90
if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
71
91
return ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: image_picker
2
2
description : Flutter plugin for selecting images from the Android and iOS image
3
3
library, and taking new pictures with the camera.
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
5
- version : 0.6.6+3
5
+ version : 0.6.6+4
6
6
7
7
flutter :
8
8
plugin :
You can’t perform that action at this time.
0 commit comments