Explorar o código

improved code

Marino Faggiana %!s(int64=6) %!d(string=hai) anos
pai
achega
47078a1245

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

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

+ 5 - 1
iOSClient/Main/NCMainCommon.swift

@@ -35,7 +35,11 @@ class NCMainCommon: NSObject {
     
     //MARK: -
     
-    @objc func triggerProgressTask(_ notification: Notification, sectionDataSourceFileIDIndexPath: NSDictionary, tableView: UITableView) {
+    @objc func triggerProgressTask(_ notification: Notification, sectionDataSourceFileIDIndexPath: NSDictionary, tableView: UITableView, viewController: UIViewController) {
+        
+        if viewController.viewIfLoaded?.window == nil {
+            return
+        }
         
         guard let dic = notification.userInfo else {
             return

+ 1 - 1
iOSClient/Transfers/CCTransfers.m

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