Browse Source

improved code

Marino Faggiana 6 years ago
parent
commit
3761f19539

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -305,7 +305,7 @@
 
 - (void)triggerProgressTask:(NSNotification *)notification
 {
-    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self];
+    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];
 }
 
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -1980,7 +1980,7 @@
 
 - (void)triggerProgressTask:(NSNotification *)notification
 {
-    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self];    
+    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];    
 }
 
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event

+ 6 - 2
iOSClient/Main/NCMainCommon.swift

@@ -35,7 +35,7 @@ class NCMainCommon: NSObject {
     
     //MARK: -
     
-    @objc func triggerProgressTask(_ notification: Notification, sectionDataSourceFileIDIndexPath: NSDictionary, tableView: UITableView, viewController: UIViewController) {
+    @objc func triggerProgressTask(_ notification: Notification, sectionDataSourceFileIDIndexPath: NSDictionary, tableView: UITableView, viewController: UIViewController, serverUrlViewController: String?) {
         
         if viewController.viewIfLoaded?.window == nil {
             return
@@ -46,12 +46,16 @@ class NCMainCommon: NSObject {
         }
         
         let fileID = dic["fileID"] as! NSString
-        _ = dic["serverUrl"] as! NSString
+        let serverUrl = dic["serverUrl"] as! String
         let status = dic["status"] as! Int
         let progress = dic["progress"] as! CGFloat
         let totalBytes = dic["totalBytes"] as! Double
         let totalBytesExpected = dic["totalBytesExpected"] as! Double
         
+        if serverUrlViewController != nil && serverUrlViewController! != serverUrl {
+            return
+        }
+        
         appDelegate.listProgressMetadata.setObject([progress as NSNumber, totalBytes as NSNumber, totalBytesExpected as NSNumber], forKey: fileID)
         
         guard let indexPath = sectionDataSourceFileIDIndexPath.object(forKey: fileID) else {

+ 1 - 1
iOSClient/Shares/NCShares.m

@@ -315,7 +315,7 @@
                 if ([CCUtility fileProviderStorageIconExists:metadata.fileID fileNameView:metadata.fileNameView]) {
                     cell.fileImageView.image = [UIImage imageNamed:metadata.iconName];
                 } else {
-                    [[NCNetworkingMain sharedInstance] downloadThumbnailWith:tableView serverUrl:table.serverUrl view:tableView indexPath:indexPath forceDownload:false];
+                    [[NCNetworkingMain sharedInstance] downloadThumbnailWith:metadata serverUrl:table.serverUrl view:tableView indexPath:indexPath forceDownload:false];
                 }
             }
         }

+ 1 - 1
iOSClient/Transfers/CCTransfers.m

@@ -150,7 +150,7 @@
 
 - (void)triggerProgressTask:(NSNotification *)notification
 {
-    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self];
+    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:nil];
 }
 
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event