 import Networking
 import Model
 
-//class DisplayableImage: NSObject {
-//	let imageId: Int
-//	let name: String
-//	var image: NSImage?
-//
-//	init(imageId: Int, name: String) {
-//		self.imageId = imageId
-//		self.name = name
-//	}
-//
-//	convenience init(_ simage: SessionImage) {
-//		self.init(imageId: simage.id, name: simage.displayName)
-//	}
-//}
-
-class ImageOutputController: NSViewController, OutputController, NSPageControllerDelegate, NSSharingServicePickerDelegate
+class ImageOutputController: NSViewController, OutputController, NSSharingServicePickerDelegate
 {
+	// MARK: properties
 	let emptyIdentifier = NSPageController.ObjectIdentifier("empty")
 	
 	@IBOutlet var containerView: NSView?

			picker.show(relativeTo: (self.shareButton?.bounds)!, of: self.shareButton!, preferredEdge: .maxY)
		}
	}

	// load the images into the popup
	func adjustImagePopup() {
		imagePopup?.removeAllItems()
		guard let images = allImages?.value, images.count > 0 else { return }
		var currentBatch = images[0].batchId
		for anImage in images {
			if anImage.batchId != currentBatch {
				imagePopup?.menu?.addItem(NSMenuItem.separator())
				currentBatch = anImage.batchId
			}
			let item = NSMenuItem(title: anImage.name, action: #selector(selectImage(_:)), keyEquivalent: "")
			item.tag = anImage.id
			item.target = self
			item.toolTip = anImage.name
			item.representedObject = anImage
			imagePopup?.menu?.addItem(item)
		}
	}
	
	@objc func selectImage(_ sender: Any?) {
		guard let menuItem = sender as? NSMenuItem, let image = menuItem.representedObject as? SessionImage else { return }
		display(image: image)
	}
	
	func sharingServicePicker(_ sharingServicePicker: NSSharingServicePicker, sharingServicesForItems items: [Any], proposedSharingServices proposedServices: [NSSharingService]) -> [NSSharingService]
	{
		return myShareServices + proposedServices

	}
}

// MARK: -
//controller shown in the page controller
class ImageViewController: NSViewController {
	var didAddConstraints = false
	var imageLoadDisposable: Disposable?
