NCCreateFormUploadAssets.swift 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. //
  2. // NCCreateFormUploadAssets.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 14/11/2018.
  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 UIKit
  24. import Queuer
  25. import NCCommunication
  26. import XLForm
  27. import Photos
  28. protocol createFormUploadAssetsDelegate: AnyObject {
  29. func dismissFormUploadAssets()
  30. }
  31. class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
  32. var serverUrl: String = ""
  33. var titleServerUrl: String?
  34. var assets: [PHAsset] = []
  35. var cryptated: Bool = false
  36. var session: String = ""
  37. weak var delegate: createFormUploadAssetsDelegate?
  38. let requestOptions = PHImageRequestOptions()
  39. var imagePreview: UIImage?
  40. let targetSizeImagePreview = CGSize(width: 100, height: 100)
  41. let appDelegate = UIApplication.shared.delegate as! AppDelegate
  42. var cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground
  43. // MARK: - View Life Cycle
  44. convenience init(serverUrl: String, assets: [PHAsset], cryptated: Bool, session: String, delegate: createFormUploadAssetsDelegate?) {
  45. self.init()
  46. if serverUrl == NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account) {
  47. titleServerUrl = "/"
  48. } else {
  49. if let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl)) {
  50. if let metadata = NCManageDatabase.shared.getMetadataFromOcId(tableDirectory.ocId) {
  51. titleServerUrl = metadata.fileNameView
  52. } else { titleServerUrl = (serverUrl as NSString).lastPathComponent }
  53. } else { titleServerUrl = (serverUrl as NSString).lastPathComponent }
  54. }
  55. self.serverUrl = serverUrl
  56. self.assets = assets
  57. self.cryptated = cryptated
  58. self.session = session
  59. self.delegate = delegate
  60. requestOptions.resizeMode = PHImageRequestOptionsResizeMode.exact
  61. requestOptions.deliveryMode = PHImageRequestOptionsDeliveryMode.highQualityFormat
  62. requestOptions.isSynchronous = true
  63. }
  64. override func viewDidLoad() {
  65. super.viewDidLoad()
  66. self.title = NSLocalizedString("_upload_photos_videos_", comment: "")
  67. self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
  68. self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
  69. self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
  70. if assets.count == 1 && assets[0].mediaType == PHAssetMediaType.image {
  71. PHImageManager.default().requestImage(for: assets[0], targetSize: targetSizeImagePreview, contentMode: PHImageContentMode.aspectFill, options: requestOptions, resultHandler: { image, _ in
  72. self.imagePreview = image
  73. })
  74. }
  75. changeTheming()
  76. initializeForm()
  77. reloadForm()
  78. }
  79. override func viewWillDisappear(_ animated: Bool) {
  80. super.viewWillDisappear(animated)
  81. self.delegate?.dismissFormUploadAssets()
  82. }
  83. override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
  84. super.traitCollectionDidChange(previousTraitCollection)
  85. changeTheming()
  86. }
  87. // MARK: - Theming
  88. func changeTheming() {
  89. view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
  90. tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
  91. cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground
  92. tableView.reloadData()
  93. }
  94. // MARK: XLForm
  95. func initializeForm() {
  96. let form: XLFormDescriptor = XLFormDescriptor() as XLFormDescriptor
  97. form.rowNavigationOptions = XLFormRowNavigationOptions.stopDisableRow
  98. var section: XLFormSectionDescriptor
  99. var row: XLFormRowDescriptor
  100. // Section: Destination Folder
  101. section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_save_path_", comment: ""))
  102. form.addFormSection(section)
  103. row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
  104. row.action.formSelector = #selector(changeDestinationFolder(_:))
  105. row.cellConfig["backgroundColor"] = cellBackgoundColor
  106. row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25)
  107. row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
  108. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  109. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  110. section.addFormRow(row)
  111. // User folder Autoupload
  112. row = XLFormRowDescriptor(tag: "useFolderAutoUpload", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_use_folder_auto_upload_", comment: ""))
  113. row.value = 0
  114. row.cellConfig["backgroundColor"] = cellBackgoundColor
  115. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  116. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  117. section.addFormRow(row)
  118. // Use Sub folder
  119. row = XLFormRowDescriptor(tag: "useSubFolder", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_autoupload_create_subfolder_", comment: ""))
  120. let activeAccount = NCManageDatabase.shared.getActiveAccount()
  121. if activeAccount?.autoUploadCreateSubfolder == true {
  122. row.value = 1
  123. } else {
  124. row.value = 0
  125. }
  126. row.hidden = "$\("useFolderAutoUpload") == 0"
  127. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  128. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  129. section.addFormRow(row)
  130. // Section Mode filename
  131. section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_mode_filename_", comment: ""))
  132. form.addFormSection(section)
  133. // Maintain the original fileName
  134. row = XLFormRowDescriptor(tag: "maintainOriginalFileName", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_maintain_original_filename_", comment: ""))
  135. row.value = CCUtility.getOriginalFileName(NCGlobal.shared.keyFileNameOriginal)
  136. row.cellConfig["backgroundColor"] = cellBackgoundColor
  137. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  138. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  139. section.addFormRow(row)
  140. // Add File Name Type
  141. row = XLFormRowDescriptor(tag: "addFileNameType", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_add_filenametype_", comment: ""))
  142. row.value = CCUtility.getFileNameType(NCGlobal.shared.keyFileNameType)
  143. row.hidden = "$\("maintainOriginalFileName") == 1"
  144. row.cellConfig["backgroundColor"] = cellBackgoundColor
  145. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  146. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  147. section.addFormRow(row)
  148. // Section: Rename File Name
  149. section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_filename_", comment: ""))
  150. form.addFormSection(section)
  151. row = XLFormRowDescriptor(tag: "maskFileName", rowType: XLFormRowDescriptorTypeText, title: (NSLocalizedString("_filename_", comment: "")))
  152. let fileNameMask: String = CCUtility.getFileNameMask(NCGlobal.shared.keyFileNameMask)
  153. if fileNameMask.count > 0 {
  154. row.value = fileNameMask
  155. }
  156. row.hidden = "$\("maintainOriginalFileName") == 1"
  157. row.cellConfig["backgroundColor"] = cellBackgoundColor
  158. row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
  159. row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label
  160. row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue
  161. row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0)
  162. row.cellConfig["textField.textColor"] = NCBrandColor.shared.label
  163. section.addFormRow(row)
  164. // Section: Preview File Name
  165. row = XLFormRowDescriptor(tag: "previewFileName", rowType: XLFormRowDescriptorTypeTextView, title: "")
  166. row.height = 180
  167. row.disabled = true
  168. row.cellConfig["backgroundColor"] = cellBackgoundColor
  169. row.cellConfig["textView.backgroundColor"] = cellBackgoundColor
  170. row.cellConfig["textView.font"] = UIFont.systemFont(ofSize: 14.0)
  171. row.cellConfig["textView.textColor"] = NCBrandColor.shared.label
  172. section.addFormRow(row)
  173. self.form = form
  174. }
  175. override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
  176. super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
  177. if formRow.tag == "useFolderAutoUpload" {
  178. if (formRow.value! as AnyObject).boolValue == true {
  179. let buttonDestinationFolder: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
  180. buttonDestinationFolder.hidden = true
  181. } else {
  182. let buttonDestinationFolder: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
  183. buttonDestinationFolder.hidden = false
  184. }
  185. } else if formRow.tag == "useSubFolder" {
  186. if (formRow.value! as AnyObject).boolValue == true {
  187. } else {
  188. }
  189. } else if formRow.tag == "maintainOriginalFileName" {
  190. CCUtility.setOriginalFileName((formRow.value! as AnyObject).boolValue, key: NCGlobal.shared.keyFileNameOriginal)
  191. self.reloadForm()
  192. } else if formRow.tag == "addFileNameType" {
  193. CCUtility.setFileNameType((formRow.value! as AnyObject).boolValue, key: NCGlobal.shared.keyFileNameType)
  194. self.reloadForm()
  195. } else if formRow.tag == "maskFileName" {
  196. let fileName = formRow.value as? String
  197. self.form.delegate = nil
  198. if let fileName = fileName {
  199. formRow.value = CCUtility.removeForbiddenCharactersServer(fileName)
  200. }
  201. self.form.delegate = self
  202. let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
  203. previewFileName.value = self.previewFileName(valueRename: formRow.value as? String)
  204. // reload cell
  205. if fileName != nil {
  206. if newValue as! String != formRow.value as! String {
  207. self.reloadFormRow(formRow)
  208. NCContentPresenter.shared.messageNotification("_info_", description: "_forbidden_characters_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCharactersForbidden)
  209. }
  210. }
  211. self.reloadFormRow(previewFileName)
  212. }
  213. }
  214. func reloadForm() {
  215. self.form.delegate = nil
  216. let buttonDestinationFolder: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
  217. buttonDestinationFolder.title = self.titleServerUrl
  218. let maskFileName: XLFormRowDescriptor = self.form.formRow(withTag: "maskFileName")!
  219. let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
  220. previewFileName.value = self.previewFileName(valueRename: maskFileName.value as? String)
  221. self.tableView.reloadData()
  222. self.form.delegate = self
  223. }
  224. // MARK: - Action
  225. func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) {
  226. if serverUrl != nil {
  227. self.serverUrl = serverUrl!
  228. if serverUrl == NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account) {
  229. self.titleServerUrl = "/"
  230. } else {
  231. if let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, self.serverUrl)) {
  232. if let metadata = NCManageDatabase.shared.getMetadataFromOcId(tableDirectory.ocId) {
  233. titleServerUrl = metadata.fileNameView
  234. } else { titleServerUrl = (self.serverUrl as NSString).lastPathComponent }
  235. } else { titleServerUrl = (self.serverUrl as NSString).lastPathComponent }
  236. }
  237. // Update
  238. let row: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
  239. row.title = self.titleServerUrl
  240. self.updateFormRow(row)
  241. }
  242. }
  243. /*
  244. func save() {
  245. self.dismiss(animated: true, completion: {
  246. let useFolderPhotoRow : XLFormRowDescriptor = self.form.formRow(withTag: "useFolderAutoUpload")!
  247. let useSubFolderRow : XLFormRowDescriptor = self.form.formRow(withTag: "useSubFolder")!
  248. var useSubFolder : Bool = false
  249. if (useFolderPhotoRow.value! as AnyObject).boolValue == true {
  250. self.serverUrl = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: self.appDelegate.urlBase, account: self.appDelegate.account)
  251. useSubFolder = (useSubFolderRow.value! as AnyObject).boolValue
  252. }
  253. self.appDelegate.activeMain.uploadFileAsset(self.assets, serverUrl: self.serverUrl, useSubFolder: useSubFolder, session: self.session)
  254. })
  255. }
  256. */
  257. @objc func save() {
  258. DispatchQueue.global().async {
  259. let useFolderPhotoRow: XLFormRowDescriptor = self.form.formRow(withTag: "useFolderAutoUpload")!
  260. let useSubFolderRow: XLFormRowDescriptor = self.form.formRow(withTag: "useSubFolder")!
  261. var useSubFolder: Bool = false
  262. var metadatasNOConflict: [tableMetadata] = []
  263. var metadatasUploadInConflict: [tableMetadata] = []
  264. let autoUploadPath = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: self.appDelegate.urlBase, account: self.appDelegate.account)
  265. if (useFolderPhotoRow.value! as AnyObject).boolValue == true {
  266. self.serverUrl = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: self.appDelegate.urlBase, account: self.appDelegate.account)
  267. useSubFolder = (useSubFolderRow.value! as AnyObject).boolValue
  268. }
  269. if autoUploadPath == self.serverUrl {
  270. if !NCNetworking.shared.createFolder(assets: self.assets, selector: NCGlobal.shared.selectorUploadFile, useSubFolder: useSubFolder, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase) {
  271. NCContentPresenter.shared.messageNotification("_error_", description: "_error_createsubfolders_upload_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError)
  272. return
  273. }
  274. }
  275. for asset in self.assets {
  276. var serverUrl = self.serverUrl
  277. var livePhoto: Bool = false
  278. let fileName = CCUtility.createFileName(asset.value(forKey: "filename") as? String, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: NCGlobal.shared.keyFileNameMask, keyFileNameType: NCGlobal.shared.keyFileNameType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal, forcedNewFileName: false)!
  279. let assetDate = asset.creationDate ?? Date()
  280. if asset.mediaSubtypes.contains(.photoLive) && CCUtility.getLivePhoto() {
  281. livePhoto = true
  282. }
  283. if useSubFolder {
  284. let dateFormatter = DateFormatter()
  285. dateFormatter.dateFormat = "yyyy"
  286. let yearString = dateFormatter.string(from: assetDate)
  287. dateFormatter.dateFormat = "MM"
  288. let monthString = dateFormatter.string(from: assetDate)
  289. serverUrl = autoUploadPath + "/" + yearString + "/" + monthString
  290. }
  291. // Check if is in upload
  292. let isRecordInSessions = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@ AND session != ''", self.appDelegate.account, serverUrl, fileName), sorted: "fileName", ascending: false)
  293. if isRecordInSessions.count > 0 { continue }
  294. let metadataForUpload = NCManageDatabase.shared.createMetadata(account: self.appDelegate.account, user: self.appDelegate.user, userId: self.appDelegate.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: self.appDelegate.urlBase, url: "", contentType: "", isLivePhoto: livePhoto)
  295. metadataForUpload.assetLocalIdentifier = asset.localIdentifier
  296. metadataForUpload.session = self.session
  297. metadataForUpload.sessionSelector = NCGlobal.shared.selectorUploadFile
  298. metadataForUpload.status = NCGlobal.shared.metadataStatusWaitUpload
  299. if NCManageDatabase.shared.getMetadataConflict(account: self.appDelegate.account, serverUrl: serverUrl, fileName: fileName) != nil {
  300. metadatasUploadInConflict.append(metadataForUpload)
  301. } else {
  302. metadatasNOConflict.append(metadataForUpload)
  303. }
  304. }
  305. // Verify if file(s) exists
  306. if metadatasUploadInConflict.count > 0 {
  307. DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
  308. if let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict {
  309. conflict.serverUrl = self.serverUrl
  310. conflict.metadatasNOConflict = metadatasNOConflict
  311. conflict.metadatasUploadInConflict = metadatasUploadInConflict
  312. conflict.delegate = self.appDelegate
  313. self.appDelegate.window?.rootViewController?.present(conflict, animated: true, completion: nil)
  314. }
  315. }
  316. } else {
  317. self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatasNOConflict)
  318. }
  319. DispatchQueue.main.async {self.dismiss(animated: true, completion: nil) }
  320. }
  321. }
  322. @objc func cancel() {
  323. self.dismiss(animated: true, completion: nil)
  324. }
  325. // MARK: - Utility
  326. func previewFileName(valueRename: String?) -> String {
  327. var returnString: String = ""
  328. let asset = assets[0]
  329. if CCUtility.getOriginalFileName(NCGlobal.shared.keyFileNameOriginal) {
  330. return (NSLocalizedString("_filename_", comment: "") + ": " + (asset.value(forKey: "filename") as! String))
  331. } else if let valueRename = valueRename {
  332. let valueRenameTrimming = valueRename.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
  333. if valueRenameTrimming.count > 0 {
  334. self.form.delegate = nil
  335. CCUtility.setFileNameMask(valueRename, key: NCGlobal.shared.keyFileNameMask)
  336. self.form.delegate = self
  337. returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: NCGlobal.shared.keyFileNameMask, keyFileNameType: NCGlobal.shared.keyFileNameType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal, forcedNewFileName: false)
  338. } else {
  339. CCUtility.setFileNameMask("", key: NCGlobal.shared.keyFileNameMask)
  340. returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal, forcedNewFileName: false)
  341. }
  342. } else {
  343. CCUtility.setFileNameMask("", key: NCGlobal.shared.keyFileNameMask)
  344. returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal, forcedNewFileName: false)
  345. }
  346. return String(format: NSLocalizedString("_preview_filename_", comment: ""), "MM, MMM, DD, YY, YYYY, HH, hh, mm, ss, ampm") + ":" + "\n\n" + returnString
  347. }
  348. @objc func changeDestinationFolder(_ sender: XLFormRowDescriptor) {
  349. self.deselectFormRow(sender)
  350. let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
  351. let navigationController = storyboard.instantiateInitialViewController() as! UINavigationController
  352. let viewController = navigationController.topViewController as! NCSelect
  353. viewController.delegate = self
  354. viewController.typeOfCommandView = .selectCreateFolder
  355. viewController.includeDirectoryE2EEncryption = true
  356. self.present(navigationController, animated: true, completion: nil)
  357. }
  358. }