diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index c2eb2b33b5..df69d96e3b 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -1733,15 +1733,14 @@ class NCCollectionViewDownloadThumbnail: ConcurrentOperation { etagResource = metadata.etagResource } - NextcloudKit.shared.downloadPreview( - fileNamePathOrFileId: fileNamePath, - fileNamePreviewLocalPath: fileNamePreviewLocalPath, - widthPreview: NCGlobal.shared.sizePreview, - heightPreview: NCGlobal.shared.sizePreview, - fileNameIconLocalPath: fileNameIconLocalPath, - sizeIcon: NCGlobal.shared.sizeIcon, - etag: etagResource, - options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, _, imageIcon, _, etag, error in + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, + fileNamePreviewLocalPath: fileNamePreviewLocalPath, + widthPreview: NCGlobal.shared.sizePreview, + heightPreview: NCGlobal.shared.sizePreview, + fileNameIconLocalPath: fileNameIconLocalPath, + sizeIcon: NCGlobal.shared.sizeIcon, + etag: etagResource, + options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, _, imageIcon, _, etag, error in if error == .success, let image = imageIcon { NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag) diff --git a/iOSClient/Media/NCMedia.swift b/iOSClient/Media/NCMedia.swift index b78744f713..7ec6d72ff4 100644 --- a/iOSClient/Media/NCMedia.swift +++ b/iOSClient/Media/NCMedia.swift @@ -884,15 +884,14 @@ class NCMediaDownloadThumbnaill: ConcurrentOperation { etagResource = metadata.etagResource } - NextcloudKit.shared.downloadPreview( - fileNamePathOrFileId: fileNamePath, - fileNamePreviewLocalPath: fileNamePreviewLocalPath, - widthPreview: NCGlobal.shared.sizePreview, - heightPreview: NCGlobal.shared.sizePreview, - fileNameIconLocalPath: fileNameIconLocalPath, - sizeIcon: NCGlobal.shared.sizeIcon, - etag: etagResource, - options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, etag, error in + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, + fileNamePreviewLocalPath: fileNamePreviewLocalPath, + widthPreview: NCGlobal.shared.sizePreview, + heightPreview: NCGlobal.shared.sizePreview, + fileNameIconLocalPath: fileNameIconLocalPath, + sizeIcon: NCGlobal.shared.sizeIcon, + etag: etagResource, + options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, etag, error in if error == .success, let image = imagePreview { NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag) diff --git a/iOSClient/Networking/NCOperationQueue.swift b/iOSClient/Networking/NCOperationQueue.swift index e8746e70f1..523e0f1ea6 100644 --- a/iOSClient/Networking/NCOperationQueue.swift +++ b/iOSClient/Networking/NCOperationQueue.swift @@ -139,14 +139,13 @@ class NCOperationDownloadThumbnailActivity: ConcurrentOperation { guard !isCancelled else { return self.finish() } - NextcloudKit.shared.downloadPreview( - fileNamePathOrFileId: fileNamePathOrFileId, - fileNamePreviewLocalPath: fileNamePreviewLocalPath, - widthPreview: 0, - heightPreview: 0, - etag: nil, - useInternalEndpoint: false, - options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, _, error in + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, + fileNamePreviewLocalPath: fileNamePreviewLocalPath, + widthPreview: 0, + heightPreview: 0, + etag: nil, + useInternalEndpoint: false, + options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, _, error in if error == .success, let imagePreview = imagePreview { DispatchQueue.main.async { diff --git a/iOSClient/Trash/NCTrash.swift b/iOSClient/Trash/NCTrash.swift index 2b1c1cdf46..45c9eb9ac1 100644 --- a/iOSClient/Trash/NCTrash.swift +++ b/iOSClient/Trash/NCTrash.swift @@ -350,22 +350,21 @@ extension NCTrash { let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName)! let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName)! - NextcloudKit.shared.downloadPreview( - fileNamePathOrFileId: tableTrash.fileId, - fileNamePreviewLocalPath: fileNamePreviewLocalPath, - widthPreview: NCGlobal.shared.sizePreview, - heightPreview: NCGlobal.shared.sizePreview, - fileNameIconLocalPath: fileNameIconLocalPath, - sizeIcon: NCGlobal.shared.sizeIcon, - etag: nil, - endpointTrashbin: true) { account, _, imageIcon, _, _, error in - guard error == .success, let imageIcon = imageIcon, account == self.appDelegate.account, - let cell = self.collectionView.cellForItem(at: indexPath) else { return } - if let cell = cell as? NCTrashListCell { - cell.imageItem.image = imageIcon - } else if let cell = cell as? NCGridCell { - cell.imageItem.image = imageIcon - } // else: undefined cell - } + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: tableTrash.fileId, + fileNamePreviewLocalPath: fileNamePreviewLocalPath, + widthPreview: NCGlobal.shared.sizePreview, + heightPreview: NCGlobal.shared.sizePreview, + fileNameIconLocalPath: fileNameIconLocalPath, + sizeIcon: NCGlobal.shared.sizeIcon, + etag: nil, + endpointTrashbin: true) { account, _, imageIcon, _, _, error in + guard error == .success, let imageIcon = imageIcon, account == self.appDelegate.account, + let cell = self.collectionView.cellForItem(at: indexPath) else { return } + if let cell = cell as? NCTrashListCell { + cell.imageItem.image = imageIcon + } else if let cell = cell as? NCGridCell { + cell.imageItem.image = imageIcon + } // else: undefined cell + } } }