Marino Faggiana 6 years ago
parent
commit
d6d5cedcec
1 changed files with 16 additions and 6 deletions
  1. 16 6
      iOSClient/Activity/NCActivity.swift

+ 16 - 6
iOSClient/Activity/NCActivity.swift

@@ -263,18 +263,28 @@ class activityTableViewCell: UITableViewCell, UICollectionViewDelegate, UICollec
             let activityPreview = tableActivityPreviews[indexPath.row]
             if activityPreview.view == "trashbin" {
                 
-                if let activitySubjectRich = NCManageDatabase.sharedInstance.getActivitySubjectRich(account: account, idActivity: idActivity, id: String(activityPreview.fileId)) {
+                let fileID = String(activityPreview.fileId)
+                
+                if let activitySubjectRich = NCManageDatabase.sharedInstance.getActivitySubjectRich(account: account, idActivity: idActivity, id: fileID) {
 
+                    let fileName = activitySubjectRich.name
+                    
                     if activityPreview.mimeType == "dir" {
                         
+                        cell.imageView.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)
+                        
                     } else {
                         
-                        if CCUtility.fileProviderStorageIconExists(String(activityPreview.fileId), fileNameView: activitySubjectRich.name) {
-                            // carica
+                        if CCUtility.fileProviderStorageIconExists(fileID, fileNameView: activitySubjectRich.name) {
+                            if let image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(fileID, fileNameView: fileName)) {
+                                cell.imageView.image = image
+                            }
                         } else {
-                            OCNetworking.sharedManager().downloadPreviewTrash(withAccount: appDelegate.activeAccount, fileID: String(activityPreview.fileId), fileName: activitySubjectRich.name, completion: { (account, message, errorCode) in
-                                if errorCode == 0 && account == self.appDelegate.activeAccount && CCUtility.fileProviderStorageIconExists(String(activityPreview.fileId), fileNameView: activitySubjectRich.name) {
-                                    // carica
+                            OCNetworking.sharedManager().downloadPreviewTrash(withAccount: appDelegate.activeAccount, fileID: fileID, fileName: fileName, completion: { (account, message, errorCode) in
+                                if errorCode == 0 && account == self.appDelegate.activeAccount && CCUtility.fileProviderStorageIconExists(fileID, fileNameView: fileName) {
+                                    if let image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(fileID, fileNameView: fileName)) {
+                                        cell.imageView.image = image
+                                    }
                                 } else {
                                     // default icon
                                 }