@@ -44,19 +44,19 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
4444 @IBOutlet weak var separatorHeightConstraint : NSLayoutConstraint !
4545 @IBOutlet weak var subInfoTrailingConstraint : NSLayoutConstraint !
4646
47- private var objectId = " "
47+ private var ocId = " "
48+ private var ocIdTransfer = " "
4849 private var user = " "
49- var indexPath = IndexPath ( )
5050
5151 weak var listCellDelegate : NCListCellDelegate ?
5252 var namedButtonMore = " "
5353
5454 var fileAvatarImageView : UIImageView ? {
5555 return imageShared
5656 }
57- var fileObjectId : String ? {
58- get { return objectId }
59- set { objectId = newValue ?? " " }
57+ var fileOcId : String ? {
58+ get { return ocId }
59+ set { ocId = newValue ?? " " }
6060 }
6161 var filePreviewImageView : UIImageView ? {
6262 get { return imageItem }
@@ -118,7 +118,11 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
118118
119119 override func awakeFromNib( ) {
120120 super. awakeFromNib ( )
121+ initCell ( )
122+ }
121123
124+ func initCell( ) {
125+
122126 imageItem. layer. cornerRadius = 6
123127 imageItem. layer. masksToBounds = true
124128
@@ -128,9 +132,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
128132 accessibilityValue = nil
129133 isAccessibilityElement = true
130134
131- progressView. tintColor = NCBrandColor . shared. brandElement
135+ progressView. tintColor = NCBrandColor . shared. brand
132136 progressView. transform = CGAffineTransform ( scaleX: 1.0 , y: 0.5 )
133137 progressView. trackTintColor = . clear
138+ imageSelect. isHidden = true
134139
135140 let longPressedGesture = UILongPressGestureRecognizer ( target: self , action: #selector( longPress ( gestureRecognizer: ) ) )
136141 longPressedGesture. minimumPressDuration = 0.5
@@ -140,36 +145,41 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
140145
141146 separator. backgroundColor = . separator
142147 separatorHeightConstraint. constant = 0.5
148+ titleInfoTrailingDefault ( )
143149
144150 labelTitle. text = " "
145151 labelInfo. text = " "
146152 labelTitle. textColor = . label
147153 labelInfo. textColor = . systemGray
148154 labelSubinfo. textColor = . systemGray
155+ setButtonMore ( named: NCGlobal . shared. buttonMoreMore, image: NCImageCache . images. buttonMore)
156+ imageMore. isHidden = false
157+ buttonMore. isHidden = false
149158 }
150159
151160 override func prepareForReuse( ) {
152161 super. prepareForReuse ( )
153- imageItem. backgroundColor = nil
154- accessibilityHint = nil
155- accessibilityLabel = nil
156- accessibilityValue = nil
162+ initCell ( )
157163 }
158164
159165 override func snapshotView( afterScreenUpdates afterUpdates: Bool ) -> UIView ? {
160166 return nil
161167 }
162168
163169 @IBAction func touchUpInsideShare( _ sender: Any ) {
164- listCellDelegate? . tapShareListItem ( with: objectId , indexPath : indexPath , sender: sender)
170+ listCellDelegate? . tapShareListItem ( with: ocId , ocIdTransfer : ocIdTransfer , sender: sender)
165171 }
166172
167173 @IBAction func touchUpInsideMore( _ sender: Any ) {
168- listCellDelegate? . tapMoreListItem ( with: objectId , namedButtonMore: namedButtonMore, image: imageItem. image, indexPath : indexPath , sender: sender)
174+ listCellDelegate? . tapMoreListItem ( with: ocId , ocIdTransfer : ocIdTransfer , namedButtonMore: namedButtonMore, image: imageItem. image, sender: sender)
169175 }
170176
171177 @objc func longPress( gestureRecognizer: UILongPressGestureRecognizer ) {
172- listCellDelegate? . longPressListItem ( with: objectId, indexPath: indexPath, gestureRecognizer: gestureRecognizer)
178+ listCellDelegate? . longPressListItem ( with: ocId, ocIdTransfer: ocIdTransfer, namedButtonMore: namedButtonMore, gestureRecognizer: gestureRecognizer)
179+ }
180+
181+ @objc func longPressInsideMore( gestureRecognizer: UILongPressGestureRecognizer ) {
182+ listCellDelegate? . longPressMoreListItem ( with: ocId, namedButtonMore: namedButtonMore, gestureRecognizer: gestureRecognizer)
173183 }
174184
175185 fileprivate func setA11yActions( ) {
@@ -215,40 +225,57 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
215225 separator. isHidden = status
216226 }
217227
218- func selected ( _ status: Bool , isEditMode : Bool ) {
219- if isEditMode {
228+ func selectMode ( _ status: Bool ) {
229+ if status {
220230 imageItemLeftConstraint. constant = 45
221231 imageSelect. isHidden = false
222- imageShared. isHidden = true
223232 imageMore. isHidden = true
224233 buttonShared. isHidden = true
225234 buttonMore. isHidden = true
226235 accessibilityCustomActions = nil
227236 } else {
228237 imageItemLeftConstraint. constant = 10
229238 imageSelect. isHidden = true
230- imageShared. isHidden = false
231239 imageMore. isHidden = false
232240 buttonShared. isHidden = false
233241 buttonMore. isHidden = false
234242 backgroundView = nil
235243 setA11yActions ( )
236244 }
245+ }
246+
247+ func selected( _ status: Bool , isEditMode: Bool ) {
248+ // NMC-1190 - iOS - Files - Deleting files while files are still uploading won't delete properly : to fix this issue remove check for !metadata.isInTransfer in below line
249+ guard let metadata = NCManageDatabase . shared. getMetadataFromOcId ( ocId) , !metadata. isInTransfer, !metadata. e2eEncrypted else {
250+ backgroundView = nil
251+ separator. isHidden = false
252+ imageSelect. isHidden = true
253+
254+ return
255+ }
256+
237257 if status {
258+ var blurEffect : UIVisualEffect ?
238259 var blurEffectView : UIView ?
239- blurEffectView = UIVisualEffectView ( effect: UIBlurEffect ( style: . systemMaterial) )
240- blurEffectView? . backgroundColor = . lightGray
260+ if traitCollection. userInterfaceStyle == . dark {
261+ blurEffect = UIBlurEffect ( style: . dark)
262+ blurEffectView = UIVisualEffectView ( effect: blurEffect)
263+ blurEffectView? . backgroundColor = . black
264+ } else {
265+ blurEffect = UIBlurEffect ( style: . extraLight)
266+ blurEffectView = UIVisualEffectView ( effect: blurEffect)
267+ blurEffectView? . backgroundColor = . lightGray
268+ }
241269 blurEffectView? . frame = self . bounds
242270 blurEffectView? . autoresizingMask = [ . flexibleWidth, . flexibleHeight]
243- imageSelect. image = NCImageCache . images. checkedYes
244271 backgroundView = blurEffectView
272+ imageSelect. image = NCImageCache . images. checkedYes
245273 separator. isHidden = true
246274 } else {
247275 imageSelect. image = NCImageCache . images. checkedNo
248276 backgroundView = nil
249277 separator. isHidden = false
250278 }
251-
252279 }
253280
254281 func writeInfoDateSize( date: NSDate , size: Int64 ) {
@@ -263,9 +290,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
263290}
264291
265292protocol NCListCellDelegate : AnyObject {
266- func tapShareListItem( with objectId: String , indexPath: IndexPath , sender: Any )
267- func tapMoreListItem( with objectId: String , namedButtonMore: String , image: UIImage ? , indexPath: IndexPath , sender: Any )
268- func longPressListItem( with objectId: String , indexPath: IndexPath , gestureRecognizer: UILongPressGestureRecognizer )
293+ func tapShareListItem( with ocId: String , ocIdTransfer: String , sender: Any )
294+ func tapMoreListItem( with ocId: String , ocIdTransfer: String , namedButtonMore: String , image: UIImage ? , sender: Any )
295+ func longPressMoreListItem( with ocId: String , namedButtonMore: String , gestureRecognizer: UILongPressGestureRecognizer )
296+ func longPressListItem( with ocId: String , ocIdTransfer: String , namedButtonMore: String , gestureRecognizer: UILongPressGestureRecognizer )
269297}
270298
271299// MARK: - List Layout
0 commit comments