|
@@ -428,13 +428,22 @@ extension NCMedia: UICollectionViewDataSource {
|
|
|
|
|
|
return metadatas.count
|
|
|
}
|
|
|
+
|
|
|
+ func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
|
+ let metadata = metadatas[indexPath.row]
|
|
|
+ NCOperationQueue.shared.downloadThumbnail(metadata: metadata, activeUrl: self.appDelegate.activeUrl, view: self.collectionView as Any, indexPath: indexPath)
|
|
|
+ }
|
|
|
|
|
|
+ func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
|
+ let metadata = metadatas[indexPath.row]
|
|
|
+ NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata)
|
|
|
+ }
|
|
|
+
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
|
|
|
|
let metadata = metadatas[indexPath.row]
|
|
|
|
|
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridMediaCell
|
|
|
- NCOperationQueue.shared.downloadThumbnail(metadata: metadata, activeUrl: self.appDelegate.activeUrl, view: self.collectionView as Any, indexPath: indexPath)
|
|
|
|
|
|
if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileNameView)) {
|
|
|
cell.imageItem.backgroundColor = nil
|