Skip to content

Commit a3afe6e

Browse files
committed
Removed unused code and tests
1 parent f118533 commit a3afe6e

File tree

5 files changed

+0
-85
lines changed

5 files changed

+0
-85
lines changed

packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.m

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -514,37 +514,6 @@ - (void)testPickImageRequestAuthorization API_AVAILABLE(ios(14)) {
514514
OCMVerifyAll(mockPhotoLibrary);
515515
}
516516

517-
- (void)testPickImageAuthorizationDenied API_AVAILABLE(ios(14)) {
518-
id mockPhotoLibrary = OCMClassMock([PHPhotoLibrary class]);
519-
OCMStub([mockPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite])
520-
.andReturn(PHAuthorizationStatusDenied);
521-
522-
FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc] init];
523-
524-
XCTestExpectation *resultExpectation = [self expectationWithDescription:@"result"];
525-
526-
[plugin pickImageWithSource:[FLTSourceSpecification makeWithType:FLTSourceTypeGallery
527-
camera:FLTSourceCameraFront]
528-
maxSize:[[FLTMaxSize alloc] init]
529-
quality:nil
530-
fullMetadata:YES
531-
completion:^(NSString *result, FlutterError *error) {
532-
// Does not error due to access denied
533-
XCTAssertNil(result);
534-
XCTAssertEqualObjects(error.code, @"multiple_request");
535-
XCTAssertEqualObjects(error.message, @"Cancelled by a second request");
536-
[resultExpectation fulfill];
537-
}];
538-
[plugin pickImageWithSource:[FLTSourceSpecification makeWithType:FLTSourceTypeGallery
539-
camera:FLTSourceCameraFront]
540-
maxSize:[[FLTMaxSize alloc] init]
541-
quality:nil
542-
fullMetadata:YES
543-
completion:^(NSString *result, FlutterError *error){
544-
}];
545-
[self waitForExpectationsWithTimeout:30 handler:nil];
546-
}
547-
548517
- (void)testPickMultiImageDuplicateCallCancels API_AVAILABLE(ios(14)) {
549518
id mockPhotoLibrary = OCMClassMock([PHPhotoLibrary class]);
550519
OCMStub([mockPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite])

packages/image_picker/image_picker_ios/example/ios/RunnerTests/PhotoAssetUtilTests.m

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ - (void)getAssetFromImagePickerInfoShouldReturnNilIfNotAvailable {
2020
XCTAssertNil([FLTImagePickerPhotoAssetUtil getAssetFromImagePickerInfo:mockData]);
2121
}
2222

23-
- (void)testGetAssetFromPHPickerResultShouldReturnNilIfNotAvailable API_AVAILABLE(ios(14)) {
24-
if (@available(iOS 14, *)) {
25-
PHPickerResult *mockData;
26-
[mockData.itemProvider
27-
loadObjectOfClass:[UIImage class]
28-
completionHandler:^(__kindof id<NSItemProviderReading> _Nullable image,
29-
NSError *_Nullable error) {
30-
XCTAssertNil([FLTImagePickerPhotoAssetUtil getAssetFromPHPickerResult:mockData]);
31-
}];
32-
}
33-
}
34-
3523
- (void)testSaveImageWithOriginalImageData_ShouldSaveWithTheCorrectExtentionAndMetaData {
3624
// test jpg
3725
NSData *dataJPG = ImagePickerTestImages.JPGTestData;

packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/FLTImagePickerPhotoAssetUtil.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ + (PHAsset *)getAssetFromImagePickerInfo:(NSDictionary *)info {
1414
return info[UIImagePickerControllerPHAsset];
1515
}
1616

17-
+ (PHAsset *)getAssetFromPHPickerResult:(PHPickerResult *)result API_AVAILABLE(ios(14)) {
18-
PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[ result.assetIdentifier ]
19-
options:nil];
20-
return fetchResult.firstObject;
21-
}
22-
2317
+ (NSURL *)saveVideoFromURL:(NSURL *)videoURL {
2418
if (![[NSFileManager defaultManager] isReadableFileAtPath:[videoURL path]]) {
2519
return nil;

packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/FLTImagePickerPlugin.m

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -386,40 +386,6 @@ - (void)checkPhotoAuthorizationWithImagePicker:(UIImagePickerController *)imageP
386386
}
387387
}
388388

389-
- (void)checkPhotoAuthorizationWithPHPicker:(PHPickerViewController *)pickerViewController
390-
API_AVAILABLE(ios(14)) {
391-
PHAccessLevel requestedAccessLevel = PHAccessLevelReadWrite;
392-
PHAuthorizationStatus status =
393-
[PHPhotoLibrary authorizationStatusForAccessLevel:requestedAccessLevel];
394-
switch (status) {
395-
case PHAuthorizationStatusNotDetermined: {
396-
[PHPhotoLibrary
397-
requestAuthorizationForAccessLevel:requestedAccessLevel
398-
handler:^(PHAuthorizationStatus status) {
399-
dispatch_async(dispatch_get_main_queue(), ^{
400-
if (status == PHAuthorizationStatusAuthorized) {
401-
[self showPhotoLibraryWithPHPicker:pickerViewController];
402-
} else if (status == PHAuthorizationStatusLimited) {
403-
[self showPhotoLibraryWithPHPicker:pickerViewController];
404-
} else {
405-
[self errorNoPhotoAccess:status];
406-
}
407-
});
408-
}];
409-
break;
410-
}
411-
case PHAuthorizationStatusAuthorized:
412-
case PHAuthorizationStatusLimited:
413-
[self showPhotoLibraryWithPHPicker:pickerViewController];
414-
break;
415-
case PHAuthorizationStatusDenied:
416-
case PHAuthorizationStatusRestricted:
417-
default:
418-
[self errorNoPhotoAccess:status];
419-
break;
420-
}
421-
}
422-
423389
- (void)errorNoCameraAccess:(AVAuthorizationStatus)status {
424390
switch (status) {
425391
case AVAuthorizationStatusRestricted:

packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/include/image_picker_ios/FLTImagePickerPhotoAssetUtil.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
1414

1515
+ (nullable PHAsset *)getAssetFromImagePickerInfo:(NSDictionary *)info;
1616

17-
+ (nullable PHAsset *)getAssetFromPHPickerResult:(PHPickerResult *)result API_AVAILABLE(ios(14));
18-
1917
// Saves video to temporary URL. Returns nil on failure;
2018
+ (NSURL *)saveVideoFromURL:(NSURL *)videoURL;
2119

0 commit comments

Comments
 (0)