瀏覽代碼

Merge pull request #618 from deltachat/fix_links_in_TextMediaMessages

fix links in messages containing audio, images, videos or files
bjoern 5 年之前
父節點
當前提交
6a3e92e473

+ 3 - 1
deltachat-ios/MessageKit/Views/Cells/AudioMessageCell.swift

@@ -156,6 +156,8 @@ open class AudioMessageCell: MessageContentCell {
     /// Used to handle the cell's contentView's tap gesture.
     /// Used to handle the cell's contentView's tap gesture.
     /// Return false when the contentView does not need to handle the gesture.
     /// Return false when the contentView does not need to handle the gesture.
     open override func cellContentView(canHandle touchPoint: CGPoint) -> Bool {
     open override func cellContentView(canHandle touchPoint: CGPoint) -> Bool {
-        return messageLabel.handleGesture(touchPoint)
+        let touchPointWithoutAudioPlayerHeight = CGPoint(x: touchPoint.x,
+                                                         y: touchPoint.y - audioPlayerView.frame.height)
+        return messageLabel.handleGesture(touchPointWithoutAudioPlayerHeight)
     }
     }
 }
 }

+ 9 - 5
deltachat-ios/MessageKit/Views/Cells/TextMediaMessageCell.swift

@@ -175,10 +175,14 @@ open class TextMediaMessageCell: MessageContentCell {
         }
         }
     }
     }
 
 
-      /// Used to handle the cell's contentView's tap gesture.
-      /// Return false when the contentView does not need to handle the gesture.
-      open override func cellContentView(canHandle touchPoint: CGPoint) -> Bool {
-          return messageLabel.handleGesture(touchPoint)
-      }
+    /// Used to handle the cell's contentView's tap gesture.
+    /// Return false when the contentView does not need to handle the gesture.
+    open override func cellContentView(canHandle touchPoint: CGPoint) -> Bool {
+        if !imageView.isHidden {
+            let touchPointWithoutImageHeight = CGPoint(x: touchPoint.x, y: touchPoint.y - imageView.frame.height)
+            return messageLabel.handleGesture(touchPointWithoutImageHeight)
+        }
+        return messageLabel.handleGesture(touchPoint)
+    }
 
 
 }
 }