|
|
|
@ -123,13 +123,10 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout |
|
|
|
|
|
|
|
if let detail: MediaItem = self.detailItem { |
|
|
|
if i.type == ItemType.VIDEO { |
|
|
|
|
|
|
|
if i.parent!.type != ItemType.DETAILS { |
|
|
|
let path = NSIndexPath(forItem: index, inSection: i.parent!.index) |
|
|
|
self.collectionView.reloadItemsAtIndexPaths([path]) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if i.parent!.type != ItemType.DETAILS { |
|
|
|
let path = NSIndexPath(forItem: index, inSection: i.parent!.index) |
|
|
|
self.collectionView.reloadItemsAtIndexPaths([path]) |
|
|
|
} |
|
|
|
} else { |
|
|
|
if i.parent! !== detail { |
|
|
|
return |
|
|
|
@ -257,7 +254,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout |
|
|
|
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { |
|
|
|
if let detail: MediaItem = self.detailItem { |
|
|
|
var items = detail.children[indexPath.section] |
|
|
|
if (items.loaded) { |
|
|
|
if (items.type == ItemType.VIDEO || items.loaded) { |
|
|
|
if indexPath.item >= items.children.count { |
|
|
|
print(items.name) |
|
|
|
} else { |
|
|
|
@ -268,7 +265,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout |
|
|
|
self.currentItem = items |
|
|
|
} |
|
|
|
|
|
|
|
if items.type == ItemType.VIDEO { |
|
|
|
if items.type == ItemType.VIDEO || items.type == ItemType.SNAPSHOT { |
|
|
|
performSegueWithIdentifier("showVideo", sender: self) |
|
|
|
} |
|
|
|
else { |
|
|
|
@ -348,10 +345,14 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout |
|
|
|
self.collectionView.reloadData() |
|
|
|
self.collectionView.collectionViewLayout.invalidateLayout() |
|
|
|
|
|
|
|
if self.currentItem!.type == ItemType.SNAPSHOT { |
|
|
|
self.currentItem = self.currentItem!.parent |
|
|
|
if let ci = self.currentItem { |
|
|
|
if ci.type == ItemType.SNAPSHOT { |
|
|
|
self.currentItem = ci.parent |
|
|
|
} |
|
|
|
} |
|
|
|
if let ci = self.currentItem { |
|
|
|
NetworkManager.sharedInstance.saveItem(ci) |
|
|
|
} |
|
|
|
NetworkManager.sharedInstance.saveItem(self.currentItem!) |
|
|
|
self.dismissViewControllerAnimated(true, completion: nil); |
|
|
|
} |
|
|
|
} |
|
|
|
|