diff --git a/app/components/file_upload_preview/file_upload_preview.js b/app/components/file_upload_preview/file_upload_preview.js index d3425ebea..e53b14b93 100644 --- a/app/components/file_upload_preview/file_upload_preview.js +++ b/app/components/file_upload_preview/file_upload_preview.js @@ -15,6 +15,7 @@ import Icon from 'react-native-vector-icons/Ionicons'; import {RequestStatus} from 'mattermost-redux/constants'; import FileAttachmentImage from 'app/components/file_attachment_list/file_attachment_image'; +import FileAttachmentIcon from 'app/components/file_attachment_list/file_attachment_icon'; import KeyboardLayout from 'app/components/layout/keyboard_layout'; const {height: deviceHeight} = Dimensions.get('window'); @@ -33,6 +34,7 @@ export default class FileUploadPreview extends PureComponent { files: PropTypes.array.isRequired, inputHeight: PropTypes.number.isRequired, rootId: PropTypes.string, + theme: PropTypes.object.isRequired, uploadFileRequestStatus: PropTypes.string.isRequired }; @@ -46,17 +48,30 @@ export default class FileUploadPreview extends PureComponent { buildFilePreviews = () => { return this.props.files.map((file) => { + let filePreviewComponent; + if (file.loading | file.has_preview_image) { + filePreviewComponent = ( + + ); + } else { + filePreviewComponent = ( + + ); + } return ( - + {filePreviewComponent} {file.failed && { if (response.error) { return; @@ -264,6 +268,26 @@ class PostTextbox extends PureComponent { }); }; + attachVideoFromLibraryAndroid = () => { + this.props.navigator.dismissModal({ + animationType: 'none' + }); + + const options = { + quality: 0.7, + mediaType: 'video', + noData: true + }; + + ImagePicker.launchImageLibrary(options, (response) => { + if (response.error) { + return; + } + + this.uploadFiles([response]); + }); + } + uploadFiles = (images) => { this.props.actions.handleUploadFiles(images, this.props.rootId); }; @@ -288,6 +312,17 @@ class PostTextbox extends PureComponent { }] }; + if (Platform.OS === 'android') { + options.items.push({ + action: this.attachVideoFromLibraryAndroid, + text: { + id: 'mobile.file_upload.video', + defaultMessage: 'Video Libary' + }, + icon: 'file-video-o' + }); + } + this.props.navigator.showModal({ screen: 'OptionsModal', title: '', diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index e8e4db8c0..7d8e37c09 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -1709,6 +1709,7 @@ "mobile.file_upload.camera": "Take Photo or Video", "mobile.file_upload.library": "Photo Library", "mobile.file_upload.more": "More", + "mobile.file_upload.video": "Video Libary", "mobile.help.title": "Help", "mobile.intro_messages.DM": "This is the start of your direct message history with {teammate}. Direct messages and files shared here are not shown to people outside this area.", "mobile.intro_messages.default_message": "This is the first channel teammates see when they sign up - use it for posting updates everyone needs to know.",