marinofaggiana há 4 anos atrás
pai
commit
b62b6b968a

+ 5 - 2
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -101,8 +101,11 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
                                     self.collectionView.scrollToItem(at: IndexPath(row: row, section: 0), at: .centeredVertically, animated: false)
                                 } completion: { (_) in
                                     if let cell = self.collectionView.cellForItem(at: IndexPath(row: row, section: 0)) {
-                                        NCUtility.shared.blink(cell: cell)
-                                        self.fileName = nil
+                                        cell.backgroundColor = NCBrandColor.sharedInstance.brandElement.withAlphaComponent(0.5)
+                                        UIView.animate(withDuration: 2) {
+                                            cell.backgroundColor = .clear
+                                            self.fileName = nil
+                                        }
                                     }
                                 }
                             }

+ 16 - 13
iOSClient/Trash/NCTrash.swift

@@ -567,25 +567,28 @@ extension NCTrash {
         }
         
         datasource = tashItems
+        collectionView.reloadData()
         
-        CATransaction.begin()
-        CATransaction.setCompletionBlock {
-            // GoTo ocId
-            if self.blinkFileId != nil {
-                for item in 0...self.datasource.count-1 {
-                    if self.datasource[item].fileId.contains(self.blinkFileId!) {
-                        let indexPath = IndexPath(item: item, section: 0)
-                        self.collectionView.scrollToItem(at: indexPath, at: .top, animated: false)
-                        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
-                            self.blinkFileId = nil
-                            NCUtility.shared.blink(cell: self.collectionView.cellForItem(at: indexPath))
+        if self.blinkFileId != nil {
+            for item in 0...self.datasource.count-1 {
+                if self.datasource[item].fileId.contains(self.blinkFileId!) {
+                    let indexPath = IndexPath(item: item, section: 0)
+                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                        UIView.animate(withDuration: 0.3) {
+                            self.collectionView.scrollToItem(at:indexPath, at: .centeredVertically, animated: false)
+                        } completion: { (_) in
+                            if let cell = self.collectionView.cellForItem(at: indexPath) {
+                                cell.backgroundColor = NCBrandColor.sharedInstance.brandElement.withAlphaComponent(0.5)
+                                UIView.animate(withDuration: 2) {
+                                    cell.backgroundColor = .clear
+                                    self.blinkFileId = nil
+                                }
+                            }
                         }
                     }
                 }
             }
         }
-        collectionView.reloadData()
-        CATransaction.commit()
     }
     
     @objc func loadListingTrash() {

+ 0 - 16
iOSClient/Utility/NCUtility.swift

@@ -351,22 +351,6 @@ class NCUtility: NSObject {
         return String(format: "%02d:%02d:%02d", hour, min, sec)
     }
     
-    @objc func blink(cell: AnyObject?) {
-        DispatchQueue.main.async {
-            if let cell = cell as? UITableViewCell {
-                cell.backgroundColor = NCBrandColor.sharedInstance.brandElement.withAlphaComponent(0.3)
-                UIView.animate(withDuration: 2) {
-                    cell.backgroundColor = .clear
-                }
-            } else if let cell = cell as? UICollectionViewCell {
-                cell.backgroundColor = NCBrandColor.sharedInstance.brandElement.withAlphaComponent(0.3)
-                UIView.animate(withDuration: 2) {
-                    cell.backgroundColor = .clear
-                }
-            }
-        }
-    }
-        
     @objc func isRichDocument(_ metadata: tableMetadata) -> Bool {
         
         guard let mimeType = CCUtility.getMimeType(metadata.fileNameView) else {