NCFavorite.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. //
  2. // NCFavorite.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 26/08/2020.
  6. // Copyright © 2020 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. class NCFavorite: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
  25. @IBOutlet fileprivate weak var collectionView: UICollectionView!
  26. var titleCurrentFolder = NSLocalizedString("_favorites_", comment: "")
  27. @objc var serverUrl = ""
  28. private let appDelegate = UIApplication.shared.delegate as! AppDelegate
  29. private var metadataPush: tableMetadata?
  30. private var isEditMode = false
  31. private var selectocId: [String] = []
  32. private var sectionDatasource = CCSectionDataSourceMetadata()
  33. private var typeLayout = ""
  34. private var datasourceGroupBy = ""
  35. private var datasourceTitleButton = ""
  36. private var autoUploadFileName = ""
  37. private var autoUploadDirectory = ""
  38. private var listLayout: NCListLayout!
  39. private var gridLayout: NCGridLayout!
  40. private let headerMenuHeight: CGFloat = 50
  41. private let sectionHeaderHeight: CGFloat = 20
  42. private let footerHeight: CGFloat = 50
  43. required init?(coder aDecoder: NSCoder) {
  44. super.init(coder: aDecoder)
  45. appDelegate.activeFavorite = self
  46. }
  47. override func viewDidLoad() {
  48. super.viewDidLoad()
  49. // Cell
  50. collectionView.register(UINib.init(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell")
  51. collectionView.register(UINib.init(nibName: "NCGridCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
  52. // Header
  53. collectionView.register(UINib.init(nibName: "NCSectionHeaderMenu", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeaderMenu")
  54. collectionView.register(UINib.init(nibName: "NCSectionHeader", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeader")
  55. // Footer
  56. collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
  57. collectionView.alwaysBounceVertical = true
  58. listLayout = NCListLayout()
  59. gridLayout = NCGridLayout()
  60. // empty Data Source
  61. self.collectionView.emptyDataSetDelegate = self
  62. self.collectionView.emptyDataSetSource = self
  63. // 3D Touch peek and pop
  64. if traitCollection.forceTouchCapability == .available {
  65. registerForPreviewing(with: self, sourceView: view)
  66. }
  67. NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
  68. NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
  69. NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: k_notificationCenter_reloadDataSource), object: nil)
  70. changeTheming()
  71. }
  72. override func viewWillAppear(_ animated: Bool) {
  73. super.viewWillAppear(animated)
  74. self.navigationItem.title = titleCurrentFolder
  75. // get auto upload folder
  76. autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
  77. autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(urlBase: appDelegate.urlBase, account: appDelegate.account)
  78. (typeLayout, _, _, datasourceGroupBy, _, datasourceTitleButton) = NCUtility.shared.getLayoutForView(key: k_layout_view_favorite)
  79. if typeLayout == k_layout_list {
  80. collectionView.collectionViewLayout = listLayout
  81. } else {
  82. collectionView.collectionViewLayout = gridLayout
  83. }
  84. reloadDataSource()
  85. }
  86. override func viewDidAppear(_ animated: Bool) {
  87. super.viewDidAppear(animated)
  88. if serverUrl == "" {
  89. listingFavorites()
  90. } else {
  91. readFolder()
  92. }
  93. }
  94. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  95. super.viewWillTransition(to: size, with: coordinator)
  96. coordinator.animate(alongsideTransition: nil) { _ in
  97. self.collectionView.collectionViewLayout.invalidateLayout()
  98. }
  99. }
  100. //MARK: - NotificationCenter
  101. @objc func deleteFile(_ notification: NSNotification) {
  102. if self.view?.window == nil { return }
  103. if let userInfo = notification.userInfo as NSDictionary? {
  104. if let errorCode = userInfo["errorCode"] as? Int, let errorDescription = userInfo["errorDescription"] as? String {
  105. if errorCode == 0 {
  106. self.reloadDataSource()
  107. } else {
  108. NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
  109. }
  110. }
  111. }
  112. }
  113. @objc func changeTheming() {
  114. appDelegate.changeTheming(self, tableView: nil, collectionView: collectionView, form: false)
  115. }
  116. // MARK: DZNEmpty
  117. func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? {
  118. return NCBrandColor.sharedInstance.backgroundView
  119. }
  120. func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
  121. return CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 300, height: 300, color: NCBrandColor.sharedInstance.yellowFavorite)
  122. }
  123. func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  124. let text = "\n"+NSLocalizedString("_favorite_no_files_", comment: "")
  125. let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20), NSAttributedString.Key.foregroundColor: UIColor.lightGray]
  126. return NSAttributedString.init(string: text, attributes: attributes)
  127. }
  128. func description(forEmptyDataSet scrollView: UIScrollView!) -> NSAttributedString! {
  129. let text = "\n"+NSLocalizedString("_tutorial_favorite_view_", comment: "")
  130. let attributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: UIColor.lightGray]
  131. return NSAttributedString.init(string: text, attributes: attributes)
  132. }
  133. func emptyDataSetShouldAllowScroll(_ scrollView: UIScrollView) -> Bool {
  134. return true
  135. }
  136. // MARK: TAP EVENT
  137. func tapSwitchHeader(sender: Any) {
  138. if collectionView.collectionViewLayout == gridLayout {
  139. // list layout
  140. UIView.animate(withDuration: 0.0, animations: {
  141. self.collectionView.collectionViewLayout.invalidateLayout()
  142. self.collectionView.setCollectionViewLayout(self.listLayout, animated: false, completion: { (_) in
  143. self.collectionView.reloadData()
  144. self.collectionView.setContentOffset(CGPoint(x:0,y:0), animated: false)
  145. })
  146. })
  147. typeLayout = k_layout_list
  148. NCUtility.shared.setLayoutForView(key: k_layout_view_favorite, layout: typeLayout)
  149. } else {
  150. // grid layout
  151. UIView.animate(withDuration: 0.0, animations: {
  152. self.collectionView.collectionViewLayout.invalidateLayout()
  153. self.collectionView.setCollectionViewLayout(self.gridLayout, animated: false, completion: { (_) in
  154. self.collectionView.reloadData()
  155. self.collectionView.setContentOffset(CGPoint(x:0,y:0), animated: false)
  156. })
  157. })
  158. typeLayout = k_layout_grid
  159. NCUtility.shared.setLayoutForView(key: k_layout_view_favorite, layout: typeLayout)
  160. }
  161. }
  162. func tapOrderHeader(sender: Any) {
  163. let sortMenu = NCSortMenu()
  164. sortMenu.toggleMenu(viewController: self, layout: k_layout_view_favorite, sortButton: sender as? UIButton, serverUrl: serverUrl)
  165. }
  166. func tapMoreHeader(sender: Any) {
  167. }
  168. func tapMoreListItem(with objectId: String, sender: Any) {
  169. tapMoreGridItem(with: objectId, sender: sender)
  170. }
  171. func tapShareListItem(with objectId: String, sender: Any) {
  172. guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", objectId)) else {
  173. return
  174. }
  175. NCMainCommon.sharedInstance.openShare(ViewController: self, metadata: metadata, indexPage: 2)
  176. }
  177. func tapMoreGridItem(with objectId: String, sender: Any) {
  178. guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", objectId)) else { return }
  179. guard let tabBarController = self.tabBarController else { return }
  180. toggleMoreMenu(viewController: tabBarController, metadata: metadata)
  181. }
  182. // MARK: SEGUE
  183. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  184. let photoDataSource: NSMutableArray = []
  185. for ocId: String in sectionDatasource.allOcId as! [String] {
  186. let metadata = sectionDatasource.allRecordsDataSource.object(forKey: ocId) as! tableMetadata
  187. if metadata.typeFile == k_metadataTypeFile_image {
  188. photoDataSource.add(metadata)
  189. }
  190. }
  191. if let segueNavigationController = segue.destination as? UINavigationController {
  192. if let segueViewController = segueNavigationController.topViewController as? NCDetailViewController {
  193. segueViewController.metadata = metadataPush
  194. }
  195. }
  196. }
  197. }
  198. // MARK: - 3D Touch peek and pop
  199. extension NCFavorite: UIViewControllerPreviewingDelegate {
  200. func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
  201. guard let point = collectionView?.convert(location, from: collectionView?.superview) else { return nil }
  202. guard let indexPath = collectionView?.indexPathForItem(at: point) else { return nil }
  203. guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else { return nil }
  204. guard let viewController = UIStoryboard(name: "CCPeekPop", bundle: nil).instantiateViewController(withIdentifier: "PeekPopImagePreview") as? CCPeekPop else { return nil }
  205. viewController.metadata = metadata
  206. if typeLayout == k_layout_grid {
  207. guard let cell = collectionView?.cellForItem(at: indexPath) as? NCGridCell else { return nil }
  208. previewingContext.sourceRect = cell.frame
  209. viewController.imageFile = cell.imageItem.image
  210. } else {
  211. guard let cell = collectionView?.cellForItem(at: indexPath) as? NCListCell else { return nil }
  212. previewingContext.sourceRect = cell.frame
  213. viewController.imageFile = cell.imageItem.image
  214. }
  215. viewController.showOpenIn = true
  216. viewController.showOpenQuickLook = NCUtility.shared.isQuickLookDisplayable(metadata: metadata)
  217. viewController.showShare = false
  218. return viewController
  219. }
  220. func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
  221. guard let indexPath = collectionView?.indexPathForItem(at: previewingContext.sourceRect.origin) else { return }
  222. collectionView(collectionView, didSelectItemAt: indexPath)
  223. }
  224. }
  225. // MARK: - Collection View
  226. extension NCFavorite: UICollectionViewDelegate {
  227. func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  228. guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
  229. return
  230. }
  231. metadataPush = metadata
  232. if isEditMode {
  233. if let index = selectocId.firstIndex(of: metadata.ocId) {
  234. selectocId.remove(at: index)
  235. } else {
  236. selectocId.append(metadata.ocId)
  237. }
  238. collectionView.reloadItems(at: [indexPath])
  239. return
  240. }
  241. if metadata.directory {
  242. guard let serverUrlPush = CCUtility.stringAppendServerUrl(metadataPush!.serverUrl, addFileName: metadataPush!.fileName) else { return }
  243. let ncFavorite:NCFavorite = UIStoryboard(name: "NCFavorite", bundle: nil).instantiateInitialViewController() as! NCFavorite
  244. ncFavorite.serverUrl = serverUrlPush
  245. ncFavorite.titleCurrentFolder = metadataPush!.fileNameView
  246. self.navigationController?.pushViewController(ncFavorite, animated: true)
  247. } else {
  248. performSegue(withIdentifier: "segueDetail", sender: self)
  249. }
  250. }
  251. }
  252. extension NCFavorite: UICollectionViewDataSource {
  253. func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
  254. if (indexPath.section == 0) {
  255. if kind == UICollectionView.elementKindSectionHeader {
  256. let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as! NCSectionHeaderMenu
  257. if collectionView.collectionViewLayout == gridLayout {
  258. header.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchList"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
  259. } else {
  260. header.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchGrid"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
  261. }
  262. header.delegate = self
  263. header.backgroundColor = NCBrandColor.sharedInstance.backgroundView
  264. header.separator.backgroundColor = NCBrandColor.sharedInstance.separator
  265. header.setStatusButton(count: sectionDatasource.allOcId.count)
  266. header.setTitleSorted(datasourceTitleButton: self.datasourceTitleButton)
  267. if datasourceGroupBy == "none" {
  268. header.labelSection.isHidden = true
  269. header.labelSectionHeightConstraint.constant = 0
  270. } else {
  271. header.labelSection.isHidden = false
  272. header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
  273. header.labelSectionHeightConstraint.constant = sectionHeaderHeight
  274. }
  275. return header
  276. } else {
  277. let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
  278. footer.setTitleLabel(sectionDatasource: sectionDatasource)
  279. return footer
  280. }
  281. } else {
  282. if kind == UICollectionView.elementKindSectionHeader {
  283. let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader
  284. header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
  285. return header
  286. } else {
  287. let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
  288. footer.setTitleLabel(sectionDatasource: sectionDatasource)
  289. return footer
  290. }
  291. }
  292. }
  293. func numberOfSections(in collectionView: UICollectionView) -> Int {
  294. let sections = sectionDatasource.sectionArrayRow.allKeys.count
  295. return sections
  296. }
  297. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  298. let key = sectionDatasource.sections.object(at: section)
  299. let datasource = sectionDatasource.sectionArrayRow.object(forKey: key) as! [tableMetadata]
  300. return datasource.count
  301. }
  302. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  303. let cell: UICollectionViewCell
  304. guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
  305. return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
  306. }
  307. if typeLayout == k_layout_grid {
  308. cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
  309. } else {
  310. cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
  311. (cell as! NCListCell).separator.backgroundColor = NCBrandColor.sharedInstance.separator
  312. }
  313. let shares = NCManageDatabase.sharedInstance.getTableShares(account: metadata.account, serverUrl: metadata.serverUrl, fileName: metadata.fileName)
  314. NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectocId: selectocId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, downloadThumbnail: true, shares: shares, source: self)
  315. return cell
  316. }
  317. }
  318. extension NCFavorite: UICollectionViewDelegateFlowLayout {
  319. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
  320. if section == 0 {
  321. if datasourceGroupBy == "none" {
  322. return CGSize(width: collectionView.frame.width, height: headerMenuHeight)
  323. } else {
  324. return CGSize(width: collectionView.frame.width, height: headerMenuHeight + sectionHeaderHeight)
  325. }
  326. } else {
  327. return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
  328. }
  329. }
  330. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
  331. let sections = sectionDatasource.sectionArrayRow.allKeys.count
  332. if (section == sections - 1) {
  333. return CGSize(width: collectionView.frame.width, height: footerHeight)
  334. } else {
  335. return CGSize(width: collectionView.frame.width, height: 0)
  336. }
  337. }
  338. }
  339. // MARK: - NC API & Algorithm
  340. extension NCFavorite {
  341. @objc func reloadDataSource() {
  342. var datasourceSorted: String
  343. var datasourceAscending: Bool
  344. var datasourceDirectoryOnTop: Bool
  345. sectionDatasource = CCSectionDataSourceMetadata()
  346. (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop, datasourceTitleButton) = NCUtility.shared.getLayoutForView(key: k_layout_view_favorite)
  347. if serverUrl == "" {
  348. let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND favorite == true", appDelegate.account))
  349. sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterTypeFileImage: false, filterTypeFileVideo: false, filterLivePhoto: true, sorted: datasourceSorted, ascending: datasourceAscending, directoryOnTop:datasourceDirectoryOnTop, account: appDelegate.account)
  350. } else {
  351. let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl))
  352. sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterTypeFileImage: false, filterTypeFileVideo: false, filterLivePhoto: true, sorted: datasourceSorted, ascending: datasourceAscending, directoryOnTop:datasourceDirectoryOnTop, account: appDelegate.account)
  353. }
  354. collectionView.reloadData()
  355. }
  356. private func readFolder() {
  357. NCNetworking.shared.readFolder(serverUrl: serverUrl, account: appDelegate.account) { (account, metadataFolder, metadatas, metadatasUpdate, metadatasLocalUpdate, errorCode, errorDescription) in
  358. if errorCode == 0 {
  359. for metadata in metadatas ?? [] {
  360. if !metadata.directory {
  361. let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
  362. if localFile == nil || localFile?.etag != metadata.etag {
  363. NCOperationQueue.shared.download(metadata: metadata, selector: selectorDownloadFile, setFavorite: false)
  364. }
  365. }
  366. }
  367. self.reloadDataSource()
  368. }
  369. }
  370. }
  371. private func listingFavorites() {
  372. NCNetworking.shared.listingFavoritescompletion(selector: selectorListingFavorite) { (account, metadatas, errorCode, errorDescription) in
  373. if errorCode == 0 {
  374. for metadata in metadatas ?? [] {
  375. if !metadata.directory && CCUtility.getFavoriteOffline() {
  376. let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
  377. if localFile == nil || localFile?.etag != metadata.etag {
  378. NCOperationQueue.shared.download(metadata: metadata, selector: selectorDownloadFile, setFavorite: false)
  379. }
  380. }
  381. }
  382. self.reloadDataSource()
  383. }
  384. }
  385. }
  386. }