TF-629 Add list of supported mimeType in Android and iOS
This commit is contained in:
committed by
Dat H. Pham
parent
34f3cfd6b1
commit
40a470dc21
@@ -0,0 +1,13 @@
|
||||
import 'package:core/domain/preview/document_uti.dart';
|
||||
import 'package:core/domain/preview/supported_preview_file_types.dart';
|
||||
import 'package:http_parser/http_parser.dart';
|
||||
|
||||
extension MediaTypeExtension on MediaType {
|
||||
bool isAndroidSupportedPreview() => SupportedPreviewFileTypes.androidSupportedTypes.contains(mimeType);
|
||||
|
||||
bool isIOSSupportedPreview() => SupportedPreviewFileTypes.iOSSupportedTypes.containsKey(mimeType);
|
||||
|
||||
bool isImageFile() => SupportedPreviewFileTypes.imageMimeTypes.contains(mimeType);
|
||||
|
||||
DocumentUti getDocumentUti() => DocumentUti(SupportedPreviewFileTypes.iOSSupportedTypes[mimeType]);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class DocumentUti with EquatableMixin{
|
||||
final String? value;
|
||||
|
||||
DocumentUti(this.value);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [value];
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
class SupportedPreviewFileTypes {
|
||||
static const imageMimeTypes = [
|
||||
'image/bmp',
|
||||
'image/jpeg',
|
||||
'image/gif',
|
||||
'image/png',];
|
||||
|
||||
static const iOSSupportedTypes = {
|
||||
'text/plain' : 'public.plain-text',
|
||||
'text/html' : 'public.html',
|
||||
'video/x-msvideo' : 'public.avi',
|
||||
'video/mpeg' : 'public.mpeg',
|
||||
'video/mp4' : 'public.mpeg-4',
|
||||
'video/3gpp' : 'public.3gpp',
|
||||
'video/quicktime' : 'public.mpeg-4',
|
||||
'audio/mpeg' : 'public.mp3',
|
||||
'audio/wav' : 'com.microsoft.waveform-audio',
|
||||
'audio/x-ms-wmv' : 'com.microsoft.windows-media-wmv',
|
||||
'image/jpeg' : 'public.jpeg',
|
||||
'image/png' : 'public.png',
|
||||
'image/gif' : 'com.compuserve.gif',
|
||||
'image/bmp' : 'com.microsoft.bmp',
|
||||
'image/vnd.microsoft.icon' : 'com.microsoft.ico',
|
||||
'application/zip' : 'com.pkware.zip-archive',
|
||||
'application/rtf' : 'public.rtf',
|
||||
'application/xml' : 'public.xml',
|
||||
'application/x-tar' : 'public.tar-archive',
|
||||
'application/gzip' : 'org.gnu.gnu-zip-archive',
|
||||
'application/x-compressed' : 'org.gnu.gnu-zip-tar-archive',
|
||||
'application/msword' : 'com.microsoft.word.doc',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' : 'com.microsoft.word.doc',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' : 'com.microsoft.excel.xls',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation' : 'com.microsoft.powerpoint.ppt',
|
||||
'application/pdf' : 'com.adobe.pdf',
|
||||
};
|
||||
|
||||
static const androidSupportedTypes = [
|
||||
'image/bmp',
|
||||
'image/jpeg',
|
||||
'image/gif',
|
||||
'image/png',
|
||||
'text/plain',
|
||||
'text/html',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/msword',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.ms-outlook',
|
||||
'application/vnd.ms-works',
|
||||
'application/vnd.mpohun.certificate',
|
||||
'application/vnd.android.package-archive',
|
||||
'application/octet-stream',
|
||||
'application/x-tar',
|
||||
'application/x-gtar',
|
||||
'application/x-gzip',
|
||||
'application/x-javascript',
|
||||
'application/x-compressed',
|
||||
'application/x-zip-compressed',
|
||||
'application/java-archive',
|
||||
'application/pdf',
|
||||
'application/rtf',
|
||||
'audio/x-mpegurl',
|
||||
'video/x-m4v',
|
||||
'video/x-ms-asf',
|
||||
'video/x-msvideo',
|
||||
'audio/x-mpeg',
|
||||
'audio/mp4a-latm',
|
||||
'video/vnd.mpegurl',
|
||||
'video/quicktime',
|
||||
'video/mp4',
|
||||
'video/3gpp',
|
||||
'video/mpeg',
|
||||
'audio/mpeg',
|
||||
'audio/ogg',
|
||||
'audio/x-pn-realaudio',
|
||||
'audio/x-wav',
|
||||
'audio/x-ms-wma',
|
||||
'audio/x-ms-wmv',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user