diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index c7476dd41e..ba400e5bb4 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -5620,8 +5620,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { - kind = exactVersion; - version = 3.0.1; + branch = "preview-fileId"; + kind = branch; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { diff --git a/Widget/Files/FilesData.swift b/Widget/Files/FilesData.swift index 0d49dd3272..17d47d79cc 100644 --- a/Widget/Files/FilesData.swift +++ b/Widget/Files/FilesData.swift @@ -219,11 +219,10 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi if let result = utility.createFilePreviewImage(ocId: file.ocId, etag: file.etag, fileNameView: file.fileName, classFile: file.classFile, status: 0, createPreviewMedia: false) { image = result } else if file.hasPreview { - let fileNamePathOrFileId = utilityFileSystem.getFileNamePath(file.fileName, serverUrl: file.serverUrl, urlBase: file.urlBase, userId: file.userId) let fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(file.ocId, etag: file.etag) let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(file.ocId, etag: file.etag) let sizePreview = NCUtility().getSizePreview(width: Int(file.width), height: Int(file.height)) - let (_, _, imageIcon, _, _, _) = await NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, options: options) + let (_, _, imageIcon, _, _, _) = await NextcloudKit.shared.downloadPreview(fileId: file.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, options: options) if let result = imageIcon { image = result } diff --git a/iOSClient/Activity/NCActivityTableViewCell.swift b/iOSClient/Activity/NCActivityTableViewCell.swift index 5662d92fcb..c66ad0aa84 100644 --- a/iOSClient/Activity/NCActivityTableViewCell.swift +++ b/iOSClient/Activity/NCActivityTableViewCell.swift @@ -247,7 +247,7 @@ class NCOperationDownloadThumbnailActivity: ConcurrentOperation { guard !isCancelled else { return self.finish() } - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, + NextcloudKit.shared.downloadPreview(fileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: 0, heightPreview: 0, diff --git a/iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift b/iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift index c3be24bb0b..88c41edcfd 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift @@ -31,7 +31,6 @@ class NCCollectionViewDownloadThumbnail: ConcurrentOperation { var metadata: tableMetadata var cell: NCCellProtocol? var collectionView: UICollectionView? - var fileNamePath: String var fileNamePreviewLocalPath: String var fileNameIconLocalPath: String let utilityFileSystem = NCUtilityFileSystem() @@ -40,7 +39,6 @@ class NCCollectionViewDownloadThumbnail: ConcurrentOperation { self.metadata = tableMetadata.init(value: metadata) self.cell = cell self.collectionView = collectionView - self.fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId) self.fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) self.fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag) } @@ -55,7 +53,7 @@ class NCCollectionViewDownloadThumbnail: ConcurrentOperation { etagResource = metadata.etagResource } - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, + NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), diff --git a/iOSClient/Media/NCMediaDownloadThumbnaill.swift b/iOSClient/Media/NCMediaDownloadThumbnaill.swift index 6ec3c154b4..990ae51fb3 100644 --- a/iOSClient/Media/NCMediaDownloadThumbnaill.swift +++ b/iOSClient/Media/NCMediaDownloadThumbnaill.swift @@ -29,7 +29,6 @@ class NCMediaDownloadThumbnaill: ConcurrentOperation { var metadata: tableMetadata var media: NCMedia - var fileNamePath: String var fileNamePreviewLocalPath: String var fileNameIconLocalPath: String let utilityFileSystem = NCUtilityFileSystem() @@ -37,7 +36,6 @@ class NCMediaDownloadThumbnaill: ConcurrentOperation { init(metadata: tableMetadata, media: NCMedia) { self.metadata = tableMetadata.init(value: metadata) self.media = media - self.fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId) self.fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) self.fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag) } @@ -52,7 +50,7 @@ class NCMediaDownloadThumbnaill: ConcurrentOperation { etagResource = metadata.etagResource } - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, + NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), diff --git a/iOSClient/Networking/NCNetworking+WebDAV.swift b/iOSClient/Networking/NCNetworking+WebDAV.swift index 09e0f76cf5..90fff7e08e 100644 --- a/iOSClient/Networking/NCNetworking+WebDAV.swift +++ b/iOSClient/Networking/NCNetworking+WebDAV.swift @@ -695,7 +695,7 @@ extension NCNetworking { // MARK: - Download Preview - func downloadPreview(fileNamePathOrFileId: String, + func downloadPreview(fileId: String, fileNamePreviewLocalPath: String, widthPreview: Int, heightPreview: Int, @@ -707,7 +707,7 @@ extension NCNetworking { options: NKRequestOptions = NKRequestOptions()) async -> (account: String, imagePreview: UIImage?, imageIcon: UIImage?, imageOriginal: UIImage?, etag: String?, error: NKError) { await withUnsafeContinuation({ continuation in - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: widthPreview, heightPreview: heightPreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: sizeIcon, etag: etag, options: options) { account, imagePreview, imageIcon, imageOriginal, etag, error in + NextcloudKit.shared.downloadPreview(fileId: fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: widthPreview, heightPreview: heightPreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: sizeIcon, etag: etag, options: options) { account, imagePreview, imageIcon, imageOriginal, etag, error in continuation.resume(returning: (account: account, imagePreview: imagePreview, imageIcon: imageIcon, imageOriginal: imageOriginal, etag: etag, error: error)) } }) diff --git a/iOSClient/Trash/NCTrash+Networking.swift b/iOSClient/Trash/NCTrash+Networking.swift index af08ebcf31..7cd645d552 100644 --- a/iOSClient/Trash/NCTrash+Networking.swift +++ b/iOSClient/Trash/NCTrash+Networking.swift @@ -104,7 +104,7 @@ class NCOperationDownloadThumbnailTrash: ConcurrentOperation { let fileNamePreviewLocalPath = NCUtilityFileSystem().getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName) let fileNameIconLocalPath = NCUtilityFileSystem().getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName) - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: tableTrash.fileId, + NextcloudKit.shared.downloadPreview(fileId: tableTrash.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift index 13308923a1..21845d540a 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift @@ -300,12 +300,11 @@ class NCViewerMedia: UIViewController { if utilityFileSystem.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) { return completion(UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag))) } else { - let fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId) let fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag) let sizePreview = NCUtility().getSizePreview(width: metadata.width, height: metadata.height) - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, + NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height),