NCMedia.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. //
  2. // NCMedia.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 12/02/2019.
  6. // Copyright © 2018 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. import Foundation
  24. import Sheeeeeeeeet
  25. class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
  26. @IBOutlet fileprivate weak var collectionView: UICollectionView!
  27. private let appDelegate = UIApplication.shared.delegate as! AppDelegate
  28. private var metadataPush: tableMetadata?
  29. private var isEditMode = false
  30. private var selectFileID = [String]()
  31. private var filterTypeFileImage = false;
  32. private var filterTypeFileVideo = false;
  33. private var sectionDatasource = CCSectionDataSourceMetadata()
  34. private var autoUploadFileName = ""
  35. private var autoUploadDirectory = ""
  36. private var gridLayout: NCGridLayout!
  37. private var actionSheet: ActionSheet?
  38. private let headerMenuHeight: CGFloat = 50
  39. private let sectionHeaderHeight: CGFloat = 20
  40. private let footerHeight: CGFloat = 50
  41. private var addWidth: CGFloat = 10
  42. private let refreshControl = UIRefreshControl()
  43. override func viewDidLoad() {
  44. super.viewDidLoad()
  45. // Cell
  46. collectionView.register(UINib.init(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
  47. // Header
  48. collectionView.register(UINib.init(nibName: "NCSectionHeaderMenu", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeaderMenu")
  49. collectionView.register(UINib.init(nibName: "NCSectionHeader", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeader")
  50. // Footer
  51. collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
  52. collectionView.alwaysBounceVertical = true
  53. gridLayout = NCGridLayout()
  54. gridLayout.heightLabelPlusButton = 0
  55. gridLayout.preferenceWidth = 80
  56. gridLayout.sectionInset = UIEdgeInsets(top: 10, left: 1, bottom: 10, right: 1)
  57. collectionView.collectionViewLayout = gridLayout
  58. // Add Refresh Control
  59. collectionView.refreshControl = refreshControl
  60. // Configure Refresh Control
  61. refreshControl.tintColor = NCBrandColor.sharedInstance.brandText
  62. refreshControl.backgroundColor = NCBrandColor.sharedInstance.brand
  63. refreshControl.addTarget(self, action: #selector(loadDatasource), for: .valueChanged)
  64. // empty Data Source
  65. self.collectionView.emptyDataSetDelegate = self;
  66. self.collectionView.emptyDataSetSource = self;
  67. }
  68. override func viewWillAppear(_ animated: Bool) {
  69. super.viewWillAppear(animated)
  70. // Color
  71. appDelegate.aspectNavigationControllerBar(self.navigationController?.navigationBar, online: appDelegate.reachability.isReachable(), hidden: false)
  72. appDelegate.aspectTabBar(self.tabBarController?.tabBar, hidden: false)
  73. self.navigationItem.title = NSLocalizedString("_media_", comment: "")
  74. // get auto upload folder
  75. autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
  76. autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(appDelegate.activeUrl)
  77. loadDatasource()
  78. }
  79. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  80. super.viewWillTransition(to: size, with: coordinator)
  81. coordinator.animate(alongsideTransition: nil) { _ in
  82. self.collectionView.collectionViewLayout.invalidateLayout()
  83. self.actionSheet?.viewDidLayoutSubviews()
  84. }
  85. }
  86. // MARK: DZNEmpty
  87. func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? {
  88. return NCBrandColor.sharedInstance.backgroundView
  89. }
  90. func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
  91. return CCGraphics.changeThemingColorImage(UIImage.init(named: "filesNoFiles"), multiplier: 2, color: NCBrandColor.sharedInstance.brandElement)
  92. }
  93. func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  94. let text = "\n"+NSLocalizedString("_files_no_files_", comment: "")
  95. let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20), NSAttributedString.Key.foregroundColor: UIColor.lightGray]
  96. return NSAttributedString.init(string: text, attributes: attributes)
  97. }
  98. func emptyDataSetShouldAllowScroll(_ scrollView: UIScrollView) -> Bool {
  99. return true
  100. }
  101. // MARK: TAP EVENT
  102. func tapSwitchHeader(sender: Any) {
  103. let itemSizeStart = self.gridLayout.itemSize
  104. UIView.animate(withDuration: 0.0, animations: {
  105. if self.gridLayout.numItems == 1 && self.addWidth > 0 {
  106. self.addWidth = -10
  107. } else if itemSizeStart.width < 50 {
  108. self.addWidth = 10
  109. }
  110. repeat {
  111. self.gridLayout.preferenceWidth = self.gridLayout.preferenceWidth + self.addWidth
  112. } while (self.gridLayout.itemSize == itemSizeStart)
  113. self.collectionView.collectionViewLayout.invalidateLayout()
  114. })
  115. }
  116. func tapOrderHeader(sender: Any) {
  117. }
  118. func tapMoreHeader(sender: Any) {
  119. var menuView: DropdownMenu?
  120. if isEditMode {
  121. //let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedNo"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_cancel_", comment: ""))
  122. //let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "restore"), multiplier: 1, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_trash_restore_selected_", comment: ""))
  123. let item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_trash_delete_selected_", comment: ""))
  124. menuView = DropdownMenu(navigationController: self.navigationController!, items: [item2], selectedRow: -1)
  125. menuView?.token = "tapMoreHeaderMenuSelect"
  126. } else {
  127. let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "select"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_select_", comment: ""))
  128. let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "folderMedia"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_select_media_folder_", comment: ""))
  129. var item2: DropdownItem
  130. if filterTypeFileImage {
  131. item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageno"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewimage_show_", comment: ""))
  132. } else {
  133. item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewimage_hide_", comment: ""))
  134. }
  135. var item3: DropdownItem
  136. if filterTypeFileVideo {
  137. item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videono"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewvideo_show_", comment: ""))
  138. } else {
  139. item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videoyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewvideo_hide_", comment: ""))
  140. }
  141. menuView = DropdownMenu(navigationController: self.navigationController!, items: [item0,item1,item2,item3], selectedRow: -1)
  142. menuView?.token = "tapMoreHeaderMenu"
  143. }
  144. menuView?.delegate = self
  145. menuView?.rowHeight = 45
  146. menuView?.highlightColor = NCBrandColor.sharedInstance.brand
  147. menuView?.tableView.alwaysBounceVertical = false
  148. menuView?.tableViewBackgroundColor = UIColor.white
  149. let header = (sender as? UIButton)?.superview
  150. let headerRect = self.collectionView.convert(header!.bounds, from: self.view)
  151. let menuOffsetY = headerRect.height - headerRect.origin.y - 2
  152. menuView?.topOffsetY = CGFloat(menuOffsetY)
  153. menuView?.showMenu()
  154. }
  155. func tapMoreListItem(with fileID: String, sender: Any) {
  156. tapMoreGridItem(with: fileID, sender: sender)
  157. }
  158. func tapMoreGridItem(with fileID: String, sender: Any) {
  159. guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", fileID)) else {
  160. return
  161. }
  162. if !isEditMode {
  163. var items = [ActionSheetItem]()
  164. let appearanceDelete = ActionSheetItemAppearance.init()
  165. appearanceDelete.textColor = UIColor.red
  166. // 0 == CCMore, 1 = first NCOffline ....
  167. if (self == self.navigationController?.viewControllers[1]) {
  168. items.append(ActionSheetItem(title: NSLocalizedString("_remove_available_offline_", comment: ""), value: 0, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "offline"), multiplier: 2, color: NCBrandColor.sharedInstance.icon)))
  169. }
  170. items.append(ActionSheetItem(title: NSLocalizedString("_share_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), multiplier: 2, color: NCBrandColor.sharedInstance.icon)))
  171. let itemDelete = ActionSheetItem(title: NSLocalizedString("_delete_", comment: ""), value: 2, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), multiplier: 2, color: UIColor.red))
  172. itemDelete.customAppearance = appearanceDelete
  173. items.append(itemDelete)
  174. items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
  175. actionSheet = ActionSheet(items: items) { sheet, item in
  176. if item.value as? Int == 0 {
  177. if metadata.directory {
  178. NCManageDatabase.sharedInstance.setDirectory(serverUrl: CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)!, offline: false, account: self.appDelegate.activeAccount)
  179. } else {
  180. NCManageDatabase.sharedInstance.setLocalFile(fileID: metadata.fileID, offline: false)
  181. }
  182. self.loadDatasource()
  183. }
  184. if item.value as? Int == 1 { self.appDelegate.activeMain.readShare(withAccount: self.appDelegate.activeAccount, openWindow: true, metadata: metadata) }
  185. if item.value as? Int == 2 { self.deleteItem(with: metadata, sender: sender) }
  186. if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
  187. }
  188. let headerView = NCActionSheetHeader.sharedInstance.actionSheetHeader(isDirectory: metadata.directory, iconName: metadata.iconName, fileID: metadata.fileID, fileNameView: metadata.fileNameView, text: metadata.fileNameView)
  189. actionSheet?.headerView = headerView
  190. actionSheet?.headerView?.frame.size.height = 50
  191. actionSheet?.present(in: self, from: sender as! UIButton)
  192. } else {
  193. let buttonPosition:CGPoint = (sender as! UIButton).convert(CGPoint.zero, to:collectionView)
  194. let indexPath = collectionView.indexPathForItem(at: buttonPosition)
  195. collectionView(self.collectionView, didSelectItemAt: indexPath!)
  196. }
  197. }
  198. // MARK: DROP-DOWN-MENU
  199. func dropdownMenu(_ dropdownMenu: DropdownMenu, didSelectRowAt indexPath: IndexPath) {
  200. if dropdownMenu.token == "tapMoreHeaderMenu" {
  201. }
  202. if dropdownMenu.token == "tapMoreHeaderMenuSelect" {
  203. }
  204. }
  205. // MARK: NC API
  206. func deleteItem(with metadata: tableMetadata, sender: Any) {
  207. var items = [ActionSheetItem]()
  208. guard let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == serverUrl", appDelegate.activeAccount, metadata.serverUrl)) else {
  209. return
  210. }
  211. items.append(ActionSheetDangerButton(title: NSLocalizedString("_delete_", comment: "")))
  212. items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
  213. actionSheet = ActionSheet(items: items) { sheet, item in
  214. if item is ActionSheetDangerButton {
  215. NCMainCommon.sharedInstance.deleteFile(metadatas: [metadata], e2ee: tableDirectory.e2eEncrypted, serverUrl: tableDirectory.serverUrl, folderFileID: tableDirectory.fileID) { (errorCode, message) in
  216. self.loadDatasource()
  217. }
  218. }
  219. if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
  220. }
  221. let headerView = NCActionSheetHeader.sharedInstance.actionSheetHeader(isDirectory: metadata.directory, iconName: metadata.iconName, fileID: metadata.fileID, fileNameView: metadata.fileNameView, text: metadata.fileNameView)
  222. actionSheet?.headerView = headerView
  223. actionSheet?.headerView?.frame.size.height = 50
  224. actionSheet?.present(in: self, from: sender as! UIButton)
  225. }
  226. // MARK: DATASOURCE
  227. @objc func loadDatasource() {
  228. if appDelegate.activeAccount.count == 0 {
  229. return
  230. }
  231. let startDirectory = NCManageDatabase.sharedInstance.getAccountStartDirectoryMediaTabView(CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl))
  232. //let date = Calendar.current.date(byAdding: .day, value: -30, to: Date())!
  233. let formatter = DateFormatter()
  234. formatter.dateFormat = "yyyy/MM/dd HH:mm"
  235. let date2 = formatter.date(from: "2019/01/29 00:00")!
  236. OCNetworking.sharedManager()?.search(withAccount: appDelegate.activeAccount, fileName: "", serverUrl: startDirectory, contentType: ["image/%", "video/%"], lteDateLastModified: Date(), gteDateLastModified: date2, depth: "infinity", completion: { (account, metadatas, message, errorCode) in
  237. if errorCode == 0 && account == self.appDelegate.activeAccount {
  238. NCManageDatabase.sharedInstance.createTablePhotos(metadatas as! [tableMetadata], account: account!)
  239. self.sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: "date", filterFileID: nil, filterTypeFileImage: self.filterTypeFileImage, filterTypeFileVideo: self.filterTypeFileVideo, activeAccount: account!)
  240. self.collectionView.reloadData()
  241. }
  242. })
  243. self.refreshControl.endRefreshing()
  244. }
  245. // MARK: COLLECTIONVIEW METHODS
  246. public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
  247. //caused by user
  248. print("SCROLL scrollViewDidEndDecelerating")
  249. }
  250. public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
  251. if (!decelerate) {
  252. //cause by user
  253. print("SCROLL scrollViewDidEndDragging")
  254. }
  255. }
  256. func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
  257. if (indexPath.section == 0) {
  258. if kind == UICollectionView.elementKindSectionHeader {
  259. let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as! NCSectionHeaderMenu
  260. header.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchGridChange"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
  261. header.delegate = self
  262. header.setStatusButton(count: sectionDatasource.allFileID.count)
  263. header.buttonOrder.isHidden = true
  264. header.labelSection.isHidden = false
  265. header.buttonMore.isHidden = false
  266. header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
  267. header.labelSectionHeightConstraint.constant = sectionHeaderHeight
  268. return header
  269. } else {
  270. let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
  271. footer.setTitleLabel(sectionDatasource: sectionDatasource)
  272. return footer
  273. }
  274. } else {
  275. if kind == UICollectionView.elementKindSectionHeader {
  276. let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader
  277. header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
  278. return header
  279. } else {
  280. let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
  281. footer.setTitleLabel(sectionDatasource: sectionDatasource)
  282. return footer
  283. }
  284. }
  285. }
  286. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
  287. if section == 0 {
  288. return CGSize(width: collectionView.frame.width, height: headerMenuHeight + sectionHeaderHeight)
  289. } else {
  290. return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
  291. }
  292. }
  293. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
  294. let sections = sectionDatasource.sectionArrayRow.allKeys.count
  295. if (section == sections - 1) {
  296. return CGSize(width: collectionView.frame.width, height: footerHeight)
  297. } else {
  298. return CGSize(width: collectionView.frame.width, height: 0)
  299. }
  300. }
  301. func numberOfSections(in collectionView: UICollectionView) -> Int {
  302. let sections = sectionDatasource.sectionArrayRow.allKeys.count
  303. return sections
  304. }
  305. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  306. let key = sectionDatasource.sections.object(at: section)
  307. let datasource = sectionDatasource.sectionArrayRow.object(forKey: key) as! [tableMetadata]
  308. return datasource.count
  309. }
  310. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  311. let cell: UICollectionViewCell
  312. guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
  313. return collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridMediaCell
  314. }
  315. cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridMediaCell
  316. NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: true, source: self)
  317. return cell
  318. }
  319. func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  320. guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
  321. return
  322. }
  323. metadataPush = metadata
  324. if isEditMode {
  325. if let index = selectFileID.index(of: metadata.fileID) {
  326. selectFileID.remove(at: index)
  327. } else {
  328. selectFileID.append(metadata.fileID)
  329. }
  330. collectionView.reloadItems(at: [indexPath])
  331. return
  332. }
  333. performSegue(withIdentifier: "segueDetail", sender: self)
  334. }
  335. // MARK: SEGUE
  336. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  337. let photoDataSource: NSMutableArray = []
  338. for fileID: String in sectionDatasource.allFileID as! [String] {
  339. let metadata = sectionDatasource.allRecordsDataSource.object(forKey: fileID) as! tableMetadata
  340. if metadata.typeFile == k_metadataTypeFile_image {
  341. photoDataSource.add(metadata)
  342. }
  343. }
  344. if let segueNavigationController = segue.destination as? UINavigationController {
  345. if let segueViewController = segueNavigationController.topViewController as? CCDetail {
  346. segueViewController.metadataDetail = metadataPush
  347. segueViewController.dateFilterQuery = nil
  348. segueViewController.photoDataSource = photoDataSource
  349. segueViewController.title = metadataPush!.fileNameView
  350. }
  351. }
  352. }
  353. }