diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 44a494465..4a7981bd8 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2815,7 +2815,7 @@ typedef enum : NSUInteger { } } -- (void)sendMessageAttachments:(NSArray *)attachments +- (void)sendMessageAttachments:(NSArray *)attachments messageText:(nullable NSString *)messageText { OWSAssertIsOnMainThread(); for (SignalAttachment *attachment in attachments) { @@ -2824,8 +2824,9 @@ typedef enum : NSUInteger { } BOOL didAddToProfileWhitelist = [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread]; + TSOutgoingMessage *message = [ThreadUtil enqueueMessageWithAttachments:attachments - messageBody:nil + messageBody:messageText inThread:self.thread quotedReplyModel:self.inputToolbar.quotedReply]; @@ -3546,7 +3547,7 @@ typedef enum : NSUInteger { } if (skipApprovalDialog) { - [self sendMessageAttachments:attachments]; + [self sendMessageAttachments:attachments messageText:nil]; } else { OWSNavigationController *modal = [AttachmentApprovalViewController wrappedInNavControllerWithAttachments:attachments @@ -3662,8 +3663,9 @@ typedef enum : NSUInteger { - (void)attachmentApproval:(AttachmentApprovalViewController *)attachmentApproval didApproveAttachments:(NSArray *)attachments + messageText:(nullable NSString *)messageText { - [self sendMessageAttachments:attachments]; + [self sendMessageAttachments:attachments messageText:messageText]; [self dismissViewControllerAnimated:YES completion:nil]; // We always want to scroll to the bottom of the conversation after the local user // sends a message. Normally, this is taken care of in yapDatabaseModified:, but diff --git a/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift b/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift index e12babbc8..06e76d7e2 100644 --- a/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift +++ b/SignalMessaging/ViewControllers/AttachmentApprovalViewController.swift @@ -8,7 +8,7 @@ import MediaPlayer @objc public protocol AttachmentApprovalViewControllerDelegate: class { - func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, didApproveAttachments attachments: [SignalAttachment]) + func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, didApproveAttachments attachments: [SignalAttachment], messageText: String?) func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, didCancelAttachments attachments: [SignalAttachment]) } @@ -326,11 +326,14 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC captioningToolbar.isUserInteractionEnabled = false captioningToolbar.isHidden = true - approvalDelegate?.attachmentApproval(self, didApproveAttachments: attachments) + approvalDelegate?.attachmentApproval(self, didApproveAttachments: attachments, messageText: captioningToolbar.captionText) } func captioningToolbar(_ captioningToolbar: CaptioningToolbar, textViewDidChange textView: UITextView) { - currentItem.attachment.captionText = textView.text + // For 2.32.0 we only have one input bar - and it's for mesageBody text, not for caption text. + // For 2.33.0 there are potentially two input bars - one for message body and one for caption text. + // Commenting this out for now, but we'll have to resolve this merge conflict when RI'ing to 2.33 + // currentItem.attachment.captionText = textView.text } }