mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-15 07:45:55 +10:00
preview from FeedCell
This commit is contained in:
@@ -585,13 +585,36 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
cell.tapMediaAction = { [weak self] transitionView, attachments, index in
|
||||
cell.tapMediaAction = { [weak self] transitionView, image, attachments, index in
|
||||
|
||||
let vc = UIStoryboard(name: "MediaPreview", bundle: nil).instantiateViewControllerWithIdentifier("MediaPreviewViewController") as! MediaPreviewViewController
|
||||
|
||||
vc.previewMedias = attachments.map({ PreviewMedia.AttachmentType(attachment: $0) })
|
||||
vc.startIndex = index
|
||||
|
||||
let transitionView = transitionView
|
||||
let frame = transitionView.convertRect(transitionView.frame, toView: self?.view)
|
||||
vc.previewImageViewInitalFrame = frame
|
||||
vc.previewImage = image
|
||||
|
||||
transitionView.alpha = 0
|
||||
vc.afterDismissAction = { [weak self] in
|
||||
self?.view.window?.makeKeyAndVisible()
|
||||
transitionView.alpha = 1
|
||||
}
|
||||
|
||||
mediaPreviewWindow.rootViewController = vc
|
||||
mediaPreviewWindow.windowLevel = UIWindowLevelAlert - 1
|
||||
mediaPreviewWindow.makeKeyAndVisible()
|
||||
|
||||
/*
|
||||
let info: [String: AnyObject] = [
|
||||
"transitionView": transitionView,
|
||||
"attachments": Box(value: attachments),
|
||||
"index": index,
|
||||
]
|
||||
self?.performSegueWithIdentifier("showFeedMedia", sender: info)
|
||||
*/
|
||||
}
|
||||
|
||||
// simulate select effects when tap on messageTextView or cell.mediaCollectionView's space part
|
||||
|
||||
@@ -30,7 +30,7 @@ class FeedCell: UITableViewCell {
|
||||
|
||||
var tapAvatarAction: (UITableViewCell -> Void)?
|
||||
var tapSkillAction: (UITableViewCell -> Void)?
|
||||
var tapMediaAction: ((transitionView: UIView, attachments: [DiscoveredAttachment], index: Int) -> Void)?
|
||||
var tapMediaAction: ((transitionView: UIView, image: UIImage?, attachments: [DiscoveredAttachment], index: Int) -> Void)?
|
||||
|
||||
var touchesBeganAction: (UITableViewCell -> Void)?
|
||||
var touchesEndedAction: (UITableViewCell -> Void)?
|
||||
@@ -263,7 +263,7 @@ extension FeedCell: UICollectionViewDataSource, UICollectionViewDelegate {
|
||||
let cell = collectionView.cellForItemAtIndexPath(indexPath) as! FeedMediaCell
|
||||
|
||||
let transitionView = cell.imageView
|
||||
tapMediaAction?(transitionView: transitionView, attachments: attachments, index: indexPath.item)
|
||||
tapMediaAction?(transitionView: transitionView, image: cell.imageView.image, attachments: attachments, index: indexPath.item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user