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) {
|
} else if attachmentsView.frame.contains(location) {
|
||||||
let attachmentsViewLocation = attachmentsView.convert(location, from: self)
|
let attachmentsViewLocation = attachmentsView.convert(location, from: self)
|
||||||
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }),
|
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }) {
|
||||||
let image = attachmentView.image {
|
return (
|
||||||
let description = attachmentView.attachment.description
|
content: {
|
||||||
return (content: { self.delegate?.largeImage(image, description: description, sourceView: attachmentView) }, actions: { [] })
|
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),
|
}/* else if contentLabel.frame.contains(location),
|
||||||
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
||||||
|
|
Loading…
Reference in New Issue