[FIX] Unable to save attachment on iOS (#2743)

* Fix rn-fetch-blob's document dir without forward slash

* Update camera roll
This commit is contained in:
Diego Mello 2020-12-24 10:12:31 -03:00 committed by GitHub
parent fec1741275
commit a2bf0f013f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 12 deletions

View File

@ -119,7 +119,8 @@ class AttachmentView extends React.Component {
this.setState({ loading: true }); this.setState({ loading: true });
try { try {
const extension = image_url ? `.${ mime.extension(image_type) || 'jpg' }` : `.${ mime.extension(video_type) || 'mp4' }`; const extension = image_url ? `.${ mime.extension(image_type) || 'jpg' }` : `.${ mime.extension(video_type) || 'mp4' }`;
const path = `${ RNFetchBlob.fs.dirs.DocumentDir + SHA256(url) + extension }`; const documentDir = `${ RNFetchBlob.fs.dirs.DocumentDir }/`;
const path = `${ documentDir + SHA256(url) + extension }`;
const file = await RNFetchBlob.config({ path }).fetch('GET', mediaAttachment).then(res => res.path()); const file = await RNFetchBlob.config({ path }).fetch('GET', mediaAttachment).then(res => res.path());
await CameraRoll.save(file, { album: 'Rocket.Chat' }); await CameraRoll.save(file, { album: 'Rocket.Chat' });
EventEmitter.emit(LISTENER, { message: I18n.t('saved_to_gallery') }); EventEmitter.emit(LISTENER, { message: I18n.t('saved_to_gallery') });

View File

@ -368,7 +368,7 @@ PODS:
- React - React
- react-native-blur (0.8.0): - react-native-blur (0.8.0):
- React - React
- react-native-cameraroll (4.0.0): - react-native-cameraroll (4.0.1):
- React - React
- react-native-cookies (4.0.0): - react-native-cookies (4.0.0):
- React - React
@ -939,7 +939,7 @@ SPEC CHECKSUMS:
react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa
react-native-background-timer: 1f7d560647b40e6a60b01c452ba29c54bf581fc4 react-native-background-timer: 1f7d560647b40e6a60b01c452ba29c54bf581fc4
react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c
react-native-cameraroll: ae0a7c0cc8462508855707ff623b1e789b692865 react-native-cameraroll: 60ba0068826eab1c8d43146191bafd4363ea58a7
react-native-cookies: d79e5015a5d3a38e08f5cb39c4948532be7e9c2b react-native-cookies: d79e5015a5d3a38e08f5cb39c4948532be7e9c2b
react-native-document-picker: 825552b827012282baf4b7cbf119d3b37a280c90 react-native-document-picker: 825552b827012282baf4b7cbf119d3b37a280c90
react-native-jitsi-meet: f2407aca85566e031ee7b222e497ee5ecb6623de react-native-jitsi-meet: f2407aca85566e031ee7b222e497ee5ecb6623de

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-cameraroll", "name": "react-native-cameraroll",
"version": "4.0.0", "version": "4.0.1",
"summary": "React Native Camera Roll for iOS & Android", "summary": "React Native Camera Roll for iOS & Android",
"license": "MIT", "license": "MIT",
"authors": "Bartol Karuza <bartol.k@gmail.com>", "authors": "Bartol Karuza <bartol.k@gmail.com>",
@ -10,7 +10,7 @@
}, },
"source": { "source": {
"git": "https://github.com/react-native-community/react-native-cameraroll.git", "git": "https://github.com/react-native-community/react-native-cameraroll.git",
"tag": "v4.0.0" "tag": "v4.0.1"
}, },
"source_files": "ios/**/*.{h,m}", "source_files": "ios/**/*.{h,m}",
"dependencies": { "dependencies": {

View File

@ -368,7 +368,7 @@ PODS:
- React - React
- react-native-blur (0.8.0): - react-native-blur (0.8.0):
- React - React
- react-native-cameraroll (4.0.0): - react-native-cameraroll (4.0.1):
- React - React
- react-native-cookies (4.0.0): - react-native-cookies (4.0.0):
- React - React
@ -939,7 +939,7 @@ SPEC CHECKSUMS:
react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa
react-native-background-timer: 1f7d560647b40e6a60b01c452ba29c54bf581fc4 react-native-background-timer: 1f7d560647b40e6a60b01c452ba29c54bf581fc4
react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c
react-native-cameraroll: ae0a7c0cc8462508855707ff623b1e789b692865 react-native-cameraroll: 60ba0068826eab1c8d43146191bafd4363ea58a7
react-native-cookies: d79e5015a5d3a38e08f5cb39c4948532be7e9c2b react-native-cookies: d79e5015a5d3a38e08f5cb39c4948532be7e9c2b
react-native-document-picker: 825552b827012282baf4b7cbf119d3b37a280c90 react-native-document-picker: 825552b827012282baf4b7cbf119d3b37a280c90
react-native-jitsi-meet: f2407aca85566e031ee7b222e497ee5ecb6623de react-native-jitsi-meet: f2407aca85566e031ee7b222e497ee5ecb6623de

View File

@ -29,7 +29,7 @@
"@react-native-community/art": "^1.2.0", "@react-native-community/art": "^1.2.0",
"@react-native-community/async-storage": "1.11.0", "@react-native-community/async-storage": "1.11.0",
"@react-native-community/blur": "^3.6.0", "@react-native-community/blur": "^3.6.0",
"@react-native-community/cameraroll": "4.0.0", "@react-native-community/cameraroll": "^4.0.1",
"@react-native-community/cookies": "^4.0.0", "@react-native-community/cookies": "^4.0.0",
"@react-native-community/datetimepicker": "2.6.0", "@react-native-community/datetimepicker": "2.6.0",
"@react-native-community/hooks": "2.6.0", "@react-native-community/hooks": "2.6.0",

View File

@ -1967,10 +1967,10 @@
dependencies: dependencies:
prop-types "^15.5.10" prop-types "^15.5.10"
"@react-native-community/cameraroll@4.0.0": "@react-native-community/cameraroll@^4.0.1":
version "4.0.0" version "4.0.1"
resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-4.0.0.tgz#97a4be5d01bc05c387c26599ffa559e1b425e415" resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-4.0.1.tgz#8466f99a476e6b833ecd5efff045f74a4224459b"
integrity sha512-ZqzWbNHklgq/sPUmlDgi/SvfbkIVKNYXhcDGRcabXRsX9aIyNEX2dk2fkCSJoKWqBF8uSUnVznonpTP3TlwdyQ== integrity sha512-KLKh5rAg511KUoGKHrbRhBLvkHhOz6kZ2sx8dPhndZ5ZFVYfVpTadSN1x3cfQbOAlkyGZql07p1hk7lEb3sa8g==
"@react-native-community/cli-debugger-ui@^4.13.1": "@react-native-community/cli-debugger-ui@^4.13.1":
version "4.13.1" version "4.13.1"