Skip to content

Commit 4350fd3

Browse files
NMC 2157 - Move copy customisation changes
1 parent 5df1384 commit 4350fd3

2 files changed

Lines changed: 76 additions & 124 deletions

File tree

iOSClient/Main/Collection Common/Cell/NCListCell.swift

Lines changed: 21 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
1717
@IBOutlet weak var imageSelect: UIImageView!
1818
@IBOutlet weak var imageStatus: UIImageView!
1919
@IBOutlet weak var imageFavorite: UIImageView!
20+
// @IBOutlet weak var imageFavoriteBackground: UIImageView!
2021
@IBOutlet weak var imageLocal: UIImageView!
2122

2223
@IBOutlet weak var labelTitle: UILabel!
@@ -63,9 +64,17 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
6364
set { labelInfo = newValue }
6465
}
6566

66-
var fileSharedLabel: UILabel? {
67-
get { return labelShared }
68-
set { labelShared = newValue }
67+
override var accessibilityIdentifier: String? {
68+
get {
69+
super.accessibilityIdentifier
70+
}
71+
set {
72+
super.accessibilityIdentifier = newValue
73+
74+
if let newValue {
75+
buttonShared.accessibilityIdentifier = "\(newValue)/shareButton"
76+
}
77+
}
6978
}
7079

7180
override func awakeFromNib() {
@@ -81,26 +90,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
8190

8291
override func prepareForReuse() {
8392
super.prepareForReuse()
84-
8593
initCell()
8694
}
8795

8896
func initCell() {
89-
90-
imageItem.layer.cornerRadius = 6
91-
imageItem.layer.masksToBounds = true
92-
imageStatus.image = nil
93-
imageFavorite.image = nil
94-
imageFavoriteBackground.isHidden = true
95-
imageLocal.image = nil
96-
labelTitle.text = ""
97-
labelInfo.text = ""
98-
labelSubinfo.text = ""
99-
imageShared.image = nil
100-
imageMore.image = nil
101-
102-
// use entire cell as accessibility element
103-
10497
accessibilityHint = nil
10598
accessibilityLabel = nil
10699
accessibilityValue = nil
@@ -111,6 +104,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
111104
imageItem.layer.masksToBounds = true
112105
imageStatus.image = nil
113106
imageFavorite.image = nil
107+
// imageFavoriteBackground.isHidden = true
114108
imageLocal.image = nil
115109

116110
buttonShared.setImage(nil, for: .normal)
@@ -195,24 +189,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
195189
override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
196190
return nil
197191
}
198-
199-
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
200-
super.traitCollectionDidChange(previousTraitCollection)
201-
updateConstraintsForCurrentDevice()
202-
}
203192

204-
func updateConstraintsForCurrentDevice() {
205-
if labelShared?.isHidden == false {
206-
iPhoneLabelTitleTrailingConstraint.isActive = false
207-
iPadLabelTitleTrailingConstraint.isActive = true
208-
} else {
209-
iPhoneLabelTitleTrailingConstraint.isActive = true
210-
iPadLabelTitleTrailingConstraint.isActive = false
211-
}
212-
// iPhoneLabelTitleTrailingConstraint.isActive = UIDevice.current.userInterfaceIdiom == .pad ? false : true
213-
// iPadLabelTitleTrailingConstraint.isActive = UIDevice.current.userInterfaceIdiom == .pad ? true : false
214-
}
215-
216193
@IBAction func touchUpInsideShare(_ sender: Any) {
217194
delegate?.tapShareListItem(with: metadata, button: buttonShared, sender: sender)
218195
}
@@ -265,47 +242,26 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
265242
moreContainer.isHidden = false
266243
backgroundView = nil
267244
}
268-
}
269-
270-
func selected(_ status: Bool, isEditMode: Bool) {
271-
// 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
272-
guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), !metadata.isInTransfer, !metadata.e2eEncrypted else {
273-
// guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), !metadata.e2eEncrypted else {
274-
backgroundView = nil
275-
separator.isHidden = false
276-
imageSelect.isHidden = true
277-
278-
return
279-
}
280-
281245
if status {
282-
var blurEffect: UIVisualEffect?
283246
var blurEffectView: UIView?
284-
if traitCollection.userInterfaceStyle == .dark {
285-
blurEffect = UIBlurEffect(style: .dark)
286-
blurEffectView = UIVisualEffectView(effect: blurEffect)
287-
blurEffectView?.backgroundColor = .black
288-
} else {
289-
blurEffect = UIBlurEffect(style: .extraLight)
290-
blurEffectView = UIVisualEffectView(effect: blurEffect)
291-
blurEffectView?.backgroundColor = .lightGray
292-
}
247+
blurEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
248+
blurEffectView?.backgroundColor = .lightGray
293249
blurEffectView?.frame = self.bounds
294250
blurEffectView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
295251
imageSelect.image = NCImageCache.shared.getImageCheckedYes(color: color)
296252
backgroundView = blurEffectView
297-
imageSelect.image = NCImageCache.images.checkedYes
298253
separator.isHidden = true
299254
} else {
300255
imageSelect.image = NCImageCache.shared.getImageCheckedNo(color: color)
301256
backgroundView = nil
302257
separator.isHidden = false
303258
}
259+
304260
}
305261

306262
func writeInfoDateSize(date: NSDate, size: Int64) {
307-
labelInfo.text = NCUtility().getRelativeDateTitle(date as Date) + " · " + NCUtilityFileSystem().transformedSize(size)
308-
labelSubinfo.text = ""
263+
labelInfo.text = NCUtility().getRelativeDateTitle(date as Date)
264+
labelSubinfo.text = NCUtilityFileSystem().transformedSize(size)
309265
}
310266

311267
func setAccessibility(label: String, value: String) {
@@ -404,7 +360,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
404360
}
405361
}
406362
}
407-
363+
408364
override func layoutSubviews() {
409365
super.layoutSubviews()
410366
// Keep the shadow path in sync with current bounds
@@ -419,9 +375,8 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
419375

420376
protocol NCListCellDelegate: AnyObject {
421377
func tapShareListItem(with ocId: String, ocIdTransfer: String, sender: Any)
422-
func tapMoreListItem(with ocId: String, ocIdTransfer: String, namedButtonMore: String, image: UIImage?, sender: Any)
423-
func longPressMoreListItem(with ocId: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
424-
func longPressListItem(with ocId: String, ocIdTransfer: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
378+
func tapMoreListItem(with ocId: String, ocIdTransfer: String, image: UIImage?, sender: Any)
379+
func longPressListItem(with ocId: String, ocIdTransfer: String, gestureRecognizer: UILongPressGestureRecognizer)
425380
}
426381

427382
// MARK: - List Layout

0 commit comments

Comments
 (0)