Add support for oversize text messages sent as attachments.
// FREEBIE
This commit is contained in:
parent
334912a48f
commit
75fabe5c25
@ -4,6 +4,7 @@
|
||||
|
||||
extern NSString *const OWSMimeTypeApplicationOctetStream;
|
||||
extern NSString *const OWSMimeTypeImagePng;
|
||||
extern NSString *const OWSMimeTypeOversizeTextMessage;
|
||||
|
||||
@interface MIMETypeUtil : NSObject
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
NSString *const OWSMimeTypeApplicationOctetStream = @"application/octet-stream";
|
||||
NSString *const OWSMimeTypeImagePng = @"image/png";
|
||||
NSString *const OWSMimeTypeOversizeTextMessage = @"text/x-signal-plain";
|
||||
|
||||
@implementation MIMETypeUtil
|
||||
|
||||
@ -291,6 +292,8 @@ NSString *const OWSMimeTypeImagePng = @"image/png";
|
||||
return [MIMETypeUtil filePathForAnimated:uniqueId ofMIMEType:contentType inFolder:folder];
|
||||
} else if ([self isBinaryData:contentType]) {
|
||||
return [MIMETypeUtil filePathForBinaryData:uniqueId ofMIMEType:contentType inFolder:folder];
|
||||
} else if ([contentType isEqualToString:OWSMimeTypeOversizeTextMessage]) {
|
||||
return [MIMETypeUtil filePathForOversizeTextMessage:uniqueId inFolder:folder];
|
||||
}
|
||||
|
||||
DDLogError(@"Got asked for path of file %@ which is unsupported", contentType);
|
||||
@ -344,6 +347,13 @@ NSString *const OWSMimeTypeImagePng = @"image/png";
|
||||
stringByAppendingPathExtension:[self getSupportedExtensionFromBinaryDataMIMEType:contentType]];
|
||||
}
|
||||
|
||||
+ (NSString *)filePathForOversizeTextMessage:(NSString *)uniqueId inFolder:(NSString *)folder {
|
||||
// This file extension is arbitrary - it should never be exposed to the user or
|
||||
// be used outside the app.
|
||||
return [[folder stringByAppendingFormat:@"/%@", uniqueId]
|
||||
stringByAppendingPathExtension:@"signal-text-message"];
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
+ (NSString *)getSupportedImageMIMETypeFromImage:(UIImage *)image {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user