Skip to content

Commit

Permalink
Merge pull request #1103 from Infomaniak/fix-list-preview
Browse files Browse the repository at this point in the history
fix(FileCollectionViewCell): Prevent setting thumbnail while selecting
  • Loading branch information
PhilippeWeidmann authored Jan 29, 2024
2 parents b9d14c8 + cbcdbb6 commit 7296fb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kDrive/UI/View/Files/FileCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protocol FileCellDelegate: AnyObject {
]
var file: File
var selectionMode: Bool
var isSelected = false
private var downloadProgressObserver: ObservationToken?
private var downloadObserver: ObservationToken?
var thumbnailDownloadTask: Kingfisher.DownloadTask?
Expand Down Expand Up @@ -148,7 +149,8 @@ protocol FileCellDelegate: AnyObject {
// Fetch thumbnail
thumbnailDownloadTask = file.getThumbnail { [requestFileId = file.id, weak self] image, _ in
guard let self,
!self.file.isInvalidated else {
!self.file.isInvalidated,
!self.isSelected else {
return
}

Expand Down Expand Up @@ -196,6 +198,7 @@ class FileCollectionViewCell: UICollectionViewCell, SwipableCell {

override var isSelected: Bool {
didSet {
viewModel.isSelected = isSelected
configureForSelection()
}
}
Expand Down Expand Up @@ -330,6 +333,7 @@ class FileCollectionViewCell: UICollectionViewCell, SwipableCell {

func configureForSelection() {
guard viewModel?.selectionMode == true else { return }

if isSelected {
configureCheckmarkImage()
configureImport(shouldDisplay: false)
Expand Down

0 comments on commit 7296fb9

Please sign in to comment.