forked from shadowfacts/Tusker
Show gallery instead of large image when previewing status attachments
Fixes crash when attempting to preview audio/video attachments
This commit is contained in:
parent
56de0ab359
commit
5bed38f661
|
@ -328,10 +328,16 @@ extension BaseStatusTableViewCell: MenuPreviewProvider {
|
|||
)
|
||||
} else if attachmentsView.frame.contains(location) {
|
||||
let attachmentsViewLocation = attachmentsView.convert(location, from: self)
|
||||
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }),
|
||||
let image = attachmentView.image {
|
||||
let description = attachmentView.attachment.description
|
||||
return (content: { self.delegate?.largeImage(image, description: description, sourceView: attachmentView) }, actions: { [] })
|
||||
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }) {
|
||||
return (
|
||||
content: {
|
||||
let attachments = self.attachmentsView.attachments!
|
||||
let sourceViews = attachments.map(self.attachmentsView.getAttachmentView(for:))
|
||||
let startIndex = sourceViews.firstIndex(of: attachmentView)!
|
||||
return self.delegate?.gallery(attachments: attachments, sourceViews: sourceViews, startIndex: startIndex)
|
||||
},
|
||||
actions: { [] }
|
||||
)
|
||||
}
|
||||
}/* else if contentLabel.frame.contains(location),
|
||||
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
||||
|
|
Loading…
Reference in New Issue