Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 2f40e3734e
commit 3765d28da9

@ -33,14 +33,12 @@ class OversizeTextMessageViewController: UIViewController {
assert(false) assert(false)
return nil return nil
} }
let attachmentIDRaw = message.attachmentIds[0] guard let attachmentID = message.attachmentIds[0] as? String else {
guard attachmentIDRaw is String else {
Logger.error("\(TAG) message attachment id is not a string.") Logger.error("\(TAG) message attachment id is not a string.")
assert(false) assert(false)
return nil return nil
} }
let attachmentID = attachmentIDRaw as! String guard let attachment = TSAttachment.fetch(withUniqueID:attachmentID) as? TSAttachmentStream else {
guard let attachment = TSAttachment.fetch(withUniqueID:attachmentID) else {
Logger.error("\(TAG) could not load attachment.") Logger.error("\(TAG) could not load attachment.")
assert(false) assert(false)
return nil return nil
@ -50,13 +48,7 @@ class OversizeTextMessageViewController: UIViewController {
assert(false) assert(false)
return nil return nil
} }
guard attachment is TSAttachmentStream else { return attachment
Logger.error("\(TAG) attachment has unexpected type.")
assert(false)
return nil
}
let stream = attachment as! TSAttachmentStream
return stream
} }
private func attachmentData() -> Data? { private func attachmentData() -> Data? {
@ -112,7 +104,9 @@ class OversizeTextMessageViewController: UIViewController {
let textView = UITextView() let textView = UITextView()
textView.textColor = UIColor.black textView.textColor = UIColor.black
textView.text = displayText() textView.text = displayText()
textView.font = UIFont.ows_regularFont(withSize:14) textView.font = UIFont.ows_dynamicTypeBody()
textView.isEditable = false
textView.textContainerInset = UIEdgeInsets(top: 8, left: 4, bottom: 8, right: 4)
self.view.addSubview(textView) self.view.addSubview(textView)
textView.autoPinWidthToSuperview() textView.autoPinWidthToSuperview()
textView.autoPin(toTopLayoutGuideOf : self, withInset: 0) textView.autoPin(toTopLayoutGuideOf : self, withInset: 0)
@ -144,7 +138,7 @@ class OversizeTextMessageViewController: UIViewController {
assert(false) assert(false)
return return
} }
AttachmentSharing.showShareUI(for:attachment.mediaURL()) AttachmentSharing.showShareUI(for:attachment.mediaURL())
} }
} }

Loading…
Cancel
Save