Browse Source

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
7e35bb727a

+ 0 - 2
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -105,8 +105,6 @@ class NCActivityTableViewCell: UITableViewCell, NCCellProtocol {
 
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {}
     func setButtonMore(named: String, image: UIImage) {}
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }
 
 // MARK: - Collection View

+ 12 - 30
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1486,26 +1486,28 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         // LAYOUT LIST
         if layoutForView?.layout == NCGlobal.shared.layoutList {
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCListCell
-            if cell is NCListCell {
-                (cell as? NCListCell)?.delegate = self
-            }
         }
 
         // LAYOUT GRID
         if layoutForView?.layout == NCGlobal.shared.layoutGrid {
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCGridCell
-            if cell is NCGridCell {
-                (cell as? NCGridCell)?.delegate = self
-            }
         }
 
         if var cell = cell as? NCCellProtocol {
 
+            if cell is NCListCell {
+                (cell as? NCListCell)?.delegate = self
+                (cell as? NCListCell)?.titleInfoTrailingDefault()
+            }
+
+            if cell is NCGridCell {
+                (cell as? NCGridCell)?.delegate = self
+            }
+
             cell.fileObjectId = metadata.ocId
             cell.fileUser = metadata.ownerId
             cell.title?.textColor = NCBrandColor.shared.label
             cell.info?.textColor = NCBrandColor.shared.systemGray
-            cell.titleInfoTrailingDefault()
 
             if isSearching {
                 cell.title?.text = metadata.fileName
@@ -1514,7 +1516,9 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
                     cell.info?.text = NSLocalizedString("_in_", comment: "") + " " + NCUtilityFileSystem.shared.getPath(metadata: metadata, withFileName: false)
                 } else {
                     cell.info?.text = metadata.subline
-                    cell.titleInfoTrailingFull()
+                    if cell is NCListCell {
+                        (cell as? NCListCell)?.titleInfoTrailingFull()
+                    }
                 }
                 if let literalSearch = self.literalSearch {
                     let longestWordRange = (metadata.fileName.lowercased() as NSString).range(of: literalSearch)
@@ -1546,28 +1550,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         if layoutForView?.layout == NCGlobal.shared.layoutList {
 
 
-
-            if isSearching {
-                cell.labelTitle.text = metadata.fileName
-                cell.labelTitle.lineBreakMode = .byTruncatingTail
-                if metadata.name == NCGlobal.shared.appName {
-                    cell.labelInfo.text = NSLocalizedString("_in_", comment: "") + " " + NCUtilityFileSystem.shared.getPath(metadata: metadata, withFileName: false)
-                } else {
-                    cell.labelInfo.text = metadata.subline
-                    cell.titleInfoTrailingFull()
-                }
-                if let literalSearch = self.literalSearch {
-                    let longestWordRange = (metadata.fileName.lowercased() as NSString).range(of: literalSearch)
-                    let attributedString = NSMutableAttributedString(string: metadata.fileName, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 15)])
-                    attributedString.setAttributes([NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 15)], range: longestWordRange)
-                    cell.labelTitle.attributedText = attributedString
-                }
-            } else {
-                cell.labelTitle.text = metadata.fileNameView
-                cell.labelTitle.lineBreakMode = .byTruncatingMiddle
-                cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date) + " · " + CCUtility.transformedSize(metadata.size)
-            }
-
             cell.imageSelect.image = nil
             cell.imageStatus.image = nil
             cell.imageLocal.image = nil

+ 0 - 3
iOSClient/Main/Collection Common/NCGridCell.swift

@@ -207,9 +207,6 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
 
         labelInfo.text = dateFormatter.string(from: date as Date) + " · " + CCUtility.transformedSize(totalBytes)
     }
-
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }
 
 protocol NCGridCellDelegate: AnyObject {

+ 0 - 2
iOSClient/Main/NCCellProtocol.swift

@@ -32,8 +32,6 @@ protocol NCCellProtocol {
     var info: UILabel? { get set }
     var progress: UIProgressView? { get set }
 
-    func titleInfoTrailingDefault()
-    func titleInfoTrailingFull()
     func writeInfoDateSize(date: NSDate, totalBytes: Int64)
     func setButtonMore(named: String, image: UIImage)
 }

+ 0 - 2
iOSClient/Media/Cell/NCGridMediaCell.swift

@@ -116,6 +116,4 @@ class NCGridMediaCell: UICollectionViewCell, NCCellProtocol {
 
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {}
     func setButtonMore(named: String, image: UIImage) {}
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }

+ 0 - 2
iOSClient/Notification/NCNotification.swift

@@ -387,8 +387,6 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol {
 
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {}
     func setButtonMore(named: String, image: UIImage) {}
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }
 
 protocol NCNotificationCellDelegate: AnyObject {

+ 0 - 2
iOSClient/Share/NCShareCommentsCell.swift

@@ -84,8 +84,6 @@ class NCShareCommentsCell: UITableViewCell, NCCellProtocol {
 
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {}
     func setButtonMore(named: String, image: UIImage) {}
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }
 
 protocol NCShareCommentsCellDelegate: AnyObject {

+ 0 - 2
iOSClient/Share/NCShareUserCell.swift

@@ -225,6 +225,4 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
 
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {}
     func setButtonMore(named: String, image: UIImage) {}
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }

+ 0 - 3
iOSClient/Transfers/NCTransferCell.swift

@@ -157,9 +157,6 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellP
     func writeInfoDateSize(date: NSDate, totalBytes: Int64) {
         labelInfo.text = CCUtility.dateDiff(date as Date) + " · " + CCUtility.transformedSize(totalBytes)
     }
-
-    func titleInfoTrailingDefault() {}
-    func titleInfoTrailingFull() {}
 }
 
 protocol NCTransferCellDelegate: AnyObject {