From 2e8a53b4a5ec2835a82ece1acc19552a9fa9a9e7 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 11 Jan 2018 17:48:32 -0500 Subject: [PATCH] Don't add captions to text messages. --- .../AttachmentApprovalViewController.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SignalMessaging/attachments/AttachmentApprovalViewController.swift b/SignalMessaging/attachments/AttachmentApprovalViewController.swift index 33c6a0c588..23e0fe0d62 100644 --- a/SignalMessaging/attachments/AttachmentApprovalViewController.swift +++ b/SignalMessaging/attachments/AttachmentApprovalViewController.swift @@ -168,7 +168,9 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool topToolbar.items = [cancelButton] // Bottom Toolbar - let captioningToolbar = CaptioningToolbar() + // + // Don't add a caption to text messages. + let captioningToolbar = CaptioningToolbar(allowCaptions:!self.attachment.isOversizeText) captioningToolbar.captioningToolbarDelegate = self self.bottomToolbar = captioningToolbar @@ -557,6 +559,7 @@ class CaptioningToolbar: UIView, UITextViewDelegate { private let sendButton: UIButton private let textView: UITextView private let bottomGradient: GradientView + private let allowCaptions: Bool // Layout Constants var maxTextViewHeight: CGFloat { @@ -587,11 +590,12 @@ class CaptioningToolbar: UIView, UITextViewDelegate { } let kSendButtonShadowOffset: CGFloat = 1 - init() { + init(allowCaptions: Bool) { self.sendButton = UIButton(type: .system) self.bottomGradient = GradientView(from: UIColor.clear, to: UIColor.black) self.textView = MessageTextView() self.textViewHeight = kMinTextViewHeight + self.allowCaptions = allowCaptions super.init(frame: CGRect.zero) @@ -603,6 +607,9 @@ class CaptioningToolbar: UIView, UITextViewDelegate { textView.addBorder(with: UIColor.lightGray) textView.font = UIFont.ows_dynamicTypeBody() textView.returnKeyType = .done + if !allowCaptions { + textView.isHidden = true + } let sendTitle = NSLocalizedString("ATTACHMENT_APPROVAL_SEND_BUTTON", comment: "Label for 'send' button in the 'attachment approval' dialog.") sendButton.setTitle(sendTitle, for: .normal)