From 984f732324ee53d44dd10bb9ece1eebcfa9680f7 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 23 Oct 2019 13:35:15 +1100 Subject: [PATCH] Enable file attachments --- .../ConversationView/ConversationViewController.m | 2 +- SignalServiceKit/src/Messages/OWSMessageSender.m | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 74d46601b1b..0f6f822e430 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3513,7 +3513,6 @@ - (void)attachmentButtonPressed [gifAction setValue:gifImage forKey:@"image"]; [actionSheet addAction:gifAction]; - /* UIAlertAction *chooseDocumentAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_DOCUMENT_PICKER_BUTTON", @"action sheet button title when choosing attachment type") @@ -3527,6 +3526,7 @@ - (void)attachmentButtonPressed [chooseDocumentAction setValue:chooseDocumentImage forKey:@"image"]; [actionSheet addAction:chooseDocumentAction]; + /* if (kIsSendingContactSharesEnabled) { UIAlertAction *chooseContactAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"ATTACHMENT_MENU_CONTACT_BUTTON", diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index 39311a02d3a..888eed42ebb 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -1221,7 +1221,9 @@ - (void)sendMessage:(OWSMessageSend *)messageSend for (NSString *attachmentID in message.attachmentIds) { TSAttachmentStream *attachment = [TSAttachmentStream fetchObjectWithUniqueID:attachmentID]; if (attachment == nil) { continue; } - [groupMessage addAttachmentWithKind:@"attachment" server:publicChat.server serverID:attachment.serverId contentType:attachment.contentType size:attachment.byteCount fileName:attachment.sourceFilename flags:0 width:@(attachment.imageSize.width).unsignedIntegerValue height:@(attachment.imageSize.height).unsignedIntegerValue caption:attachment.caption url:attachment.downloadURL linkPreviewURL:nil linkPreviewTitle:nil]; + NSUInteger width = attachment.shouldHaveImageSize ? @(attachment.imageSize.width).unsignedIntegerValue : 0; + NSUInteger height = attachment.shouldHaveImageSize ? @(attachment.imageSize.height).unsignedIntegerValue : 0; + [groupMessage addAttachmentWithKind:@"attachment" server:publicChat.server serverID:attachment.serverId contentType:attachment.contentType size:attachment.byteCount fileName:attachment.sourceFilename flags:0 width:width height:height caption:attachment.caption url:attachment.downloadURL linkPreviewURL:nil linkPreviewTitle:nil]; } [[LKPublicChatAPI sendMessage:groupMessage toGroup:publicChat.channel onServer:publicChat.server] .thenOn(OWSDispatch.sendingQueue, ^(LKGroupMessage *groupMessage) {