* Viewing Files in Edit mode in mobile with ability to delete and save * Added upload attachment to keyboard tracker view * using state instread of use ref * Minor * Added tests * intl extract * new function getFiles ById, batch file deletion and tests * Files fetching in edit options and tests * Removed DeviceEventEmitter and used React context * Added support to check minimum required version to show edit file attachments * resolve forward ref issue * Minor * memotized props for context and observe config with value * Import fixes * Ability to show quick action and add files to edit post * type safety for EditPostContext * Reverted back the post priority props * constant shift * Added test for QuickAction to show slashcomand * Added test for edit_post, upload_item and upload_remove * Added test for Edit_post_input and edit_post index * fix the height issue between attachment and keyboard due to safeArea * Minor: removed debugging border color * Addressed dev review comments * Import fixes * Address UX comments * Fixed props for UploadItem and remove effective Edit mode * handled save button disabled state when uploading attachments * handled newly added and retry file removal without alert message * Test updated * Added test for input_quick_action index.tsx * Added test for not in edit mode for upload_item index * Added test for upload_remove component when not in edit mode * added tests for file_upload_error hook * Added test for calling callback when in edit mode * Test for edit post input for server version check
52 lines
2.5 KiB
TypeScript
52 lines
2.5 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {toMilliseconds} from '@utils/datetime';
|
|
|
|
export const VALID_IMAGE_MIME_TYPES = [
|
|
'image/jpeg',
|
|
'image/jpeg',
|
|
'image/jpg',
|
|
'image/jp_',
|
|
'application/jpg',
|
|
'application/x-jpg',
|
|
'image/pjpeg',
|
|
'image/pipeg',
|
|
'image/vnd.swiftview-jpeg',
|
|
'image/x-xbitmap',
|
|
'image/png',
|
|
'application/png',
|
|
'application/x-png',
|
|
'image/bmp',
|
|
'image/x-bmp',
|
|
'image/x-bitmap',
|
|
'image/x-xbitmap',
|
|
'image/x-win-bitmap',
|
|
'image/x-windows-bmp',
|
|
'image/ms-bmp',
|
|
'image/x-ms-bmp',
|
|
'application/bmp',
|
|
'application/x-bmp',
|
|
'application/x-win-bitmap',
|
|
] as const;
|
|
|
|
export const Files: Record<string, string[]> = {
|
|
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'],
|
|
CODE_TYPES: ['as', 'applescript', 'osascript', 'scpt', 'bash', 'sh', 'zsh', 'clj', 'boot', 'cl2', 'cljc', 'cljs', 'cljs.hl', 'cljscm', 'cljx', 'hic', 'coffee', '_coffee', 'cake', 'cjsx', 'cson', 'iced', 'cpp', 'c', 'cc', 'h', 'c++', 'h++', 'hpp', 'cs', 'csharp', 'css', 'd', 'di', 'dart', 'delphi', 'dpr', 'dfm', 'pas', 'pascal', 'freepascal', 'lazarus', 'lpr', 'lfm', 'diff', 'django', 'jinja', 'dockerfile', 'docker', 'erl', 'f90', 'f95', 'fsharp', 'fs', 'gcode', 'nc', 'go', 'groovy', 'handlebars', 'hbs', 'html.hbs', 'html.handlebars', 'hs', 'hx', 'java', 'jsp', 'js', 'jsx', 'json', 'jl', 'kt', 'ktm', 'kts', 'less', 'lisp', 'lua', 'mk', 'mak', 'md', 'mkdown', 'mkd', 'matlab', 'm', 'mm', 'objc', 'obj-c', 'ml', 'perl', 'pl', 'php', 'php3', 'php4', 'php5', 'php6', 'ps', 'ps1', 'pp', 'py', 'gyp', 'r', 'ruby', 'rb', 'gemspec', 'podspec', 'thor', 'irb', 'rs', 'scala', 'scm', 'sld', 'scss', 'st', 'sql', 'swift', 'ts', 'tex', 'vbnet', 'vb', 'bas', 'vbs', 'v', 'veo', 'xml', 'html', 'xhtml', 'rss', 'atom', 'xsl', 'plist', 'yaml'],
|
|
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg', 'tiff', 'tif', 'svg', 'psd', 'xcf'],
|
|
PATCH_TYPES: ['patch'],
|
|
PDF_TYPES: ['pdf'],
|
|
PRESENTATION_TYPES: ['ppt', 'pptx', 'odp'],
|
|
SPREADSHEET_TYPES: ['xls', 'xlsx', 'csv', 'ods'],
|
|
TEXT_TYPES: ['txt', 'rtf'],
|
|
VIDEO_TYPES: ['mp4', 'avi', 'webm', 'mkv', 'wmv', 'mpg', 'mov', 'flv', 'ogm', 'mpeg'],
|
|
WORD_TYPES: ['doc', 'docx', 'odt'],
|
|
ZIP_TYPES: ['zip'],
|
|
};
|
|
Files.DOCUMENT_TYPES = Files.WORD_TYPES.concat(Files.PDF_TYPES, Files.TEXT_TYPES);
|
|
|
|
export const PROGRESS_TIME_TO_STORE = toMilliseconds({seconds: 60});
|
|
|
|
export const UPLOAD_ERROR_SHOW_INTERVAL = 5000;
|
|
|
|
export default Files;
|