feat: show media full screen

pull/782/head
ryanzhao 2 years ago
parent 092864f918
commit aee9d46e58

@ -1561,7 +1561,10 @@ extension ConversationVC:
func info(_ cellViewModel: MessageViewModel) { func info(_ cellViewModel: MessageViewModel) {
let mediaInfoVC = MediaInfoVC( let mediaInfoVC = MediaInfoVC(
attachments: (cellViewModel.attachments ?? []), attachments: (cellViewModel.attachments ?? []),
isOutgoing: (cellViewModel.variant == .standardOutgoing) isOutgoing: (cellViewModel.variant == .standardOutgoing),
threadId: self.viewModel.threadData.threadId,
threadVariant: self.viewModel.threadData.threadVariant,
interactionId: cellViewModel.id
) )
navigationController?.pushViewController(mediaInfoVC, animated: true) navigationController?.pushViewController(mediaInfoVC, animated: true)
} }

@ -10,6 +10,10 @@ final class MediaInfoVC: BaseVC, SessionCarouselViewDelegate {
private let attachments: [Attachment] private let attachments: [Attachment]
private let isOutgoing: Bool private let isOutgoing: Bool
private let threadId: String
private let threadVariant: SessionThread.Variant
private let interactionId: Int64
private var currentPage: Int = 0 private var currentPage: Int = 0
// MARK: - UI // MARK: - UI
@ -66,7 +70,16 @@ final class MediaInfoVC: BaseVC, SessionCarouselViewDelegate {
// MARK: - Initialization // MARK: - Initialization
init(attachments: [Attachment], isOutgoing: Bool) { init(
attachments: [Attachment],
isOutgoing: Bool,
threadId: String,
threadVariant: SessionThread.Variant,
interactionId: Int64
) {
self.threadId = threadId
self.threadVariant = threadVariant
self.interactionId = interactionId
self.isOutgoing = isOutgoing self.isOutgoing = isOutgoing
self.attachments = attachments self.attachments = attachments
super.init(nibName: nil, bundle: nil) super.init(nibName: nil, bundle: nil)
@ -114,7 +127,17 @@ final class MediaInfoVC: BaseVC, SessionCarouselViewDelegate {
@objc func showMediaFullScreen() { @objc func showMediaFullScreen() {
let attachment = self.attachments[self.currentPage] let attachment = self.attachments[self.currentPage]
let viewController: UIViewController? = MediaGalleryViewModel.createDetailViewController(
for: self.threadId,
threadVariant: self.threadVariant,
interactionId: self.interactionId,
selectedAttachmentId: attachment.id,
options: [ .sliderEnabled ]
)
if let viewController: UIViewController = viewController {
viewController.transitioningDelegate = nil
self.present(viewController, animated: true)
}
} }
// MARK: - SessionCarouselViewDelegate // MARK: - SessionCarouselViewDelegate

Loading…
Cancel
Save