Adds support for image previews
Just need to append ?preview=1 to attachment fetch operation.
This commit is contained in:
@@ -21,16 +21,27 @@
|
||||
|
||||
if ([self fileTransferGUIDs]) {
|
||||
// Support only images right now
|
||||
NSMutableDictionary *attachmentMetadatas = [NSMutableDictionary dictionary];
|
||||
NSMutableArray *filteredFileTransferGUIDs = [NSMutableArray array];
|
||||
for (NSString *guid in self.fileTransferGUIDs) {
|
||||
NSMutableDictionary *metadata = [NSMutableDictionary dictionary];
|
||||
IMFileTransfer *transfer = [[IMFileTransferCenter sharedInstance] transferForGUID:guid];
|
||||
if ([[transfer mimeType] containsString:@"image"]) {
|
||||
[filteredFileTransferGUIDs addObject:guid];
|
||||
|
||||
if ([transfer attributionInfo] != nil) {
|
||||
metadata[@"attributionInfo"] = [transfer attributionInfo];
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata.count) {
|
||||
attachmentMetadatas[guid] = metadata;
|
||||
}
|
||||
}
|
||||
|
||||
if ([filteredFileTransferGUIDs count]) {
|
||||
messageDict[@"fileTransferGUIDs"] = filteredFileTransferGUIDs;
|
||||
messageDict[@"attachmentMetadata"] = attachmentMetadatas;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user