Browse Source

fileProviderStorageExists

Marino Faggiana 1 year ago
parent
commit
5bdaa3fc8d

+ 1 - 1
File Provider Extension/FileProviderExtension.swift

@@ -204,7 +204,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
         }
 
         let tableLocalFile = NCManageDatabase.shared.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
-        if tableLocalFile != nil && CCUtility.fileProviderStorageExists(metadata) && tableLocalFile?.etag == metadata.etag {
+        if tableLocalFile != nil && NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) && tableLocalFile?.etag == metadata.etag {
             return completionHandler(nil)
         }
 

+ 1 - 1
File Provider Extension/FileProviderItem.swift

@@ -105,7 +105,7 @@ class FileProviderItem: NSObject, NSFileProviderItem {
         if metadata.directory {
             return true
         }
-        if CCUtility.fileProviderStorageExists(metadata) {
+        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             return true
         } else {
             return false

+ 2 - 2
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1136,7 +1136,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                 return
             }
 
-            if CCUtility.fileProviderStorageExists(metadata) {
+            if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 NCViewer.shared.view(viewController: self, metadata: metadata, metadatas: [metadata], imageIcon: imageIcon)
             } else if NextcloudKit.shared.isNetworkReachable() {
                 NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileView) { _, _ in }
@@ -1382,7 +1382,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             if NCManageDatabase.shared.getTableLocalFile(ocId: metadata.ocId) != nil {
                 a11yValues.append(NSLocalizedString("_offline_", comment: ""))
                 cell.fileLocalImage?.image = NCBrandColor.cacheImages.offlineFlag
-            } else if CCUtility.fileProviderStorageExists(metadata) {
+            } else if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 cell.fileLocalImage?.image = NCBrandColor.cacheImages.local
             }
         }

+ 3 - 3
iOSClient/Main/NCActionCenter.swift

@@ -309,7 +309,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
 
         for metadata in metadatas {
             let fileURL = URL(fileURLWithPath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
-            if CCUtility.fileProviderStorageExists(metadata) {
+            if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 items.append(fileURL)
             } else {
                 downloadMetadata.append((metadata, fileURL))
@@ -323,7 +323,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
                 } progressHandler: { progress in
                     processor.hud?.progress = Float(progress.fractionCompleted)
                 } completion: { _, _ in
-                    if CCUtility.fileProviderStorageExists(metadata) { items.append(url) }
+                    if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) { items.append(url) }
                     completion()
                 }
             }
@@ -698,7 +698,7 @@ fileprivate extension tableMetadata {
     func toPasteBoardItem() -> [String: Any]? {
         // Get Data
         let fileUrl = URL(fileURLWithPath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameView))
-        guard CCUtility.fileProviderStorageExists(self),
+        guard NCUtilityFileSystem.shared.fileProviderStorageExists(self),
               let data = try? Data(contentsOf: fileUrl),
               let unmanagedFileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension as CFString, nil)
         else { return nil }

+ 2 - 2
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -286,7 +286,7 @@ extension NCCollectionViewCommon {
                     icon: NCUtility.shared.loadImage(named: "viewfinder.circle"),
                     order: 110,
                     action: { _ in
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorSaveAsScan, "error": NKError(), "account": metadata.account])
                         } else {
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) { _, _ in }
@@ -346,7 +346,7 @@ extension NCCollectionViewCommon {
                     icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"),
                     order: 150,
                     action: { _ in
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorLoadFileQuickLook, "error": NKError(), "account": metadata.account])
                         } else {
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) { _, _ in }

+ 3 - 3
iOSClient/Menu/NCContextMenu.swift

@@ -70,7 +70,7 @@ class NCContextMenu: NSObject {
 
         let openIn = UIAction(title: NSLocalizedString("_open_in_", comment: ""),
                               image: UIImage(systemName: "square.and.arrow.up") ) { _ in
-            if CCUtility.fileProviderStorageExists(metadata) {
+            if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorOpenIn, "error": NKError(), "account": metadata.account])
             } else {
                 hud.show(in: viewController.view)
@@ -102,7 +102,7 @@ class NCContextMenu: NSObject {
                     appDelegate.saveLivePhotoQueue.addOperation(NCOperationSaveLivePhoto(metadata: metadata, metadataMOV: metadataMOV))
                 }
             } else {
-                if CCUtility.fileProviderStorageExists(metadata) {
+                if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                     NCActionCenter.shared.saveAlbum(metadata: metadata)
                 } else {
                     hud.show(in: viewController.view)
@@ -125,7 +125,7 @@ class NCContextMenu: NSObject {
 
         let modify = UIAction(title: NSLocalizedString("_modify_", comment: ""),
                               image: UIImage(systemName: "pencil.tip.crop.circle")) { _ in
-            if CCUtility.fileProviderStorageExists(metadata) {
+            if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorLoadFileQuickLook, "error": NKError(), "account": metadata.account])
             } else {
                 hud.show(in: viewController.view)

+ 2 - 2
iOSClient/Menu/NCMenuAction.swift

@@ -226,7 +226,7 @@ extension NCMenuAction {
                             appDelegate.saveLivePhotoQueue.addOperation(NCOperationSaveLivePhoto(metadata: metadata, metadataMOV: metadataMOV))
                         }
                     } else {
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NCActionCenter.shared.saveAlbum(metadata: metadata)
                         } else {
                             if let appDelegate = (UIApplication.shared.delegate as? AppDelegate), appDelegate.downloadQueue.operations.filter({ ($0 as? NCOperationDownload)?.metadata.ocId == metadata.ocId }).isEmpty {
@@ -286,7 +286,7 @@ extension NCMenuAction {
             icon: NCUtility.shared.loadImage(named: "printer"),
             order: order,
             action: { _ in
-                if CCUtility.fileProviderStorageExists(metadata) {
+                if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                     NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorPrint, "error": NKError(), "account": metadata.account])
                 } else {
                     NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorPrint) { _, _ in }

+ 4 - 4
iOSClient/Menu/NCViewer+Menu.swift

@@ -110,7 +110,7 @@ extension NCViewer {
                     title: NSLocalizedString("_print_", comment: ""),
                     icon: NCUtility.shared.loadImage(named: "printer"),
                     action: { _ in
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorPrint, "error": NKError(), "account": metadata.account])
                         } else {
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorPrint) { _, _ in }
@@ -157,7 +157,7 @@ extension NCViewer {
                     title: NSLocalizedString("_save_as_scan_", comment: ""),
                     icon: NCUtility.shared.loadImage(named: "viewfinder.circle"),
                     action: { _ in
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorSaveAsScan, "error": NKError(), "account": metadata.account])
                         } else {
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) { _, _ in }
@@ -210,7 +210,7 @@ extension NCViewer {
         //
         // DOWNLOAD LOCALLY
         //
-        if !webView, metadata.session.isEmpty, !CCUtility.fileProviderStorageExists(metadata) {
+        if !webView, metadata.session.isEmpty, !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_download_locally_", comment: ""),
@@ -256,7 +256,7 @@ extension NCViewer {
                     title: NSLocalizedString("_modify_", comment: ""),
                     icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"),
                     action: { _ in
-                        if CCUtility.fileProviderStorageExists(metadata) {
+                        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorLoadFileQuickLook, "error": NKError(), "account": metadata.account])
                         } else {
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) { _, _ in }

+ 2 - 2
iOSClient/Networking/NCNetworking.swift

@@ -294,7 +294,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
                   completion: @escaping (_ afError: AFError?, _ error: NKError) -> Void) {
 
         guard !metadata.isInTransfer else { return completion(nil, NKError()) }
-        if checkfileProviderStorageExists, CCUtility.fileProviderStorageExists(metadata) {
+        if checkfileProviderStorageExists, NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             return completion(nil, NKError())
         }
 
@@ -1622,7 +1622,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
             } else {
                 completition(URL(string: metadata.url), true, .success)
             }
-        } else if CCUtility.fileProviderStorageExists(metadata) {
+        } else if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             completition(URL(fileURLWithPath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)), false, .success)
         } else {
             NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { _, url, _, error in

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -396,7 +396,7 @@ extension NCSelect: UICollectionViewDataSource {
             // image local
             if NCManageDatabase.shared.getTableLocalFile(ocId: metadata.ocId) != nil {
                 cell.imageLocal.image = NCBrandColor.cacheImages.offlineFlag
-            } else if CCUtility.fileProviderStorageExists(metadata) {
+            } else if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 cell.imageLocal.image = NCBrandColor.cacheImages.local
             }
         }

+ 0 - 1
iOSClient/Utility/CCUtility.h

@@ -49,7 +49,6 @@
 
 + (void)createDirectoryStandard;
 
-+ (BOOL)fileProviderStorageExists:(tableMetadata *)metadata;
 + (int64_t)fileProviderStorageSize:(NSString *)ocId fileNameView:(NSString *)fileNameView;
 + (BOOL)fileProviderStoragePreviewIconExists:(NSString *)ocId etag:(NSString *)etag;
 

+ 1 - 1
iOSClient/Utility/NCUtility+Exif.swift

@@ -72,7 +72,7 @@ extension NCUtility {
             }
         }
 
-        if metadata.classFile != "image" || !CCUtility.fileProviderStorageExists(metadata) {
+        if metadata.classFile != "image" || !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             print("Storage exists or file is not an image")
         }
 

+ 1 - 1
iOSClient/Utility/NCUtility+Image.swift

@@ -53,7 +53,7 @@ extension NCUtility {
         let ext = CCUtility.getExtension(metadata.fileNameView)
         var image: UIImage?
 
-        if CCUtility.fileProviderStorageExists(metadata) && metadata.isImage {
+        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) && metadata.isImage {
 
             let previewPath = NCUtilityFileSystem.shared.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)
             let imagePath = NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)

+ 27 - 0
iOSClient/Utility/NCUtilityFileSystem.swift

@@ -123,6 +123,33 @@ class NCUtilityFileSystem: NSObject {
         return directoryProviderStorage + "/" + ocId + "/" + etag + ".preview." + NCGlobal.shared.extensionPreview
     }
 
+    func fileProviderStorageExists(_ metadata: tableMetadata) -> Bool {
+
+        let fileNamePath = getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileName)
+        let fileNameViewPath = getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)
+
+        do {
+            let fileNameAttribute = try fileManager.attributesOfItem(atPath: fileNamePath)
+            let fileNameSize: UInt64 = fileNameAttribute[FileAttributeKey.size] as? UInt64 ?? 0
+            let fileNameViewAttribute = try fileManager.attributesOfItem(atPath: fileNameViewPath)
+            let fileNameViewSize: UInt64 = fileNameViewAttribute[FileAttributeKey.size] as? UInt64 ?? 0
+
+            if metadata.isDirectoryE2EE == true {
+                if (fileNameSize == metadata.size || fileNameViewSize == metadata.size) && fileNameViewSize > 0 {
+                    return true
+                } else {
+                    return false
+                }
+            } else {
+                return fileNameViewSize == metadata.size
+            }
+        } catch {
+            print("Error: \(error)")
+        }
+
+        return false
+    }
+
     // MARK: -
 
     @objc func getFileSize(filePath: String) -> Int64 {

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -465,7 +465,7 @@ extension NCPlayerToolBar: NCSelectDelegate {
             let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
             let fileNameLocalPath = NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)
 
-            if CCUtility.fileProviderStorageExists(metadata) {
+            if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 addPlaybackSlave(type: type, metadata: metadata)
             } else {
                 var downloadRequest: DownloadRequest?

+ 5 - 5
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -185,7 +185,7 @@ class NCViewerMedia: UIViewController {
                             } completion: { _, error in
                                 if error == .success {
                                     hud.dismiss()
-                                    if CCUtility.fileProviderStorageExists(self.metadata) {
+                                    if NCUtilityFileSystem.shared.fileProviderStorageExists(self.metadata) {
                                         let url = URL(fileURLWithPath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
                                         ncplayer.openAVPlayer(url: url, autoplay: autoplay)
                                     }
@@ -275,17 +275,17 @@ class NCViewerMedia: UIViewController {
         self.metadata = metadata
 
         // Download image
-        if !CCUtility.fileProviderStorageExists(metadata) && metadata.isImage && metadata.session.isEmpty {
+        if !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) && metadata.isImage && metadata.session.isEmpty {
 
             if metadata.livePhoto {
                 let fileName = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
-                if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileName)), !CCUtility.fileProviderStorageExists(metadata) {
+                if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileName)), !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                     NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in }
                 }
             }
         }
 
-        if metadata.isImage, metadata.fileExtension.lowercased() == "gif", !CCUtility.fileProviderStorageExists(metadata) {
+        if metadata.isImage, metadata.fileExtension.lowercased() == "gif", !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
             downloadImage()
         }
 
@@ -325,7 +325,7 @@ class NCViewerMedia: UIViewController {
         let ext = CCUtility.getExtension(metadata.fileNameView)
         var image: UIImage?
 
-        if CCUtility.fileProviderStorageExists(metadata) && metadata.isImage {
+        if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) && metadata.isImage {
 
             let previewPath = NCUtilityFileSystem.shared.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)
             let imagePath = NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift

@@ -207,7 +207,7 @@ class NCViewerMediaDetailView: UIView {
             livePhotoImageView.isHidden = false
         }
 
-        if metadata.isImage && !CCUtility.fileProviderStorageExists(metadata) && metadata.session.isEmpty {
+        if metadata.isImage && !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) && metadata.session.isEmpty {
             downloadImageButton.setTitle(NSLocalizedString("_try_download_full_resolution_", comment: ""), for: .normal)
             downloadImageLabel.text = NSLocalizedString("_full_resolution_image_info_", comment: "")
             downloadImageButtonContainer.isHidden = false

+ 2 - 2
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -303,7 +303,7 @@ class NCViewerMediaPage: UIViewController {
 
         if metadata.ocId == ocId,
            metadata.isAudioOrVideo,
-           CCUtility.fileProviderStorageExists(metadata),
+           NCUtilityFileSystem.shared.fileProviderStorageExists(metadata),
            let ncplayer = currentViewController.ncplayer {
             let url = URL(fileURLWithPath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
             if ncplayer.isPlay() {
@@ -656,7 +656,7 @@ extension NCViewerMediaPage: UIGestureRecognizerDelegate {
 
         if gestureRecognizer.state == .began {
             let fileName = (currentViewController.metadata.fileNameView as NSString).deletingPathExtension + ".mov"
-            if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", currentViewController.metadata.account, currentViewController.metadata.serverUrl, fileName)), CCUtility.fileProviderStorageExists(metadata) {
+            if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", currentViewController.metadata.account, currentViewController.metadata.serverUrl, fileName)), NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 AudioServicesPlaySystemSound(1519) // peek feedback
                 currentViewController.playLivePhoto(filePath: NCUtilityFileSystem.shared.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
             }

+ 6 - 6
iOSClient/Viewer/NCViewerProviderContextMenu.swift

@@ -79,12 +79,12 @@ class NCViewerProviderContextMenu: UIViewController {
             }
 
             // VIEW IMAGE
-            if metadata.isImage && CCUtility.fileProviderStorageExists(metadata) {
+            if metadata.isImage && NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
                 viewImage(metadata: metadata)
             }
 
             // VIEW LIVE PHOTO
-            if let metadataLivePhoto = metadataLivePhoto, CCUtility.fileProviderStorageExists(metadataLivePhoto) {
+            if let metadataLivePhoto = metadataLivePhoto, NCUtilityFileSystem.shared.fileProviderStorageExists(metadataLivePhoto) {
                 viewVideo(metadata: metadataLivePhoto)
             }
 
@@ -104,7 +104,7 @@ class NCViewerProviderContextMenu: UIViewController {
 
                 var maxDownload: UInt64 = 0
 
-                if CCUtility.fileProviderStorageExists(metadata) {
+                if NCUtilityFileSystem.shared.fileProviderStorageExists(metadata) {
 
                     viewVideo(metadata: metadata)
 
@@ -125,7 +125,7 @@ class NCViewerProviderContextMenu: UIViewController {
             }
 
             // AUTO DOWNLOAD IMAGE GIF
-            if !CCUtility.fileProviderStorageExists(metadata),
+            if !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata),
                metadata.contentType == "image/gif",
                let appDelegate = (UIApplication.shared.delegate as? AppDelegate),
                appDelegate.downloadQueue.operations.filter({ ($0 as? NCOperationDownload)?.metadata.ocId == metadata.ocId }).isEmpty {
@@ -133,7 +133,7 @@ class NCViewerProviderContextMenu: UIViewController {
             }
 
             // AUTO DOWNLOAD IMAGE SVG
-            if !CCUtility.fileProviderStorageExists(metadata),
+            if !NCUtilityFileSystem.shared.fileProviderStorageExists(metadata),
                metadata.contentType == "image/svg+xml",
                let appDelegate = (UIApplication.shared.delegate as? AppDelegate),
                appDelegate.downloadQueue.operations.filter({ ($0 as? NCOperationDownload)?.metadata.ocId == metadata.ocId }).isEmpty {
@@ -142,7 +142,7 @@ class NCViewerProviderContextMenu: UIViewController {
 
             // AUTO DOWNLOAD LIVE PHOTO
             if let metadataLivePhoto = self.metadataLivePhoto,
-               !CCUtility.fileProviderStorageExists(metadataLivePhoto),
+               !NCUtilityFileSystem.shared.fileProviderStorageExists(metadataLivePhoto),
                let appDelegate = (UIApplication.shared.delegate as? AppDelegate),
                appDelegate.downloadQueue.operations.filter({ ($0 as? NCOperationDownload)?.metadata.ocId == metadata.ocId }).isEmpty {
                 appDelegate.downloadQueue.addOperation(NCOperationDownload(metadata: metadataLivePhoto, selector: ""))