Skip to content

Commit d883e9b

Browse files
committed
WIP
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
1 parent 855834c commit d883e9b

File tree

11 files changed

+31
-44
lines changed

11 files changed

+31
-44
lines changed

Share/NCShareExtension+DataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extension NCShareExtension: UICollectionViewDataSource {
8383
}
8484

8585
cell.metadata = metadata
86-
cell.setFilename(metadata.fileNameView, isDirectory: metadata.directory)
86+
cell.setBidiSafeFilename(metadata.fileNameView, isDirectory: metadata.directory, titleLabel: cell.labelTitle, extensionLabel: cell.labelExtension)
8787
cell.labelTitle.textColor = NCBrandColor.shared.textColor
8888
cell.labelExtension?.textColor = NCBrandColor.shared.textColor
8989
cell.labelExtension?.font = .systemFont(ofSize: 15)

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,6 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
118118
}
119119
}
120120

121-
func setFilename(_ filename: String, isDirectory: Bool) {
122-
setBidiSafeFilename(filename, isDirectory: isDirectory, titleLabel: labelTitle, extensionLabel: labelExtension)
123-
124-
if labelExtension?.isHidden ?? true {
125-
labelTitle.numberOfLines = 2
126-
labelTitle.lineBreakMode = .byWordWrapping
127-
} else {
128-
labelTitle.numberOfLines = 1
129-
labelTitle.lineBreakMode = .byTruncatingTail
130-
}
131-
}
132-
133121
func setButtonMore(image: UIImage) {
134122
buttonMore.setImage(image, for: .normal)
135123
}
@@ -252,7 +240,15 @@ extension NCCollectionViewCommon {
252240
cell.writeInfoDateSize(date: metadata.date, size: metadata.size)
253241
}
254242

255-
cell.setFilename(metadata.fileNameView, isDirectory: metadata.directory)
243+
cell.setBidiSafeFilename(metadata.fileNameView, isDirectory: metadata.directory, titleLabel: cell.labelTitle, extensionLabel: cell.labelExtension)
244+
245+
if cell.labelExtension?.isHidden ?? true {
246+
cell.labelTitle.numberOfLines = 2
247+
cell.labelTitle.lineBreakMode = .byWordWrapping
248+
} else {
249+
cell.labelTitle.numberOfLines = 1
250+
cell.labelTitle.lineBreakMode = .byTruncatingTail
251+
}
256252

257253
// Accessibility [shared] if metadata.ownerId != appDelegate.userId, appDelegate.account == metadata.account {
258254
if metadata.ownerId != metadata.userId {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellMainP
152152
return buttonMore.frame.contains(location)
153153
}
154154

155-
func setFilename(_ filename: String, isDirectory: Bool) {
156-
setBidiSafeFilename(filename, isDirectory: isDirectory, titleLabel: labelTitle, extensionLabel: labelExtension)
157-
}
158-
159155
func titleInfoTrailingFull() {
160156
titleTrailingConstraint.constant = 10
161157
}
@@ -442,7 +438,7 @@ extension NCCollectionViewCommon {
442438
cell.writeInfoDateSize(date: metadata.date, size: metadata.size)
443439
}
444440

445-
cell.setFilename(metadata.fileNameView, isDirectory: metadata.directory)
441+
cell.setBidiSafeFilename(metadata.fileNameView, isDirectory: metadata.directory, titleLabel: cell.labelTitle, extensionLabel: cell.labelExtension)
446442

447443
// Accessibility [shared] if metadata.ownerId != appDelegate.userId, appDelegate.account == metadata.account {
448444
if metadata.ownerId != metadata.userId {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ class NCRecommendationsCell: UICollectionViewCell, UIGestureRecognizerDelegate {
6969
}
7070
}
7171

72-
func setFilename(_ filename: String, isDirectory: Bool) {
73-
setBidiSafeFilename(filename, isDirectory: isDirectory, titleLabel: labelFilename, extensionLabel: labelExtensionFilename)
74-
}
75-
7672
func setImageCorner(withBorder: Bool) {
7773
image.layer.cornerRadius = 10
7874
image.layer.masksToBounds = true

iOSClient/Main/Collection Common/Section Header Footer/NCSectionFirstHeader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ extension NCSectionFirstHeader: UICollectionViewDataSource {
216216
cell.setImageCorner(withBorder: false)
217217
}
218218

219-
cell.setFilename(metadata.fileNameView, isDirectory: metadata.directory)
219+
cell.setBidiSafeFilename(metadata.fileNameView, isDirectory: metadata.directory, titleLabel: cell.labelFilename, extensionLabel: cell.labelExtensionFilename)
220220
cell.labelInfo.text = recommendedFiles.reason
221221

222222
cell.delegate = self

iOSClient/Main/Create/NCCreateFormUploadConflict.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
325325
cell.switchAlreadyExistingFile.onTintColor = NCBrandColor.shared.getElement(account: metadataNewFile.account)
326326
cell.ocId = metadataNewFile.ocId
327327
cell.delegate = self
328-
cell.setFilename(metadataNewFile.fileNameView, isDirectory: metadataNewFile.directory)
328+
cell.setBidiSafeFilename(metadataNewFile.fileNameView, isDirectory: metadataNewFile.directory, titleLabel: cell.labelFileName, extensionLabel: cell.labelExtensionFileName)
329329
cell.labelDetailAlreadyExistingFile.text = ""
330330
cell.labelDetailNewFile.text = ""
331331

iOSClient/Main/Create/NCCreateFormUploadConflictCell.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class NCCreateFormUploadConflictCell: UITableViewCell {
4040
weak var delegate: NCCreateFormUploadConflictCellDelegate?
4141
var ocId: String = ""
4242

43-
func setFilename(_ filename: String, isDirectory: Bool) {
44-
setBidiSafeFilename(filename, isDirectory: isDirectory, titleLabel: labelFileName, extensionLabel: labelExtensionFileName)
45-
}
46-
4743
@IBAction func valueChangedSwitchNewFile(_ sender: Any) {
4844
delegate?.valueChangedSwitchNewFile(with: ocId, isOn: switchNewFile.isOn)
4945
}

iOSClient/Select/NCSelect.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ extension NCSelect: UICollectionViewDataSource {
393393
isMounted = metadata.permissions.contains(NCMetadataPermissions.permissionMounted) && !metadataFolder.permissions.contains(NCMetadataPermissions.permissionMounted)
394394

395395
cell.metadata = metadata
396-
cell.setFilename(metadata.fileNameView, isDirectory: metadata.directory)
396+
cell.setBidiSafeFilename(metadata.fileNameView, isDirectory: metadata.directory, titleLabel: cell.labelTitle, extensionLabel: cell.labelExtension)
397397
cell.labelTitle.textColor = NCBrandColor.shared.textColor
398398
cell.labelExtension?.textColor = NCBrandColor.shared.textColor
399399
cell.labelExtension?.font = .systemFont(ofSize: 15)

iOSClient/Trash/Cell/NCTrashCellProtocol.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ protocol NCTrashCellProtocol {
3232
var account: String { get set }
3333

3434
func selected(_ status: Bool, isEditMode: Bool, account: String)
35-
func setFilename(_ filename: String, isDirectory: Bool)
3635
}
3736

3837
extension NCTrashCellProtocol where Self: UICollectionViewCell {
3938
mutating func setupCellUI(tableTrash: tableTrash, image: UIImage?) {
4039
self.objectId = tableTrash.fileId
41-
self.setFilename(tableTrash.trashbinFileName, isDirectory: tableTrash.directory)
40+
41+
setBidiSafeFilename(tableTrash.trashbinFileName, isDirectory: tableTrash.directory, titleLabel: labelTitle, extensionLabel: labelExtension)
42+
4243
self.labelTitle.textColor = NCBrandColor.shared.textColor
4344
self.labelExtension?.textColor = NCBrandColor.shared.textColor
4445
if self is NCTrashListCell {
@@ -61,5 +62,15 @@ extension NCTrashCellProtocol where Self: UICollectionViewCell {
6162
let base = nsName.deletingPathExtension
6263
let a11yName = (tableTrash.directory || ext.isEmpty || base.isEmpty) ? tableTrash.trashbinFileName : base + "." + ext
6364
self.accessibilityLabel = a11yName + ", " + (self.labelInfo?.text ?? "")
65+
66+
if self is NCTrashGridCell {
67+
if labelExtension?.isHidden ?? true {
68+
labelTitle.numberOfLines = 2
69+
labelTitle.lineBreakMode = .byWordWrapping
70+
} else {
71+
labelTitle.numberOfLines = 1
72+
labelTitle.lineBreakMode = .byTruncatingTail
73+
}
74+
}
6475
}
6576
}

iOSClient/Trash/Cell/NCTrashGridCell.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol {
7171
labelExtension?.isHidden = true
7272
labelInfo.text = ""
7373
labelSubinfo.text = ""
74-
}
75-
76-
override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
77-
return nil
78-
}
79-
80-
func setFilename(_ filename: String, isDirectory: Bool) {
81-
setBidiSafeFilename(filename, isDirectory: isDirectory, titleLabel: labelTitle, extensionLabel: labelExtension)
8274

8375
if labelExtension?.isHidden ?? true {
8476
labelTitle.numberOfLines = 2
@@ -89,6 +81,10 @@ class NCTrashGridCell: UICollectionViewCell, NCTrashCellProtocol {
8981
}
9082
}
9183

84+
override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
85+
return nil
86+
}
87+
9288
@IBAction func touchUpInsideMore(_ sender: Any) {
9389
delegate?.tapMoreGridItem(with: objectId, image: imageItem.image, sender: sender)
9490
}

0 commit comments

Comments
 (0)