@@ -46,14 +46,15 @@ - (void)testPluginPickImageDeviceBack {
46
46
.andReturn (AVAuthorizationStatusAuthorized);
47
47
48
48
// Run test
49
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
49
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
50
50
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
51
51
[plugin setImagePickerControllerOverrides: @[ controller ]];
52
52
53
53
[plugin pickImageWithSource: [FLTSourceSpecification makeWithType: FLTSourceTypeCamera
54
54
camera: FLTSourceCameraRear]
55
55
maxSize: [[FLTMaxSize alloc ] init ]
56
56
quality: nil
57
+ fullMetadata: @(YES )
57
58
completion: ^(NSString *_Nullable result, FlutterError *_Nullable error){
58
59
}];
59
60
@@ -78,14 +79,15 @@ - (void)testPluginPickImageDeviceFront {
78
79
.andReturn (AVAuthorizationStatusAuthorized);
79
80
80
81
// Run test
81
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
82
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
82
83
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
83
84
[plugin setImagePickerControllerOverrides: @[ controller ]];
84
85
85
86
[plugin pickImageWithSource: [FLTSourceSpecification makeWithType: FLTSourceTypeCamera
86
87
camera: FLTSourceCameraFront]
87
88
maxSize: [[FLTMaxSize alloc ] init ]
88
89
quality: nil
90
+ fullMetadata: @(YES )
89
91
completion: ^(NSString *_Nullable result, FlutterError *_Nullable error){
90
92
}];
91
93
@@ -110,7 +112,7 @@ - (void)testPluginPickVideoDeviceBack {
110
112
.andReturn (AVAuthorizationStatusAuthorized);
111
113
112
114
// Run test
113
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
115
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
114
116
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
115
117
[plugin setImagePickerControllerOverrides: @[ controller ]];
116
118
@@ -142,7 +144,7 @@ - (void)testPluginPickVideoDeviceFront {
142
144
.andReturn (AVAuthorizationStatusAuthorized);
143
145
144
146
// Run test
145
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
147
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
146
148
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
147
149
[plugin setImagePickerControllerOverrides: @[ controller ]];
148
150
@@ -165,32 +167,69 @@ - (void)testPickMultiImageShouldUseUIImagePickerControllerOnPreiOS14 {
165
167
OCMStub (ClassMethod ([photoLibrary authorizationStatus ]))
166
168
.andReturn (PHAuthorizationStatusAuthorized);
167
169
168
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
170
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
169
171
[plugin setImagePickerControllerOverrides: @[ mockUIImagePicker ]];
170
172
171
173
[plugin pickMultiImageWithMaxSize: [FLTMaxSize makeWithWidth: @(100 ) height: @(200 )]
172
174
quality: @(50 )
175
+ fullMetadata: @(YES )
173
176
completion: ^(NSArray <NSString *> *_Nullable result,
174
177
FlutterError *_Nullable error){
175
178
}];
176
179
OCMVerify (times (1 ),
177
180
[mockUIImagePicker setSourceType: UIImagePickerControllerSourceTypePhotoLibrary]);
178
181
}
179
182
183
+ - (void )testPickImageWithoutFullMetadata API_AVAILABLE(ios(11 )) {
184
+ id mockUIImagePicker = OCMClassMock ([UIImagePickerController class ]);
185
+ id photoLibrary = OCMClassMock ([PHPhotoLibrary class ]);
186
+
187
+ FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc ] init ];
188
+ [plugin setImagePickerControllerOverrides: @[ mockUIImagePicker ]];
189
+
190
+ [plugin pickImageWithSource: [FLTSourceSpecification makeWithType: FLTSourceTypeGallery
191
+ camera: FLTSourceCameraFront]
192
+ maxSize: [[FLTMaxSize alloc ] init ]
193
+ quality: nil
194
+ fullMetadata: @(NO )
195
+ completion: ^(NSString *_Nullable result, FlutterError *_Nullable error){
196
+ }];
197
+
198
+ OCMVerify (times (0 ), [photoLibrary authorizationStatus ]);
199
+ }
200
+
201
+ - (void )testPickMultiImageWithoutFullMetadata API_AVAILABLE(ios(11 )) {
202
+ id mockUIImagePicker = OCMClassMock ([UIImagePickerController class ]);
203
+ id photoLibrary = OCMClassMock ([PHPhotoLibrary class ]);
204
+
205
+ FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc ] init ];
206
+ [plugin setImagePickerControllerOverrides: @[ mockUIImagePicker ]];
207
+
208
+ [plugin pickMultiImageWithMaxSize: [[FLTMaxSize alloc ] init ]
209
+ quality: nil
210
+ fullMetadata: @(NO )
211
+ completion: ^(NSArray <NSString *> *_Nullable result,
212
+ FlutterError *_Nullable error){
213
+ }];
214
+
215
+ OCMVerify (times (0 ), [photoLibrary authorizationStatus ]);
216
+ }
217
+
180
218
#pragma mark - Test camera devices, no op on simulators
181
219
182
220
- (void )testPluginPickImageDeviceCancelClickMultipleTimes {
183
221
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
184
222
return ;
185
223
}
186
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
224
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
187
225
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
188
226
plugin.imagePickerControllerOverrides = @[ controller ];
189
227
190
228
[plugin pickImageWithSource: [FLTSourceSpecification makeWithType: FLTSourceTypeCamera
191
229
camera: FLTSourceCameraRear]
192
230
maxSize: [[FLTMaxSize alloc ] init ]
193
231
quality: nil
232
+ fullMetadata: @(YES )
194
233
completion: ^(NSString *_Nullable result, FlutterError *_Nullable error){
195
234
}];
196
235
@@ -202,7 +241,7 @@ - (void)testPluginPickImageDeviceCancelClickMultipleTimes {
202
241
#pragma mark - Test video duration
203
242
204
243
- (void )testPickingVideoWithDuration {
205
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
244
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
206
245
UIImagePickerController *controller = [[UIImagePickerController alloc ] init ];
207
246
[plugin setImagePickerControllerOverrides: @[ controller ]];
208
247
@@ -223,12 +262,12 @@ - (void)testViewController {
223
262
UIViewController *vc2 = [UIViewController new ];
224
263
vc1.mockPresented = vc2;
225
264
226
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
265
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
227
266
XCTAssertEqual ([plugin viewControllerWithWindow: window], vc2);
228
267
}
229
268
230
269
- (void )testPluginMultiImagePathHasNullItem {
231
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
270
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
232
271
233
272
dispatch_semaphore_t resultSemaphore = dispatch_semaphore_create (0 );
234
273
__block FlutterError *pickImageResult = nil ;
@@ -245,7 +284,7 @@ - (void)testPluginMultiImagePathHasNullItem {
245
284
}
246
285
247
286
- (void )testPluginMultiImagePathHasItem {
248
- FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new ];
287
+ FLTImagePickerPlugin *plugin = [[ FLTImagePickerPlugin alloc ] init ];
249
288
NSArray *pathList = @[ @" test" ];
250
289
251
290
dispatch_semaphore_t resultSemaphore = dispatch_semaphore_create (0 );
0 commit comments