marinofaggiana 4 年之前
父节点
当前提交
caca687796
共有 1 个文件被更改,包括 3 次插入62 次删除
  1. 3 62
      iOSClient/Transfers/NCTransfers.swift

+ 3 - 62
iOSClient/Transfers/NCTransfers.swift

@@ -83,76 +83,17 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
     
     override func uploadStartFile(_ notification: NSNotification) {
         if self.view?.window == nil { return }
-        
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
-            
-                if let row = dataSource.addMetadata(metadata) {
-                    let indexPath = IndexPath(row: row, section: 0)
-                    collectionView?.performBatchUpdates({
-                        collectionView?.insertItems(at: [indexPath])
-                    }, completion: { (_) in
-                        self.reloadDataSource()
-                    })
-                }
-            }
-        }
+        reloadDataSource()
     }
     
     override func uploadedFile(_ notification: NSNotification) {
         if self.view?.window == nil { return }
-        
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let ocId = userInfo["ocId"] as? String, let ocIdTemp = userInfo["ocIdTemp"] as? String, let errorCode = userInfo["errorCode"] as? Int, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
-                
-                if errorCode == 0 {
-                    
-                    if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
-                        let indexPath = IndexPath(row: row, section: 0)
-                        collectionView?.performBatchUpdates({
-                            collectionView?.deleteItems(at: [indexPath])
-                        }, completion: { (_) in
-                            self.collectionView?.reloadData()
-                        })
-                    } else {
-                        reloadDataSource()
-                    }
-                    
-                } else if errorCode != NSURLErrorCancelled {
-                    
-                    if let row = dataSource.reloadMetadata(ocId: metadata.ocId, ocIdTemp: ocIdTemp) {
-                        let indexPath = IndexPath(row: row, section: 0)
-                        collectionView?.performBatchUpdates({
-                            collectionView?.reloadItems(at: [indexPath])
-                        }, completion: { (_) in
-                            self.collectionView?.reloadData()
-                        })
-                    } else {
-                        reloadDataSource()
-                    }
-                }
-            }
-        }
+        reloadDataSource()
     }
     
     override func uploadCancelFile(_ notification: NSNotification) {
         if self.view?.window == nil { return }
-        
-        if let userInfo = notification.userInfo as NSDictionary? {
-            if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.sharedInstance.getMetadataFromOcId(ocId) {
-            
-                if let row = dataSource.deleteMetadata(ocId: metadata.ocId) {
-                    let indexPath = IndexPath(row: row, section: 0)
-                    collectionView?.performBatchUpdates({
-                        collectionView?.deleteItems(at: [indexPath])
-                    }, completion: { (_) in
-                        self.collectionView?.reloadData()
-                    })
-                } else {
-                    self.reloadDataSource()
-                }
-            }
-        }
+        reloadDataSource()
     }
     
     // MARK: TAP EVENT