Browse Source

coding

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

+ 4 - 3
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -61,6 +61,7 @@ class NCActivityTableViewCell: UITableViewCell, NCCellProtocol {
         get {
             return nil
         }
+        set {}
     }
     var filePreviewImageView: UIImageView? {
         get {
@@ -79,19 +80,19 @@ class NCActivityTableViewCell: UITableViewCell, NCCellProtocol {
         get {
             return nil
         }
-        set { }
+        set {}
     }
     var info: String? {
         get {
             return nil
         }
-        set { }
+        set {}
     }
     var progress: UIProgressView? {
         get {
             return nil
         }
-        set { }
+        set {}
     }
 
     override func awakeFromNib() {

+ 41 - 2
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1472,6 +1472,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             }
         }
 
+        var cell: UICollectionViewCell?
         var isShare = false
         var isMounted = false
 
@@ -1482,16 +1483,53 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
 
         let tableShare = dataSource.metadatasForSection[indexPath.section].metadataShare[metadata.ocId]
 
+
         //
         // 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
+            }
+        }
 
-            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
-            cell.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 {
             cell.fileObjectId = metadata.ocId
             cell.fileUser = metadata.ownerId
+        }
+
+
+
+        return cell!
+
+
+
+
+/*
+
+
+        //
+        // LAYOUT LIST
+        //
+        if layoutForView?.layout == NCGlobal.shared.layoutList {
+
+//            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
+//            cell.delegate = self
+
+//            cell.fileObjectId = metadata.ocId
+            cell.fileUser = metadata.ownerId
             cell.labelTitle.textColor = NCBrandColor.shared.label
             cell.labelInfo.textColor = NCBrandColor.shared.systemGray
             cell.titleInfoTrailingDefault()
@@ -1844,6 +1882,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         }
 
         return collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
+ */
     }
 
     func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {

+ 2 - 2
iOSClient/Main/NCCellProtocol.swift

@@ -25,9 +25,9 @@ import UIKit
 
 protocol NCCellProtocol {
     var fileAvatarImageView: UIImageView? { get }
-    var fileObjectId: String? { get }
+    var fileObjectId: String? { get set }
     var filePreviewImageView: UIImageView? { get }
-    var fileUser: String? { get }
+    var fileUser: String? { get set }
     var title: String? { get set }
     var info: String? { get set }
     var progress: UIProgressView? { get set }

+ 1 - 0
iOSClient/Notification/NCNotification.swift

@@ -337,6 +337,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol {
         get {
             return nil
         }
+        set {}
     }
     var fileUser: String? {
         get {

+ 8 - 2
iOSClient/Share/NCShareCommentsCell.swift

@@ -44,10 +44,16 @@ class NCShareCommentsCell: UITableViewCell, NCCellProtocol {
         return imageItem
     }
     var fileObjectId: String? {
-        return nil
+        get {
+            return nil
+        }
+        set {}
     }
     var fileUser: String? {
-        return tableComments?.actorId
+        get {
+            return tableComments?.actorId
+        }
+        set {}
     }
     var title: String? {
         get {

+ 19 - 3
iOSClient/Share/NCShareUserCell.swift

@@ -39,10 +39,20 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol {
     weak var delegate: NCShareUserCellDelegate?
 
     var fileAvatarImageView: UIImageView? { return imageItem }
-    var fileObjectId: String? { return nil }
     var filePreviewImageView: UIImageView? { return nil }
-    var fileUser: String? { return tableShare?.shareWith }
+    var fileUser: String? {
+        get {
+            return tableShare?.shareWith
+        }
+        set {}
+    }
 
+    var fileObjectId: String? {
+        get {
+            return nil
+        }
+        set {}
+    }
     var title: String? {
         get {
             return labelTitle.text
@@ -157,8 +167,14 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
     private var user: String = ""
 
     var fileAvatarImageView: UIImageView? { return imageItem }
-    var fileObjectId: String? { return nil }
     var filePreviewImageView: UIImageView? { return nil }
+
+    var fileObjectId: String? {
+        get {
+            return nil
+        }
+        set {}
+    }
     var fileUser: String? {
         get {
             return user