소스 검색

show webxdc app icon in quoted webxdc messages

cyberta 3 년 전
부모
커밋
ef3ea7f457
3개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 1
      deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift
  2. 4 1
      deltachat-ios/Chat/Views/QuotePreview.swift
  3. 3 0
      deltachat-ios/Chat/Views/QuoteView.swift

+ 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
     }
 }