Эх сурвалжийг харах

show webxdc app icon in quoted webxdc messages

cyberta 3 жил өмнө
parent
commit
ef3ea7f457

+ 4 - 1
deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

@@ -431,7 +431,10 @@ public class BaseMessageCell: UITableViewCell {
             quoteView.quote.text = quoteText
 
             if let quoteMsg = msg.quoteMessage {
-                quoteView.setImagePreview(quoteMsg.image)
+                let isWebxdc = quoteMsg.type == DC_MSG_WEBXDC
+                let quoteImage = isWebxdc ? quoteMsg.getWebxdcPreviewImage() : quoteMsg.image
+                quoteView.setImagePreview(quoteImage)
+                quoteView.setRoundedCorners(isWebxdc)
                 if quoteMsg.isForwarded {
                     quoteView.senderTitle.text = String.localized("forwarded_message")
                     quoteView.senderTitle.textColor = DcColors.unknownSender

+ 4 - 1
deltachat-ios/Chat/Views/QuotePreview.swift

@@ -32,7 +32,10 @@ public class QuotePreview: DraftPreview {
             compactView = draft.attachment != nil
             calculateQuoteHeight(compactView: compactView)
             if let quoteMessage = draft.quoteMessage {
-                quoteView.setImagePreview(quoteMessage.image)
+                let isWebxdc = quoteMessage.type == DC_MSG_WEBXDC
+                let quoteImage = isWebxdc ? quoteMessage.getWebxdcPreviewImage() : quoteMessage.image
+                quoteView.setImagePreview(quoteImage)
+                quoteView.setRoundedCorners(isWebxdc)
                 if quoteMessage.isForwarded {
                     quoteView.senderTitle.text = String.localized("forwarded_message")
                     quoteView.senderTitle.textColor = DcColors.unknownSender

+ 3 - 0
deltachat-ios/Chat/Views/QuoteView.swift

@@ -111,6 +111,9 @@ public class QuoteView: UIView {
         } else {
             imageWidthConstraint?.constant = 0
         }
+    }
 
+    public func setRoundedCorners(_ isRounded: Bool) {
+        imagePreview.layer.cornerRadius = isRounded ? 4 : 0
     }
 }