Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a324ff7

Browse files
chris-rutkowskichris-agoda
authored andcommitted
style and unit tests
1 parent 9f58745 commit a324ff7

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

packages/image_picker/image_picker/ios/Classes/FLTImagePickerPlugin.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ - (void)showCamera {
132132
[UIImagePickerController isCameraDeviceAvailable:_device]) {
133133
_imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
134134
_imagePickerController.cameraDevice = _device;
135-
[[self viewController] presentViewController:_imagePickerController animated:YES completion:nil];
135+
[[self viewController] presentViewController:_imagePickerController
136+
animated:YES
137+
completion:nil];
136138
} else {
137139
[[[UIAlertView alloc] initWithTitle:@"Error"
138140
message:@"Camera not available."
@@ -237,7 +239,9 @@ - (void)errorNoPhotoAccess:(PHAuthorizationStatus)status {
237239
- (void)showPhotoLibrary {
238240
// No need to check if SourceType is available. It always is.
239241
_imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
240-
[[self viewController] presentViewController:_imagePickerController animated:YES completion:nil];
242+
[[self viewController] presentViewController:_imagePickerController
243+
animated:YES
244+
completion:nil];
241245
}
242246

243247
- (void)imagePickerController:(UIImagePickerController *)picker

packages/image_picker/image_picker/ios/Tests/ImagePickerPluginTests.m

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ - (void)testPluginPickImageDeviceBack {
2222
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
2323
return;
2424
}
25-
FLTImagePickerPlugin *plugin =
26-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
25+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
2726
FlutterMethodCall *call =
2827
[FlutterMethodCall methodCallWithMethodName:@"pickImage"
2928
arguments:@{@"source" : @(0), @"cameraDevice" : @(0)}];
@@ -38,8 +37,7 @@ - (void)testPluginPickImageDeviceFront {
3837
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
3938
return;
4039
}
41-
FLTImagePickerPlugin *plugin =
42-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
40+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
4341
FlutterMethodCall *call =
4442
[FlutterMethodCall methodCallWithMethodName:@"pickImage"
4543
arguments:@{@"source" : @(0), @"cameraDevice" : @(1)}];
@@ -54,8 +52,7 @@ - (void)testPluginPickVideoDeviceBack {
5452
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
5553
return;
5654
}
57-
FLTImagePickerPlugin *plugin =
58-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
55+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
5956
FlutterMethodCall *call =
6057
[FlutterMethodCall methodCallWithMethodName:@"pickVideo"
6158
arguments:@{@"source" : @(0), @"cameraDevice" : @(0)}];
@@ -70,8 +67,7 @@ - (void)testPluginPickVideoDeviceFront {
7067
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
7168
return;
7269
}
73-
FLTImagePickerPlugin *plugin =
74-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
70+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
7571
FlutterMethodCall *call =
7672
[FlutterMethodCall methodCallWithMethodName:@"pickVideo"
7773
arguments:@{@"source" : @(0), @"cameraDevice" : @(1)}];
@@ -84,8 +80,7 @@ - (void)testPluginPickVideoDeviceFront {
8480

8581
#pragma mark - Test video duration
8682
- (void)testPickingVideoWithDuration {
87-
FLTImagePickerPlugin *plugin =
88-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
83+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
8984
FlutterMethodCall *call = [FlutterMethodCall
9085
methodCallWithMethodName:@"pickVideo"
9186
arguments:@{@"source" : @(0), @"cameraDevice" : @(0), @"maxDuration" : @95}];
@@ -96,8 +91,7 @@ - (void)testPickingVideoWithDuration {
9691
}
9792

9893
- (void)testPluginPickImageSelectMultipleTimes {
99-
FLTImagePickerPlugin *plugin =
100-
[[FLTImagePickerPlugin alloc] initWithViewController:[UIViewController new]];
94+
FLTImagePickerPlugin *plugin = [FLTImagePickerPlugin new];
10195
FlutterMethodCall *call =
10296
[FlutterMethodCall methodCallWithMethodName:@"pickImage"
10397
arguments:@{@"source" : @(0), @"cameraDevice" : @(0)}];

0 commit comments

Comments
 (0)