|
|
|
@ -22,6 +22,7 @@ NSString *const OWSMimeTypeImageBmp2 = @"image/x-windows-bmp";
|
|
|
|
|
NSString *const OWSMimeTypeOversizeTextMessage = @"text/x-signal-plain";
|
|
|
|
|
NSString *const OWSMimeTypeUnknownForTests = @"unknown/mimetype";
|
|
|
|
|
NSString *const OWSMimeTypeApplicationZip = @"application/zip";
|
|
|
|
|
NSString *const OWSMimeTypeApplicationPdf = @"application/pdf";
|
|
|
|
|
|
|
|
|
|
NSString *const kOversizeTextAttachmentUTI = @"org.whispersystems.oversize-text-attachment";
|
|
|
|
|
NSString *const kOversizeTextAttachmentFileExtension = @"txt";
|
|
|
|
@ -278,6 +279,53 @@ NSString *const kSyncMessageFileExtension = @"bin";
|
|
|
|
|
return [MIMETypeUtil isSupportedAudioMIMEType:contentType];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (BOOL)isText:(NSString *)contentType {
|
|
|
|
|
return [
|
|
|
|
|
@[
|
|
|
|
|
@"text/plain",
|
|
|
|
|
@"text/csv",
|
|
|
|
|
@"text/tab-separated-values"
|
|
|
|
|
]
|
|
|
|
|
containsObject:contentType
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (BOOL)isMicrosoftDoc:(NSString *)contentType {
|
|
|
|
|
return [
|
|
|
|
|
@[
|
|
|
|
|
// Word files
|
|
|
|
|
@"application/msword",
|
|
|
|
|
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
|
|
|
@"application/vnd.ms-word.document.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-word.template.macroEnabled.12",
|
|
|
|
|
|
|
|
|
|
// Excel files
|
|
|
|
|
@"application/vnd.ms-excel",
|
|
|
|
|
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
|
|
|
@"application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-excel.template.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-excel.addin.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-excel.sheet.binary.macroEnabled.12",
|
|
|
|
|
|
|
|
|
|
// Powerpoint files
|
|
|
|
|
@"application/vnd.ms-powerpoint",
|
|
|
|
|
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
|
|
|
@"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
|
|
|
@"application/vnd.ms-powerpoint.addin.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-powerpoint.template.macroEnabled.12",
|
|
|
|
|
@"application/vnd.ms-powerpoint.slideshow.macroEnabled.12"
|
|
|
|
|
]
|
|
|
|
|
containsObject:contentType
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (BOOL)isVisualMedia:(NSString *)contentType
|
|
|
|
|
{
|
|
|
|
|
if ([self isImage:contentType]) {
|
|
|
|
|