Last active
May 22, 2024 20:23
-
-
Save jehartzog/969fc083b48a587ba02d656ecacec44c to your computer and use it in GitHub Desktop.
react-native-image-crop-picker+0.36.4.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m | |
index cb64b7d..cc7b353 100644 | |
--- a/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m | |
+++ b/node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m | |
@@ -153,7 +153,7 @@ - (UIViewController*) getRootVC { | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
picker.delegate = self; | |
- picker.allowsEditing = NO; | |
+ picker.allowsEditing = YES; | |
picker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
NSString *mediaType = [self.options objectForKey:@"mediaType"]; | |
@@ -165,6 +165,20 @@ - (UIViewController*) getRootVC { | |
picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil]; | |
picker.videoQuality = UIImagePickerControllerQualityTypeHigh; | |
} | |
+ } else if ([mediaType isEqualToString:@"photo"]) { | |
+ NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; | |
+ | |
+ if ([availableTypes containsObject:(NSString *)kUTTypeImage]) { | |
+ picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil]; | |
+ picker.videoQuality = UIImagePickerControllerQualityTypeHigh; | |
+ } | |
+ } else if ([mediaType isEqualToString:@"any"]) { | |
+ NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; | |
+ | |
+ if ([availableTypes containsObject:(NSString *)kUTTypeImage]) { | |
+ picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage,(NSString *)kUTTypeMovie, nil]; | |
+ picker.videoQuality = UIImagePickerControllerQualityTypeHigh; | |
+ } | |
} | |
if ([[self.options objectForKey:@"useFrontCamera"] boolValue]) { | |
@@ -208,7 +222,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking | |
} | |
]; | |
} else { | |
- UIImage *chosenImage = [info objectForKey:UIImagePickerControllerOriginalImage]; | |
+ UIImage *chosenImage = [info objectForKey:UIImagePickerControllerEditedImage]; | |
NSDictionary *exif; | |
if([[self.options objectForKey:@"includeExif"] boolValue]) { | |
@@ -463,7 +477,7 @@ - (void) handleVideo:(AVAsset*)asset withFileName:(NSString*)fileName withLocalI | |
- (void) getVideoAsset:(PHAsset*)forAsset completion:(void (^)(NSDictionary* image))completion { | |
PHImageManager *manager = [PHImageManager defaultManager]; | |
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init]; | |
- options.version = PHVideoRequestOptionsVersionOriginal; | |
+ options.version = PHVideoRequestOptionsVersionCurrent; | |
options.networkAccessAllowed = YES; | |
options.deliveryMode = PHVideoRequestOptionsDeliveryModeHighQualityFormat; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment