Marino Faggiana 1 жил өмнө
parent
commit
1f5c16fd70

+ 5 - 7
File Provider Extension/FileProviderData.swift

@@ -72,13 +72,11 @@ class fileProviderData: NSObject {
         }
 
         // LOG
-        if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path {
-            NextcloudKit.shared.nkCommonInstance.pathLog = pathDirectoryGroup
-            let levelLog = NCKeychain().logLevel
-            NextcloudKit.shared.nkCommonInstance.levelLog = levelLog
-            let version = NSString(format: NCBrandOptions.shared.textCopyrightNextcloudiOS as NSString, NCUtility.shared.getVersionApp()) as String
-            NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)")
-        }
+        NextcloudKit.shared.nkCommonInstance.pathLog = NCUtilityFileSystem.shared.directoryGroup
+        let levelLog = NCKeychain().logLevel
+        NextcloudKit.shared.nkCommonInstance.levelLog = levelLog
+        let version = NSString(format: NCBrandOptions.shared.textCopyrightNextcloudiOS as NSString, NCUtility.shared.getVersionApp()) as String
+        NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)")
 
         // NO DOMAIN -> Set default account
         if domain == nil {

+ 1 - 3
Share/NCShareExtension.swift

@@ -116,9 +116,7 @@ class NCShareExtension: UIViewController {
         let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp())
 
         NextcloudKit.shared.nkCommonInstance.levelLog = levelLog
-        if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path {
-            NextcloudKit.shared.nkCommonInstance.pathLog = pathDirectoryGroup
-        }
+        NextcloudKit.shared.nkCommonInstance.pathLog = NCUtilityFileSystem.shared.directoryGroup
         if isSimulatorOrTestFlight {
             NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
         } else {

+ 4 - 6
Widget/Dashboard/DashboardData.swift

@@ -90,7 +90,7 @@ func convertDataToImage(data: Data?, size: CGSize, fileNameToWrite: String?) ->
     }
     if let fileName = fileNameToWrite, let image = imageData {
         do {
-            let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png"
+            let fileNamePath: String = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName + ".png"
             try image.pngData()?.write(to: URL(fileURLWithPath: fileNamePath), options: .atomic)
         } catch { }
     }
@@ -147,9 +147,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
     let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp())
 
     NextcloudKit.shared.nkCommonInstance.levelLog = levelLog
-    if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path {
-        NextcloudKit.shared.nkCommonInstance.pathLog = pathDirectoryGroup
-    }
+    NextcloudKit.shared.nkCommonInstance.pathLog = NCUtilityFileSystem.shared.directoryGroup
     if isSimulatorOrTestFlight {
         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
     } else {
@@ -162,7 +160,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
 
     var imagetmp = UIImage(named: "widget")!
     if let fileName = tableDashboard?.iconClass {
-        let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png"
+        let fileNamePath: String = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName + ".png"
         if let image = UIImage(contentsOfFile: fileNamePath) {
             imagetmp = image.withTintColor(.label, renderingMode: .alwaysOriginal)
         }
@@ -224,7 +222,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
                                     imageColor = UIColor(hex: colorString)
                                     icon = UIImage(systemName: "circle.fill")!
                                 } else if let fileName = iconFileName {
-                                    let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png"
+                                    let fileNamePath: String = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName + ".png"
                                     if FileManager().fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) {
                                         icon = image
                                     } else {

+ 2 - 3
Widget/Files/FilesData.swift

@@ -197,9 +197,8 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
     let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp())
 
     NextcloudKit.shared.nkCommonInstance.levelLog = levelLog
-    if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path {
-        NextcloudKit.shared.nkCommonInstance.pathLog = pathDirectoryGroup
-    }
+    NextcloudKit.shared.nkCommonInstance.pathLog = NCUtilityFileSystem.shared.directoryGroup
+
     if isSimulatorOrTestFlight {
         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
     } else {

+ 1 - 1
iOSClient/Activity/NCActivity.swift

@@ -250,7 +250,7 @@ extension NCActivity: UITableViewDataSource {
         if !activity.icon.isEmpty {
 
             let fileNameIcon = (activity.icon as NSString).lastPathComponent
-            let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + fileNameIcon
+            let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileNameIcon
 
             if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                 if let image = UIImage(contentsOfFile: fileNameLocalPath) {

+ 1 - 1
iOSClient/Activity/NCActivityCommentView.swift

@@ -36,7 +36,7 @@ class NCActivityCommentView: UIView, UITextFieldDelegate {
         newCommentField.delegate = self
 
         let fileName = urlBase.userBaseUrl + "-" + urlBase.user + ".png"
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
         if let image = UIImage(contentsOfFile: fileNameLocalPath) {
             imageItem.image = image
         } else {

+ 1 - 1
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -187,7 +187,7 @@ extension NCActivityTableViewCell: UICollectionViewDataSource {
 
                 if let activitySubjectRich = NCManageDatabase.shared.getActivitySubjectRich(account: activityPreview.account, idActivity: idActivity, id: fileId) {
 
-                    let fileNamePath = CCUtility.getDirectoryUserData() + "/" + activitySubjectRich.name
+                    let fileNamePath = NCUtilityFileSystem.shared.directoryUserData + "/" + activitySubjectRich.name
 
                     if FileManager.default.fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) {
                         cell.imageView.image = image

+ 3 - 5
iOSClient/AppDelegate.swift

@@ -98,9 +98,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         startTimerErrorNetworking()
 
         var levelLog = 0
-        if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path {
-            NextcloudKit.shared.nkCommonInstance.pathLog = pathDirectoryGroup
-        }
+        NextcloudKit.shared.nkCommonInstance.pathLog = NCUtilityFileSystem.shared.directoryGroup
 
         if NCBrandOptions.shared.disable_log {
 
@@ -541,7 +539,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
               host == currentHost
         else { return }
 
-        let certificateHostSavedPath = CCUtility.getDirectoryCerificates()! + "/" + host + ".der"
+        let certificateHostSavedPath = NCUtilityFileSystem.shared.directoryCertificates + "/" + host + ".der"
         var title = NSLocalizedString("_ssl_certificate_changed_", comment: "")
 
         if !FileManager.default.fileExists(atPath: certificateHostSavedPath) {
@@ -659,7 +657,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             let name = account.alias.isEmpty ? account.displayName : account.alias
             let userBaseUrl = account.user + "-" + (URL(string: account.urlBase)?.host ?? "")
             let avatarFileName = userBaseUrl + "-\(account.user).png"
-            let pathAvatarFileName = String(CCUtility.getDirectoryUserData()) + "/" + avatarFileName
+            let pathAvatarFileName = NCUtilityFileSystem.shared.directoryUserData + "/" + avatarFileName
             let image = UIImage(contentsOfFile: pathAvatarFileName)
             accounts.append(NKShareAccounts.DataAccounts(withUrl: account.urlBase, user: account.user, name: name, image: image))
         }

+ 2 - 2
iOSClient/Data/NCManageDatabase+Avatar.swift

@@ -89,7 +89,7 @@ extension NCManageDatabase {
     @discardableResult
     func setAvatarLoaded(fileName: String) -> UIImage? {
 
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
         var image: UIImage?
 
         do {
@@ -113,7 +113,7 @@ extension NCManageDatabase {
 
     func getImageAvatarLoaded(fileName: String) -> UIImage? {
 
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
 
         do {
             let realm = try Realm()

+ 1 - 1
iOSClient/Login/NCViewCertificateDetails.swift

@@ -53,7 +53,7 @@ class NCViewCertificateDetails: UIViewController {
         buttonCancel.title = NSLocalizedString("_close_", comment: "")
 
         if fileNamePath.isEmpty {
-            fileNamePath = CCUtility.getDirectoryCerificates()! + "/" + host + ".txt"
+            fileNamePath = NCUtilityFileSystem.shared.directoryCertificates + "/" + host + ".txt"
         }
 
         if FileManager.default.fileExists(atPath: fileNamePath) {

+ 2 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -166,7 +166,7 @@ import XLForm
         // image
         let imagePreview = cell.viewWithTag(100) as? UIImageView
         if !template.preview.isEmpty {
-            let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + template.name + ".png"
+            let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + template.name + ".png"
             if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                 let imageURL = URL(fileURLWithPath: fileNameLocalPath)
                 if let image = UIImage(contentsOfFile: imageURL.path) {
@@ -486,7 +486,7 @@ import XLForm
 
     func getImageFromTemplate(name: String, preview: String, indexPath: IndexPath) {
 
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + name + ".png"
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + name + ".png"
 
         NextcloudKit.shared.download(serverUrlFileName: preview, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in
 

+ 3 - 3
iOSClient/Networking/NCNetworking.swift

@@ -174,7 +174,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
     public func checkTrustedChallenge(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
 
         let protectionSpace: URLProtectionSpace = challenge.protectionSpace
-        let directoryCertificate = CCUtility.getDirectoryCerificates()!
+        let directoryCertificate = NCUtilityFileSystem.shared.directoryCertificates
         let host = challenge.protectionSpace.host
         let certificateSavedPath = directoryCertificate + "/" + host + ".der"
         var isTrusted: Bool
@@ -215,7 +215,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     func writeCertificate(host: String) {
 
-        let directoryCertificate = CCUtility.getDirectoryCerificates()!
+        let directoryCertificate = NCUtilityFileSystem.shared.directoryCertificates
         let certificateAtPath = directoryCertificate + "/" + host + ".tmp"
         let certificateToPath = directoryCertificate + "/" + host + ".der"
 
@@ -358,7 +358,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 #if !EXTENSION
     func downloadAvatar(user: String, dispalyName: String?, fileName: String, cell: NCCellProtocol, view: UIView?, cellImageView: UIImageView?) {
         guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
 
         if let image = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) {
             cellImageView?.image = image

+ 2 - 2
iOSClient/Networking/NCService.swift

@@ -153,7 +153,7 @@ class NCService: NSObject {
     func getAvatar() {
 
         let fileName = appDelegate.userBaseUrl + "-" + self.appDelegate.user + ".png"
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
         let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
 
         NextcloudKit.shared.downloadAvatar(user: appDelegate.userId,
@@ -269,7 +269,7 @@ class NCService: NSObject {
             }
             if let fileName = fileNameToWrite, let image = imageData {
                 do {
-                    let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png"
+                    let fileNamePath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName + ".png"
                     try image.pngData()?.write(to: URL(fileURLWithPath: fileNamePath), options: .atomic)
                 } catch { }
             }

+ 2 - 2
iOSClient/Notification/NCNotification.swift

@@ -125,7 +125,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
         var image: UIImage?
 
         if let urlIcon = urlIcon {
-            let pathFileName = String(CCUtility.getDirectoryUserData()) + "/" + urlIcon.deletingPathExtension().lastPathComponent + ".png"
+            let pathFileName = NCUtilityFileSystem.shared.directoryUserData + "/" + urlIcon.deletingPathExtension().lastPathComponent + ".png"
             image = UIImage(contentsOfFile: pathFileName)
         }
 
@@ -145,7 +145,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
             cell.avatarLeadingMargin.constant = 50
 
             let fileName = appDelegate.userBaseUrl + "-" + user + ".png"
-            let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+            let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
 
             if let image = UIImage(contentsOfFile: fileNameLocalPath) {
                 cell.avatar.image = image

+ 2 - 2
iOSClient/Settings/NCEndToEndInitialize.swift

@@ -79,7 +79,7 @@ class NCEndToEndInitialize: NSObject {
                     NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
 
                 case NCGlobal.shared.errorResourceNotFound:
-                    guard let csr = NCEndToEndEncryption.sharedManager().createCSR(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData()) else {
+                    guard let csr = NCEndToEndEncryption.sharedManager().createCSR(self.appDelegate.userId, directory: NCUtilityFileSystem.shared.directoryUserData) else {
                         let error = NKError(errorCode: error.errorCode, errorDescription: "Error to create Csr")
                         NCContentPresenter.shared.messageNotification("E2E Csr", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
 
@@ -255,7 +255,7 @@ class NCEndToEndInitialize: NSObject {
 
         var privateKeyString: NSString?
 
-        guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData(), passphrase: e2ePassphrase, privateKey: &privateKeyString, iterationCount: 1024) else {
+        guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: NCUtilityFileSystem.shared.directoryUserData, passphrase: e2ePassphrase, privateKey: &privateKeyString, iterationCount: 1024) else {
             let error = NKError(errorCode: error.errorCode, errorDescription: "Serious internal error to create PrivateKey chiper")
             NCContentPresenter.shared.messageNotification("E2E privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
             return

+ 1 - 1
iOSClient/Share/NCShare.swift

@@ -166,7 +166,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
         let fileName = appDelegate.userBaseUrl + "-" + metadata.ownerId + ".png"
 
         if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
-            let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+            let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
             let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
 
             NextcloudKit.shared.downloadAvatar(

+ 1 - 1
iOSClient/Share/NCShareUserCell.swift

@@ -171,7 +171,7 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
 
         let fileName = baseUrl.userBaseUrl + "-" + sharee.shareWith + ".png"
         if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
-            let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+            let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
             let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
 
             NextcloudKit.shared.downloadAvatar(

+ 0 - 6
iOSClient/Utility/CCUtility.h

@@ -49,12 +49,6 @@
 
 + (void)createDirectoryStandard;
 
-+ (NSURL *)getDirectoryGroup;
-+ (NSString *)getDirectoryDocuments;
-+ (NSString *)getDirectoryReaderMetadata;
-+ (NSString *)getDirectoryAudio;
-+ (NSString *)getDirectoryCerificates;
-+ (NSString *)getDirectoryUserData;
 + (NSString *)getDirectoryProviderStorage;
 + (NSString *)getDirectoryProviderStorageOcId:(NSString *)ocId;
 + (NSString *)getDirectoryProviderStorageOcId:(NSString *)ocId fileNameView:(NSString *)fileNameView;

+ 2 - 2
iOSClient/Utility/NCUtility.swift

@@ -55,7 +55,7 @@ class NCUtility: NSObject {
             fileNamePNG = iconURL.deletingPathExtension().lastPathComponent + ".png"
         }
 
-        let imageNamePath = CCUtility.getDirectoryUserData() + "/" + fileNamePNG
+        let imageNamePath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileNamePNG
 
         if !FileManager.default.fileExists(atPath: imageNamePath) || rewrite == true {
 
@@ -439,7 +439,7 @@ class NCUtility: NSObject {
     @objc func loadUserImage(for user: String, displayName: String?, userBaseUrl: NCUserBaseUrl) -> UIImage {
 
         let fileName = userBaseUrl.userBaseUrl + "-" + user + ".png"
-        let localFilePath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        let localFilePath = NCUtilityFileSystem.shared.directoryUserData + "/" + fileName
 
         if let localImage = UIImage(contentsOfFile: localFilePath) {
             return createAvatar(image: localImage, size: 30)

+ 38 - 0
iOSClient/Utility/NCUtilityFileSystem.swift

@@ -32,6 +32,44 @@ class NCUtilityFileSystem: NSObject {
 
     let fileManager = FileManager.default
 
+    var directoryGroup: String {
+        return fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups)?.path ?? ""
+    }
+
+    var directoryDocuments: String {
+        return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
+    }
+
+    var directoryCertificates: String {
+        if let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) {
+            let path = directoryGroup.appendingPathComponent(NCGlobal.shared.appCertificates).path
+            if !fileManager.fileExists(atPath: path) {
+                do {
+                    try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
+                } catch {
+                    return ""
+                }
+            }
+            return path
+        }
+        return ""
+    }
+
+    var directoryUserData: String {
+        if let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) {
+            let path = directoryGroup.appendingPathComponent(NCGlobal.shared.appUserData).path
+            if !fileManager.fileExists(atPath: path) {
+                do {
+                    try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
+                } catch {
+                    return ""
+                }
+            }
+            return path
+        }
+        return ""
+    }
+
     @objc func getFileSize(filePath: String) -> Int64 {
 
         do {

+ 2 - 2
iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift

@@ -185,7 +185,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
                         guard let type = values["Type"] as? String else { return }
                         guard let urlString = values["URL"] as? String else { return }
                         guard let url = URL(string: urlString) else { return }
-                        let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + (metadata.fileName as NSString).deletingPathExtension
+                        let fileNameLocalPath = NCUtilityFileSystem.shared.directoryUserData + "/" + (metadata.fileName as NSString).deletingPathExtension
 
                         if type == "slideshow" {
 
@@ -221,7 +221,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
                                         if let disposition = allHeaderFields["Content-Disposition"] as? String {
                                             let components = disposition.components(separatedBy: "filename=")
                                             if let filename = components.last?.replacingOccurrences(of: "\"", with: "") {
-                                                item = CCUtility.getDirectoryUserData() + "/" + filename
+                                                item = NCUtilityFileSystem.shared.directoryUserData + "/" + filename
                                                 _ = NCUtilityFileSystem.shared.moveFile(atPath: fileNameLocalPath, toPath: item)
                                             }
                                         }