From cd5b59319991210bffa144eab316a8cc4ae0e706 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 16 Jun 2019 22:40:07 -0400 Subject: [PATCH] Show gallery from conversation main status cell --- .../Status/ConversationMainStatusTableViewCell.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift b/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift index fad59ddf..15c83eb5 100644 --- a/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift +++ b/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift @@ -193,11 +193,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell, PreferencesAdaptive extension ConversationMainStatusTableViewCell: AttachmentViewDelegate { func showLargeAttachment(for attachmentView: AttachmentView) { - if let gifData = attachmentView.gifData { - delegate?.showLargeImage(gifData: gifData, description: attachmentView.attachment.description, animatingFrom: attachmentView) - } else { - delegate?.showLargeImage(attachmentView.image!, description: attachmentView.attachment.description, animatingFrom: attachmentView) - } + guard let status = MastodonCache.status(for: statusID) else { fatalError("Missing cached status \(statusID!)") } + let startIndex = status.attachments.firstIndex { $0.id == attachmentView.attachment.id } ?? 0 + let sourceViews = status.attachments.map(attachmentsView.getAttachmentView(for:)) + delegate?.showGallery(attachments: status.attachments, sourceViews: sourceViews, startIndex: startIndex) } }