marinofaggiana 4 жил өмнө
parent
commit
3262b92625

+ 1 - 1
iOSClient/Main/Cell/NCListCell.swift

@@ -118,7 +118,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCImageCell
         sharedLeftConstraint.constant = 5
     }
     
-    func hideButtonShare(status: Bool) {
+    func hideButtonShare(_ status: Bool) {
         imageShared.isHidden = status
         buttonShared.isHidden = status
     }

+ 8 - 1
iOSClient/Main/Collection/NCCollectionCommon.swift

@@ -83,7 +83,7 @@ class NCCollectionCommon: NSObject {
     
     // MARK: -
     
-    func cellForItemAt(indexPath: IndexPath, collectionView: UICollectionView, cell: UICollectionViewCell, metadata: tableMetadata, metadataFolder: tableMetadata?, serverUrl: String, isEditMode: Bool, selectocId: [String], autoUploadFileName: String, autoUploadDirectory: String, hideButtonMore: Bool, downloadThumbnail: Bool, shares: [tableShare]?, source: UIViewController, dataSource: NCDataSource?) {
+    func cellForItemAt(indexPath: IndexPath, collectionView: UICollectionView, cell: UICollectionViewCell, metadata: tableMetadata, metadataFolder: tableMetadata?, serverUrl: String, isEditMode: Bool, isEncryptedFolder: Bool, selectocId: [String], autoUploadFileName: String, autoUploadDirectory: String, hideButtonMore: Bool, downloadThumbnail: Bool, shares: [tableShare]?, source: UIViewController, dataSource: NCDataSource?) {
         
         var tableShare: tableShare?
         
@@ -291,6 +291,13 @@ class NCCollectionCommon: NSObject {
                 cell.imageStatus.image = NCCollectionCommonImages.cellLivePhotoImage
             }
             
+            // E2EE
+            if metadata.e2eEncrypted || isEncryptedFolder {
+                cell.hideButtonShare(true)
+            } else {
+                cell.hideButtonShare(false)
+            }
+            
             // Remove last separator
             if collectionView.numberOfItems(inSection: indexPath.section) == indexPath.row + 1 {
                 cell.separator.isHidden = true

+ 5 - 1
iOSClient/Main/Collection/NCCollectionViewCommon.swift

@@ -35,6 +35,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
        
+    internal var isEncryptedFolder = false
     internal var isEditMode = false
     internal var selectOcId: [String] = []
     internal var metadatasSource: [tableMetadata] = []
@@ -875,6 +876,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl))
         richWorkspaceText = directory?.richWorkspace
         
+        // E2EE
+        isEncryptedFolder = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: metadataFolder?.e2eEncrypted ?? false, account: appDelegate.account, urlBase: appDelegate.urlBase)
+
         // get auto upload folder
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
         autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(urlBase: appDelegate.urlBase, account: appDelegate.account)
@@ -1132,7 +1136,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         
         let shares = NCManageDatabase.sharedInstance.getTableShares(account: metadata.account, serverUrl: metadata.serverUrl, fileName: metadata.fileName)
         
-        NCCollectionCommon.shared.cellForItemAt(indexPath: indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectocId: selectOcId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, downloadThumbnail: true, shares: shares, source: self, dataSource: dataSource)
+        NCCollectionCommon.shared.cellForItemAt(indexPath: indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: metadata.serverUrl, isEditMode: isEditMode, isFolderEncrypted: isEncryptedFolder,selectocId: selectOcId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, downloadThumbnail: true, shares: shares, source: self, dataSource: dataSource)
         
         return cell
     }

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -459,7 +459,7 @@ extension NCSelect: UICollectionViewDataSource {
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
         }
         
-        NCCollectionCommon.shared.cellForItemAt(indexPath: indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: serverUrl, isEditMode: isEditMode, selectocId: selectocId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory ,hideButtonMore: true, downloadThumbnail: true, shares: shares, source: self, dataSource: dataSource)
+        NCCollectionCommon.shared.cellForItemAt(indexPath: indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: serverUrl, isEditMode: isEditMode, isEncryptedFolder: false, selectocId: selectocId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory ,hideButtonMore: true, downloadThumbnail: true, shares: shares, source: self, dataSource: dataSource)
         
         if layout == k_layout_grid {
             let cell = cell as! NCGridCell