Private
Public Access
1
0

Adds support for image previews

Just need to append ?preview=1 to attachment fetch operation.
This commit is contained in:
James Magahern
2022-12-20 16:29:26 -08:00
parent ba8f76f4bd
commit 3082c4ab19
6 changed files with 144 additions and 12 deletions

View File

@@ -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;
}
}