Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,9 @@ PODS:
- React-Core
- react-native-blob-util (0.19.4):
- React-Core
- react-native-cameraroll (5.4.0):
- react-native-cameraroll (7.4.0):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- react-native-config (1.4.6):
- react-native-config/App (= 1.4.6)
Expand Down Expand Up @@ -1929,7 +1931,7 @@ SPEC CHECKSUMS:
React-Mapbuffer: 9ee041e1d7be96da6d76a251f92e72b711c651d6
react-native-airship: 6ded22e4ca54f2f80db80b7b911c2b9b696d9335
react-native-blob-util: 30a6c9fd067aadf9177e61a998f2c7efb670598d
react-native-cameraroll: 8ffb0af7a5e5de225fd667610e2979fc1f0c2151
react-native-cameraroll: 3301d62d45616ee9da55ceed04be8d788c3de3ef
react-native-config: 7cd105e71d903104e8919261480858940a6b9c0e
react-native-document-picker: 3599b238843369026201d2ef466df53f77ae0452
react-native-geolocation: 0f7fe8a4c2de477e278b0365cce27d089a8c5903
Expand Down
12 changes: 7 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52",
"@onfido/react-native-sdk": "10.6.0",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-native-camera-roll/camera-roll": "5.4.0",
"@react-native-camera-roll/camera-roll": "7.4.0",
"@react-native-clipboard/clipboard": "^1.13.2",
"@react-native-community/geolocation": "^3.0.6",
"@react-native-community/netinfo": "11.2.1",
Expand Down
15 changes: 0 additions & 15 deletions patches/@react-native-camera-roll+camera-roll+5.4.0.patch

This file was deleted.

34 changes: 34 additions & 0 deletions patches/@react-native-camera-roll+camera-roll+7.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle
index 6891fa3..8397f95 100644
--- a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle
+++ b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle
@@ -81,7 +81,9 @@ def findNodeModulePath(baseDir, packageName) {
}

def resolveReactNativeDirectory() {
- def reactNative = file("${findNodeModulePath(rootProject.projectDir, "react-native")}")
+ def projectDir = this.hasProperty('reactNativeProject') ? this.reactNativeProject : rootProject.projectDir
+ def modulePath = file(projectDir);
+ def reactNative = file("${findNodeModulePath(modulePath, 'react-native')}")
if (reactNative.exists()) {
return reactNative
}
diff --git a/node_modules/@react-native-camera-roll/camera-roll/ios/RNCCameraRoll.mm b/node_modules/@react-native-camera-roll/camera-roll/ios/RNCCameraRoll.mm
index 4769d28..ef88a07 100644
--- a/node_modules/@react-native-camera-roll/camera-roll/ios/RNCCameraRoll.mm
+++ b/node_modules/@react-native-camera-roll/camera-roll/ios/RNCCameraRoll.mm
@@ -207,6 +207,14 @@ static void requestPhotoLibraryAccess(RCTPromiseRejectBlock reject, PhotosAuthor
options.fetchLimit = 1;
PHFetchResult<PHAsset *> *createdAsset = [PHAsset fetchAssetsWithLocalIdentifiers:@[placeholder.localIdentifier]
options:options];
+
+ if (![createdAsset isKindOfClass:[PHAsset class]]) {
+ resolve(@{
+ @"node": [NSNull null]
+ });
+ return;
+ }
+
if (createdAsset.count < 1) {
reject(kErrorUnableToSave, nil, nil);
return;
16 changes: 7 additions & 9 deletions src/libs/fileDownload/index.ios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {CameraRoll} from '@react-native-camera-roll/camera-roll';
import type {PhotoIdentifier} from '@react-native-camera-roll/camera-roll';
import RNFetchBlob from 'react-native-blob-util';
import CONST from '@src/CONST';
import * as FileUtils from './FileUtils';
Expand Down Expand Up @@ -29,16 +30,16 @@ function downloadFile(fileUrl: string, fileName: string) {
* Download the image to photo lib in iOS
*/
function downloadImage(fileUrl: string) {
return CameraRoll.save(fileUrl);
return CameraRoll.saveAsset(fileUrl);
}

/**
* Download the video to photo lib in iOS
*/
function downloadVideo(fileUrl: string, fileName: string): Promise<string> {
function downloadVideo(fileUrl: string, fileName: string): Promise<PhotoIdentifier> {
return new Promise((resolve, reject) => {
let documentPathUri: string | null = null;
let cameraRollUri: string | null = null;
let cameraRollAsset: PhotoIdentifier;

// Because CameraRoll doesn't allow direct downloads of video with remote URIs, we first download as documents, then copy to photo lib and unlink the original file.
downloadFile(fileUrl, fileName)
Expand All @@ -47,20 +48,17 @@ function downloadVideo(fileUrl: string, fileName: string): Promise<string> {
if (!documentPathUri) {
throw new Error('Error downloading video');
}
return CameraRoll.save(documentPathUri);
return CameraRoll.saveAsset(documentPathUri);
})
.then((attachment) => {
cameraRollUri = attachment;
cameraRollAsset = attachment;
if (!documentPathUri) {
throw new Error('Error downloading video');
}
return RNFetchBlob.fs.unlink(documentPathUri);
})
.then(() => {
if (!cameraRollUri) {
throw new Error('Error downloading video');
}
resolve(cameraRollUri);
resolve(cameraRollAsset);
})
.catch((err) => reject(err));
});
Expand Down