diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index b7f116f5e3..75edef0975 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -1254,7 +1254,12 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { } } - func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { } + func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { + if !collectionView.indexPathsForVisibleItems.contains(indexPath) { + guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return } + NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata) + } + } func numberOfSections(in collectionView: UICollectionView) -> Int { return dataSource.numberOfSections()