OPS: RNCamera patch for macOS

This commit is contained in:
Marcos Rodriguez Vélez 2021-07-26 08:35:03 -04:00
parent c0e748cc9c
commit 8b35b5ba12
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,40 @@
9d8
< #import <AssetsLibrary/ALAssetsLibrary.h>
771,782d769
< else if (target == RCTCameraCaptureTargetCameraRoll) {
< [[[ALAssetsLibrary alloc] init] writeImageDataToSavedPhotosAlbum:imageData metadata:metadata completionBlock:^(NSURL* url, NSError* error) {
< if (error == nil) {
< //path isn't really applicable here (this is an asset uri), but left it in for backward comparability
< resolve(@{@"path":[url absoluteString], @"mediaUri":[url absoluteString]});
< }
< else {
< reject(RCTErrorUnspecified, nil, RCTErrorWithMessage(error.description));
< }
< }];
< return;
< }
921,942c908
< if (self.videoTarget == RCTCameraCaptureTargetCameraRoll) {
< ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
< if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL]) {
< [library writeVideoAtPathToSavedPhotosAlbum:outputFileURL
< completionBlock:^(NSURL *assetURL, NSError *error) {
< if (error) {
< self.videoReject(RCTErrorUnspecified, nil, RCTErrorWithMessage(error.description));
< return;
< } else if (assetURL == nil) {
< //It's possible for writing to camera roll to fail,
< //without receiving an error message, but assetURL will be nil
< //Happens when disk is (almost) full
< self.videoReject(RCTErrorUnspecified, nil, RCTErrorWithMessage(@"Not enough storage"));
< return;
< }
<
< [videoInfo setObject:[assetURL absoluteString] forKey:@"path"];
< self.videoResolve(videoInfo);
< }];
< }
< }
< else if (self.videoTarget == RCTCameraCaptureTargetDisk) {
---
> if (self.videoTarget == RCTCameraCaptureTargetDisk) {

View File

@ -5,6 +5,8 @@ echo "Re-installing node_modules"
npm i
echo "Applying patch for react-native-xcode.sh"
sed -i '' 's/--platform "$BUNDLE_PLATFORM"/--platform "ios"/g' ./node_modules/react-native/scripts/react-native-xcode.sh
echo "Applying patch for RCTCameraManager.m"
patch node_modules/react-native-camera/ios/RCT/RCTCameraManager.m scripts/maccatalystpatches/RCTCameraManagerDiff
echo "Deleting torrific.js content"
echo > blue_modules/torrific.js
echo ""