guard !isTemporary to perform tapMediaAction

This commit is contained in:
nixzhu
2016-01-05 15:27:19 +08:00
parent 43f324405e
commit 3da69b0544
4 changed files with 16 additions and 0 deletions
@@ -201,6 +201,10 @@ class NewFeedViewController: SegueViewController {
choosePromptLabel.hidden = (newValue != nil)
}
}
deinit {
println("NewFeed deinit")
}
override func viewDidLoad() {
super.viewDidLoad()
@@ -156,6 +156,10 @@ extension FeedAnyImagesCell: UICollectionViewDataSource, UICollectionViewDelegat
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
guard let firstAttachment = attachments.first where !firstAttachment.isTemporary else {
return
}
let cell = collectionView.cellForItemAtIndexPath(indexPath) as! FeedMediaCell
let transitionView = cell.imageView
@@ -93,6 +93,10 @@ class FeedBiggerImageCell: FeedBasicCell {
@objc private func tap(sender: UITapGestureRecognizer) {
guard let firstAttachment = feed?.imageAttachments?.first where !firstAttachment.isTemporary else {
return
}
if let attachments = feed?.imageAttachments {
tapMediaAction?(transitionView: biggerImageView, image: biggerImageView.image, attachments: attachments, index: 0)
}
@@ -142,6 +142,10 @@ class FeedNormalImagesCell: FeedBasicCell {
@objc private func tap(sender: UITapGestureRecognizer) {
guard let firstAttachment = feed?.imageAttachments?.first where !firstAttachment.isTemporary else {
return
}
if let imageView = sender.view as? UIImageView, index = imageViews.indexOf(imageView) {
if let attachments = feed?.imageAttachments {