marinofaggiana 4 ani în urmă
părinte
comite
1a3c58deda

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -1859,7 +1859,7 @@
 /* Begin PBXShellScriptBuildPhase section */
 		F75A40001EBCB82B00B213E8 /* ShellScript */ = {
 			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 12;
+			buildActionMask = 8;
 			files = (
 			);
 			inputPaths = (
@@ -1895,7 +1895,7 @@
 			);
 			outputPaths = (
 			);
-			runOnlyForDeploymentPostprocessing = 0;
+			runOnlyForDeploymentPostprocessing = 1;
 			shellPath = /bin/sh;
 			shellScript = "rm -rf ${TMPDIR}/TemporaryItems/*carthage*\n/usr/local/bin/carthage copy-frameworks\n";
 		};

+ 2 - 2
iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift

@@ -70,9 +70,9 @@ extension NCCollectionViewCommon {
         } else {
             if metadata.directory {
                 if metadata.e2eEncrypted {
-                    iconHeader = NCCollectionCommon.NCCollectionCommonImages.cellFolderEncryptedImage
+                    iconHeader = NCCollectionCommon.images.cellFolderEncryptedImage
                 } else {
-                    iconHeader = NCCollectionCommon.NCCollectionCommonImages.cellFolderImage
+                    iconHeader = NCCollectionCommon.images.cellFolderImage
                 }
             } else {
                 iconHeader = UIImage(named: metadata.iconName)

+ 61 - 61
iOSClient/Main/NCCollectionCommon.swift

@@ -31,7 +31,7 @@ class NCCollectionCommon: NSObject {
         return instance
     }()
     
-    struct NCCollectionCommonImages {
+    struct images {
         static var cellFileImage = UIImage()
 
         static var cellSharedImage = UIImage()
@@ -62,31 +62,31 @@ class NCCollectionCommon: NSObject {
     // MARK: -
     
     @objc func createImagesThemingColor() {
-        NCCollectionCommonImages.cellFileImage = UIImage.init(named: "file")!
+        images.cellFileImage = UIImage.init(named: "file")!
         
-        NCCollectionCommonImages.cellSharedImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
-        NCCollectionCommonImages.cellCanShareImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
-        NCCollectionCommonImages.cellShareByLinkImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "sharebylink"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellSharedImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellCanShareImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellShareByLinkImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "sharebylink"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
         
-        NCCollectionCommonImages.cellFavouriteImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 50, height: 50, color: NCBrandColor.sharedInstance.yellowFavorite)
-        NCCollectionCommonImages.cellCommentImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "comment"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
-        NCCollectionCommonImages.cellLivePhotoImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "livePhoto"), width: 50, height: 50, color: NCBrandColor.sharedInstance.textView)
-        NCCollectionCommonImages.cellOfflineFlag = UIImage.init(named: "offlineFlag")!
-        NCCollectionCommonImages.cellLocal = UIImage.init(named: "local")!
+        images.cellFavouriteImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 50, height: 50, color: NCBrandColor.sharedInstance.yellowFavorite)
+        images.cellCommentImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "comment"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellLivePhotoImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "livePhoto"), width: 50, height: 50, color: NCBrandColor.sharedInstance.textView)
+        images.cellOfflineFlag = UIImage.init(named: "offlineFlag")!
+        images.cellLocal = UIImage.init(named: "local")!
             
-        NCCollectionCommonImages.cellFolderEncryptedImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderEncrypted"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderSharedWithMeImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_shared_with_me"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderPublicImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_public"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderGroupImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_group"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderExternalImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_external"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderAutomaticUploadImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderAutomaticUpload"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellFolderImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderEncryptedImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderEncrypted"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderSharedWithMeImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_shared_with_me"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderPublicImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_public"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderGroupImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_group"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderExternalImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_external"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderAutomaticUploadImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderAutomaticUpload"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellFolderImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 600, height: 600, color: NCBrandColor.sharedInstance.brandElement)
         
-        NCCollectionCommonImages.cellCheckedYes = CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedYes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement)
-        NCCollectionCommonImages.cellCheckedNo = CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedNo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellCheckedYes = CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedYes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement)
+        images.cellCheckedNo = CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedNo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
         
-        NCCollectionCommonImages.cellButtonMore = CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
-        NCCollectionCommonImages.cellButtonStop = CCGraphics.changeThemingColorImage(UIImage.init(named: "stop"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellButtonMore = CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
+        images.cellButtonStop = CCGraphics.changeThemingColorImage(UIImage.init(named: "stop"), width: 50, height: 50, color: NCBrandColor.sharedInstance.graySoft)
     }
     
     // MARK: -
@@ -146,21 +146,21 @@ class NCCollectionCommon: NSObject {
             if metadata.directory {
                 
                 if metadata.e2eEncrypted {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderEncryptedImage
+                    cell.imageItem.image = images.cellFolderEncryptedImage
                 } else if isShare {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderSharedWithMeImage
+                    cell.imageItem.image = images.cellFolderSharedWithMeImage
                 } else if (tableShare != nil && tableShare!.shareType != 3) {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderSharedWithMeImage
+                    cell.imageItem.image = images.cellFolderSharedWithMeImage
                 } else if (tableShare != nil && tableShare!.shareType == 3) {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderPublicImage
+                    cell.imageItem.image = images.cellFolderPublicImage
                 } else if metadata.mountType == "group" {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderGroupImage
+                    cell.imageItem.image = images.cellFolderGroupImage
                 } else if isMounted {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderExternalImage
+                    cell.imageItem.image = images.cellFolderExternalImage
                 } else if metadata.fileName == autoUploadFileName && serverUrl == autoUploadDirectory {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderAutomaticUploadImage
+                    cell.imageItem.image = images.cellFolderAutomaticUploadImage
                 } else {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderImage
+                    cell.imageItem.image = images.cellFolderImage
                 }
                 
                 cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date)
@@ -170,7 +170,7 @@ class NCCollectionCommon: NSObject {
                 
                 // Local image: offline
                 if tableDirectory != nil && tableDirectory!.offline {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellOfflineFlag
+                    cell.imageLocal.image = images.cellOfflineFlag
                 }
                 
             } else {
@@ -184,7 +184,7 @@ class NCCollectionCommon: NSObject {
                         if metadata.iconName.count > 0 {
                             cell.imageItem.image = UIImage.init(named: metadata.iconName)
                         } else {
-                            cell.imageItem.image = NCCollectionCommonImages.cellFileImage
+                            cell.imageItem.image = images.cellFileImage
                         }
                     }
                 }
@@ -193,26 +193,26 @@ class NCCollectionCommon: NSObject {
                 
                 // image local
                 if dataSource.metadataLocalImage[metadata.ocId] == "offlineFlag" {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellOfflineFlag
+                    cell.imageLocal.image = images.cellOfflineFlag
                 } else if dataSource.metadataLocalImage[metadata.ocId] == "local" {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellLocal
+                    cell.imageLocal.image = images.cellLocal
                 }
             }
             
             // image Favorite
             if metadata.favorite {
-                cell.imageFavorite.image = NCCollectionCommonImages.cellFavouriteImage
+                cell.imageFavorite.image = images.cellFavouriteImage
             }
             
             // Share image
             if (isShare) {
-                cell.imageShared.image = NCCollectionCommonImages.cellSharedImage
+                cell.imageShared.image = images.cellSharedImage
             } else if (tableShare != nil && tableShare!.shareType == 3) {
-                cell.imageShared.image = NCCollectionCommonImages.cellShareByLinkImage
+                cell.imageShared.image = images.cellShareByLinkImage
             } else if (tableShare != nil && tableShare!.shareType != 3) {
-                cell.imageShared.image = NCCollectionCommonImages.cellSharedImage
+                cell.imageShared.image = images.cellSharedImage
             } else {
-                cell.imageShared.image = NCCollectionCommonImages.cellCanShareImage
+                cell.imageShared.image = images.cellCanShareImage
             }
             if metadata.ownerId.count > 0 && metadata.ownerId != appDelegate.userID {
                 // Load avatar
@@ -236,10 +236,10 @@ class NCCollectionCommon: NSObject {
                 cell.imageSelect.isHidden = false
                 
                 if selectocId.contains(metadata.ocId) {
-                    cell.imageSelect.image = NCCollectionCommonImages.cellCheckedYes
+                    cell.imageSelect.image = images.cellCheckedYes
                     cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
-                    cell.imageSelect.image = NCCollectionCommonImages.cellCheckedNo
+                    cell.imageSelect.image = images.cellCheckedNo
                     cell.backgroundView = nil
                 }
             } else {
@@ -258,11 +258,11 @@ class NCCollectionCommon: NSObject {
             }
             if metadata.status == k_metadataStatusInDownload || metadata.status == k_metadataStatusDownloading ||  metadata.status >= k_metadataStatusTypeUpload {
                 cell.progressView.isHidden = false
-                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommonImages.cellButtonStop)
+                cell.setButtonMore(named: k_buttonMoreStop, image: images.cellButtonStop)
             } else {
                 cell.progressView.isHidden = true
                 cell.progressView.progress = progress
-                cell.setButtonMore(named: k_buttonMoreMore, image: NCCollectionCommonImages.cellButtonMore)
+                cell.setButtonMore(named: k_buttonMoreMore, image: images.cellButtonMore)
             }
             // Write status on Label Info
             switch metadata.status {
@@ -290,7 +290,7 @@ class NCCollectionCommon: NSObject {
             
             // Live Photo
             if metadata.livePhoto {
-                cell.imageStatus.image = NCCollectionCommonImages.cellLivePhotoImage
+                cell.imageStatus.image = images.cellLivePhotoImage
             }
             
             // E2EE
@@ -331,21 +331,21 @@ class NCCollectionCommon: NSObject {
             if metadata.directory {
                 
                 if metadata.e2eEncrypted {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderEncryptedImage
+                    cell.imageItem.image = images.cellFolderEncryptedImage
                 } else if isShare {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderSharedWithMeImage
+                    cell.imageItem.image = images.cellFolderSharedWithMeImage
                 } else if (tableShare != nil && tableShare!.shareType != 3) {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderSharedWithMeImage
+                    cell.imageItem.image = images.cellFolderSharedWithMeImage
                 } else if (tableShare != nil && tableShare!.shareType == 3) {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderPublicImage
+                    cell.imageItem.image = images.cellFolderPublicImage
                 } else if metadata.mountType == "group" {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderGroupImage
+                    cell.imageItem.image = images.cellFolderGroupImage
                 } else if isMounted {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderExternalImage
+                    cell.imageItem.image = images.cellFolderExternalImage
                 } else if metadata.fileName == autoUploadFileName && serverUrl == autoUploadDirectory {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderAutomaticUploadImage
+                    cell.imageItem.image = images.cellFolderAutomaticUploadImage
                 } else {
-                    cell.imageItem.image = NCCollectionCommonImages.cellFolderImage
+                    cell.imageItem.image = images.cellFolderImage
                 }
     
                 let lockServerUrl = CCUtility.stringAppendServerUrl(serverUrl, addFileName: metadata.fileName)!
@@ -353,7 +353,7 @@ class NCCollectionCommon: NSObject {
                                 
                 // Local image: offline
                 if tableDirectory != nil && tableDirectory!.offline {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellOfflineFlag
+                    cell.imageLocal.image = images.cellOfflineFlag
                 }
                 
             } else {
@@ -367,31 +367,31 @@ class NCCollectionCommon: NSObject {
                         if metadata.iconName.count > 0 {
                             cell.imageItem.image = UIImage.init(named: metadata.iconName)
                         } else {
-                            cell.imageItem.image = NCCollectionCommonImages.cellFileImage
+                            cell.imageItem.image = images.cellFileImage
                         }
                     }
                 }
                 
                 // image Local
                 if dataSource.metadataLocalImage[metadata.ocId] == "offlineFlag" {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellOfflineFlag
+                    cell.imageLocal.image = images.cellOfflineFlag
                 } else if dataSource.metadataLocalImage[metadata.ocId] == "local" {
-                    cell.imageLocal.image = NCCollectionCommonImages.cellLocal
+                    cell.imageLocal.image = images.cellLocal
                 }
             }
             
             // image Favorite
             if metadata.favorite {
-                cell.imageFavorite.image = NCCollectionCommonImages.cellFavouriteImage
+                cell.imageFavorite.image = images.cellFavouriteImage
             }
             
             if isEditMode {
                 cell.imageSelect.isHidden = false
                 if selectocId.contains(metadata.ocId) {
-                    cell.imageSelect.image = NCCollectionCommonImages.cellCheckedYes
+                    cell.imageSelect.image = images.cellCheckedYes
                     cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
                 } else {
-                    cell.imageSelect.image = NCCollectionCommonImages.cellCheckedNo
+                    cell.imageSelect.image = images.cellCheckedNo
                     cell.backgroundView = nil
                 }
             } else {
@@ -402,16 +402,16 @@ class NCCollectionCommon: NSObject {
             // Transfer
             if metadata.status == k_metadataStatusInDownload || metadata.status == k_metadataStatusDownloading ||  metadata.status >= k_metadataStatusTypeUpload {
                 cell.progressView.isHidden = false
-                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommonImages.cellButtonStop)
+                cell.setButtonMore(named: k_buttonMoreStop, image: images.cellButtonStop)
             } else {
                 cell.progressView.isHidden = true
                 cell.progressView.progress = 0.0
-                cell.setButtonMore(named: k_buttonMoreMore, image: NCCollectionCommonImages.cellButtonMore)
+                cell.setButtonMore(named: k_buttonMoreMore, image: images.cellButtonMore)
             }
             
             // Live Photo
             if metadata.livePhoto {
-                cell.imageStatus.image = NCCollectionCommonImages.cellLivePhotoImage
+                cell.imageStatus.image = images.cellLivePhotoImage
             }
         }
     }

+ 316 - 6
iOSClient/Main/NCCollectionViewCommon.swift

@@ -484,7 +484,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                             if progress > 0 {
                                 cell.progressView?.isHidden = false
                                 cell.progressView?.progress = progress
-                                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.NCCollectionCommonImages.cellButtonStop)
+                                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.images.cellButtonStop)
                                 if status == k_metadataStatusInDownload {
                                     cell.labelInfo.text = CCUtility.transformedSize(totalBytesExpected) + " - ↓ " + CCUtility.transformedSize(totalBytes)
                                 } else if status == k_metadataStatusInUpload {
@@ -496,7 +496,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                             if progress > 0 {
                                 cell.progressView.isHidden = false
                                 cell.progressView.progress = progress
-                                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.NCCollectionCommonImages.cellButtonStop)
+                                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.images.cellButtonStop)
                             }
                         }
                     }
@@ -1256,17 +1256,327 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         }
         
         if layout == k_layout_grid {
-            
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
-           
         } else {
-            
             cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
         }
         
+        // Share
         let shares = NCManageDatabase.sharedInstance.getTableShares(account: metadata.account, serverUrl: metadata.serverUrl, fileName: metadata.fileName)
+        var tableShare: tableShare?
+        for share in shares {
+            if share.fileName == metadata.fileName {
+                tableShare = share
+                break
+            }
+        }
+        
+        // Download preview
+        NCOperationQueue.shared.downloadThumbnail(metadata: metadata, urlBase: appDelegate.urlBase, view: collectionView, indexPath: indexPath)
+        
+        var isShare = false
+        var isMounted = false
         
-        NCCollectionCommon.shared.cellForItemAt(indexPath: indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: metadata.serverUrl, isEditMode: isEditMode, isEncryptedFolder: isEncryptedFolder, selectocId: selectOcId, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, downloadThumbnail: true, shares: shares, source: self, dataSource: dataSource)
+        if metadataFolder != nil {
+            isShare = metadata.permissions.contains(k_permission_shared) && !metadataFolder!.permissions.contains(k_permission_shared)
+            isMounted = metadata.permissions.contains(k_permission_mounted) && !metadataFolder!.permissions.contains(k_permission_mounted)
+        }
+        
+        if cell is NCListCell {
+            
+            let cell = cell as! NCListCell
+           
+            cell.delegate = self as NCListCellDelegate
+            
+            cell.objectId = metadata.ocId
+            cell.indexPath = indexPath
+            cell.labelTitle.text = metadata.fileNameView
+            cell.labelTitle.textColor = NCBrandColor.sharedInstance.textView
+            cell.separator.backgroundColor = NCBrandColor.sharedInstance.separator
+            
+            cell.imageSelect.image = nil
+            cell.imageStatus.image = nil
+            cell.imageLocal.image = nil
+            cell.imageFavorite.image = nil
+            cell.imageShared.image = nil
+            cell.imageMore.image = nil
+            
+            cell.imageItem.image = nil
+            cell.imageItem.backgroundColor = nil
+            
+            cell.progressView.progress = 0.0
+            
+            if metadata.directory {
+                
+                if metadata.e2eEncrypted {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderEncryptedImage
+                } else if isShare {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderSharedWithMeImage
+                } else if (tableShare != nil && tableShare!.shareType != 3) {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderSharedWithMeImage
+                } else if (tableShare != nil && tableShare!.shareType == 3) {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderPublicImage
+                } else if metadata.mountType == "group" {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderGroupImage
+                } else if isMounted {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderExternalImage
+                } else if metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderAutomaticUploadImage
+                } else {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderImage
+                }
+                
+                cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date)
+                
+                let lockServerUrl = CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)!
+                let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, lockServerUrl))
+                
+                // Local image: offline
+                if tableDirectory != nil && tableDirectory!.offline {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellOfflineFlag
+                }
+                
+            } else {
+                
+                if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
+                    cell.imageItem.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
+                } else {
+                    if metadata.hasPreview {
+                        cell.imageItem.backgroundColor = .lightGray
+                    } else {
+                        if metadata.iconName.count > 0 {
+                            cell.imageItem.image = UIImage.init(named: metadata.iconName)
+                        } else {
+                            cell.imageItem.image = NCCollectionCommon.images.cellFileImage
+                        }
+                    }
+                }
+                
+                cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date) + " · " + CCUtility.transformedSize(metadata.size)
+                
+                // image local
+                if dataSource.metadataLocalImage[metadata.ocId] == "offlineFlag" {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellOfflineFlag
+                } else if dataSource.metadataLocalImage[metadata.ocId] == "local" {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellLocal
+                }
+            }
+            
+            // image Favorite
+            if metadata.favorite {
+                cell.imageFavorite.image = NCCollectionCommon.images.cellFavouriteImage
+            }
+            
+            // Share image
+            if (isShare) {
+                cell.imageShared.image = NCCollectionCommon.images.cellSharedImage
+            } else if (tableShare != nil && tableShare!.shareType == 3) {
+                cell.imageShared.image = NCCollectionCommon.images.cellShareByLinkImage
+            } else if (tableShare != nil && tableShare!.shareType != 3) {
+                cell.imageShared.image = NCCollectionCommon.images.cellSharedImage
+            } else {
+                cell.imageShared.image = NCCollectionCommon.images.cellCanShareImage
+            }
+            if metadata.ownerId.count > 0 && metadata.ownerId != appDelegate.userID {
+                // Load avatar
+                let fileNameSource = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + metadata.ownerId + ".png"
+                let fileNameSourceAvatar = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-avatar-" + metadata.ownerId + ".png"
+                if FileManager.default.fileExists(atPath: fileNameSourceAvatar) {
+                    cell.imageShared.image = UIImage(contentsOfFile: fileNameSourceAvatar)
+                } else if FileManager.default.fileExists(atPath: fileNameSource) {
+                    cell.imageShared.image = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                } else {
+                    NCCommunication.shared.downloadAvatar(userID: metadata.ownerId, fileNameLocalPath: fileNameSource, size: Int(k_avatar_size)) { (account, data, errorCode, errorMessage) in
+                        if errorCode == 0 && account == self.appDelegate.account {
+                            cell.imageShared.image = NCUtility.shared.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                        }
+                    }
+                }
+            }
+            
+            if isEditMode {
+                cell.imageItemLeftConstraint.constant = 45
+                cell.imageSelect.isHidden = false
+                
+                if selectOcId.contains(metadata.ocId) {
+                    cell.imageSelect.image = NCCollectionCommon.images.cellCheckedYes
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
+                } else {
+                    cell.imageSelect.image = NCCollectionCommon.images.cellCheckedNo
+                    cell.backgroundView = nil
+                }
+            } else {
+                cell.imageItemLeftConstraint.constant = 10
+                cell.imageSelect.isHidden = true
+                cell.backgroundView = nil
+            }
+            
+            // Transfer
+            var progress: Float = 0.0
+            var totalBytes: Double = 0.0
+            let progressArray = appDelegate.listProgressMetadata.object(forKey: metadata.ocId) as? NSArray
+            if progressArray != nil && progressArray?.count == 3 {
+                progress = progressArray?.object(at: 0) as? Float ?? 0
+                totalBytes = progressArray?.object(at: 1) as? Double ?? 0
+            }
+            if metadata.status == k_metadataStatusInDownload || metadata.status == k_metadataStatusDownloading ||  metadata.status >= k_metadataStatusTypeUpload {
+                cell.progressView.isHidden = false
+                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.images.cellButtonStop)
+            } else {
+                cell.progressView.isHidden = true
+                cell.progressView.progress = progress
+                cell.setButtonMore(named: k_buttonMoreMore, image: NCCollectionCommon.images.cellButtonMore)
+            }
+            // Write status on Label Info
+            switch metadata.status {
+            case Int(k_metadataStatusWaitDownload):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_wait_download_", comment: "")
+                break
+            case Int(k_metadataStatusInDownload):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_in_download_", comment: "")
+                break
+            case Int(k_metadataStatusDownloading):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - ↓ " + CCUtility.transformedSize(totalBytes)
+                break
+            case Int(k_metadataStatusWaitUpload):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_wait_upload_", comment: "")
+                break
+            case Int(k_metadataStatusInUpload):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_in_upload_", comment: "")
+                break
+            case Int(k_metadataStatusUploading):
+                cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - ↑ " + CCUtility.transformedSize(totalBytes)
+                break
+            default:
+                break
+            }
+            
+            // Live Photo
+            if metadata.livePhoto {
+                cell.imageStatus.image = NCCollectionCommon.images.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
+            } else {
+                cell.separator.isHidden = false
+            }
+            
+        } else if cell is NCGridCell {
+            
+            let cell = cell as! NCGridCell
+
+            cell.delegate = self as NCGridCellDelegate
+            
+            cell.objectId = metadata.ocId
+            cell.indexPath = indexPath
+            cell.labelTitle.text = metadata.fileNameView
+            cell.labelTitle.textColor = NCBrandColor.sharedInstance.textView
+            
+            cell.imageSelect.image = nil
+            cell.imageStatus.image = nil
+            cell.imageLocal.image = nil
+            cell.imageFavorite.image = nil
+            
+            cell.imageItem.image = nil
+            cell.imageItem.backgroundColor = nil
+            
+            cell.progressView.progress = 0.0
+
+            if metadata.directory {
+                
+                if metadata.e2eEncrypted {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderEncryptedImage
+                } else if isShare {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderSharedWithMeImage
+                } else if (tableShare != nil && tableShare!.shareType != 3) {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderSharedWithMeImage
+                } else if (tableShare != nil && tableShare!.shareType == 3) {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderPublicImage
+                } else if metadata.mountType == "group" {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderGroupImage
+                } else if isMounted {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderExternalImage
+                } else if metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderAutomaticUploadImage
+                } else {
+                    cell.imageItem.image = NCCollectionCommon.images.cellFolderImage
+                }
+    
+                let lockServerUrl = CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)!
+                let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, lockServerUrl))
+                                
+                // Local image: offline
+                if tableDirectory != nil && tableDirectory!.offline {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellOfflineFlag
+                }
+                
+            } else {
+                
+                if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
+                    cell.imageItem.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
+                } else {
+                    if metadata.hasPreview {
+                        cell.imageItem.backgroundColor = .lightGray
+                    } else {
+                        if metadata.iconName.count > 0 {
+                            cell.imageItem.image = UIImage.init(named: metadata.iconName)
+                        } else {
+                            cell.imageItem.image = NCCollectionCommon.images.cellFileImage
+                        }
+                    }
+                }
+                
+                // image Local
+                if dataSource.metadataLocalImage[metadata.ocId] == "offlineFlag" {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellOfflineFlag
+                } else if dataSource.metadataLocalImage[metadata.ocId] == "local" {
+                    cell.imageLocal.image = NCCollectionCommon.images.cellLocal
+                }
+            }
+            
+            // image Favorite
+            if metadata.favorite {
+                cell.imageFavorite.image = NCCollectionCommon.images.cellFavouriteImage
+            }
+            
+            if isEditMode {
+                cell.imageSelect.isHidden = false
+                if selectOcId.contains(metadata.ocId) {
+                    cell.imageSelect.image = NCCollectionCommon.images.cellCheckedYes
+                    cell.backgroundView = NCUtility.shared.cellBlurEffect(with: cell.bounds)
+                } else {
+                    cell.imageSelect.image = NCCollectionCommon.images.cellCheckedNo
+                    cell.backgroundView = nil
+                }
+            } else {
+                cell.imageSelect.isHidden = true
+                cell.backgroundView = nil
+            }
+            
+            // Transfer
+            if metadata.status == k_metadataStatusInDownload || metadata.status == k_metadataStatusDownloading ||  metadata.status >= k_metadataStatusTypeUpload {
+                cell.progressView.isHidden = false
+                cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.images.cellButtonStop)
+            } else {
+                cell.progressView.isHidden = true
+                cell.progressView.progress = 0.0
+                cell.setButtonMore(named: k_buttonMoreMore, image: NCCollectionCommon.images.cellButtonMore)
+            }
+            
+            // Live Photo
+            if metadata.livePhoto {
+                cell.imageStatus.image = NCCollectionCommon.images.cellLivePhotoImage
+            }
+        }
         
         return cell
     }