...
 
Commits (2)
......@@ -32,7 +32,7 @@ export default class AttachmentStore {
if (this.transcoding) {
return;
}
console.log('ATTACHING', media, extra);
if (this.uploading) {
// abort current upload
this.cancelCurrentUpload();
......@@ -52,26 +52,34 @@ export default class AttachmentStore {
this.setHasAttachment(true);
// correctly handle videos from ph:// paths on ios
if (
Platform.OS === 'ios' &&
media.type === 'video' &&
media.uri.startsWith('ph://')
) {
try {
this.transcoding = true;
const converted = await RNConvertPhAsset.convertVideoFromUrl({
url: media.uri,
convertTo: 'm4v',
quality: 'high',
});
media.type = converted.mimeType;
media.uri = converted.path;
media.filename = converted.filename;
} catch (error) {
Alert.alert('Error reading the video', 'Please try again');
} finally {
this.transcoding = false;
if (Platform.OS === 'ios') {
// correctly handle videos from ph:// paths on ios
if (media.type === 'video' && media.uri.startsWith('ph://')) {
try {
this.transcoding = true;
const converted = await RNConvertPhAsset.convertVideoFromUrl({
url: media.uri,
convertTo: 'm4v',
quality: 'high',
});
media.type = converted.mimeType;
media.uri = converted.path;
media.filename = converted.filename;
} catch (error) {
Alert.alert('Error reading the video', 'Please try again');
} finally {
this.transcoding = false;
}
}
// fix camera roll gif issue
if (media.type === 'image' && media.fileName) {
const extension = media.fileName.split('.').pop();
if (extension && extension.toLowerCase() === 'gif') {
media.type = 'image/gif';
const appleId = media.uri.substring(5, 41);
media.uri = `assets-library://asset/asset.GIF?id=${appleId}&ext=GIF`;
}
}
}
......
......@@ -925,7 +925,7 @@
resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.6.2.tgz#a19ca7149c4dfe8216f2330e6b1ebfe2d075ef92"
integrity sha512-EJGsbrHubK1mGxPjWB74AaHAd5m9I+Gg2RRPZzMK6org7QOU9WOBnIMFqoeVto3hKOaEPlk8NV74H6G34/2pZQ==
"@react-native-community/cameraroll@^1.2.1":
"@react-native-community/cameraroll@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-1.3.0.tgz#a340334440f4d08280da839130ef51c931b07483"
integrity sha512-QJl9N34euvGU7s/Gn6jhsqi70O4SmxFxuy+yBnW7ehE8qtPYO91gyLLrtiWdTfYvuVCUNvX/G0LKJQLm8SojAA==
......