Jelajahi Sumber

adapt size of textual photo description

cyberta 5 tahun lalu
induk
melakukan
4a23f294d9

+ 2 - 1
deltachat-ios/DC/Wrapper.swift

@@ -476,7 +476,8 @@ class DcMsg: MessageType {
             if text.isEmpty {
                 return MessageKind.photo(Media(image: image))
             }
-            return MessageKind.photoText(Media(image: image, text: NSAttributedString(string: text)))
+            let attributedString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)])
+            return MessageKind.photoText(Media(image: image, text: attributedString))
         case .video:
             return MessageKind.video(Media(url: fileURL))
         default:

+ 1 - 4
deltachat-ios/MessageKit/Layout/TextMediaMessageSizeCalculator.swift

@@ -89,12 +89,9 @@ open class TextMediaMessageSizeCalculator: MessageSizeCalculator {
         let message = dataSource.messageForItem(at: indexPath, in: messagesLayout.messagesCollectionView)
 
         switch message.kind {
-        case .photoText(let textMediaItem):
+        case .photoText:
             attributes.messageLabelInsets = messageLabelInsets(for: message)
             attributes.messageLabelFont = messageLabelFont
-            guard !textMediaItem.text!.string.isEmpty else { return }
-            guard let font = textMediaItem.text!.attribute(.font, at: 0, effectiveRange: nil) as? UIFont else { return }
-            attributes.messageLabelFont = font
         default:
             break
         }