marinofaggiana 4 년 전
부모
커밋
d44285e2ce
2개의 변경된 파일8개의 추가작업 그리고 18개의 파일을 삭제
  1. 1 4
      iOSClient/Networking/NCNetworking.swift
  2. 7 14
      iOSClient/Transfers/CCTransfers.m

+ 1 - 4
iOSClient/Networking/NCNetworking.swift

@@ -272,8 +272,6 @@ import Queuer
                 }
                 #endif
                                 
-                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
-
             } else {
                                 
                 NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: errorDescription, sessionSelector: selector, sessionTaskIdentifier: 0, status: Int(k_metadataStatusDownloadError))
@@ -285,12 +283,11 @@ import Queuer
                     CCUtility.setCertificateError(metadata.account, error: true)
                 }
                 #endif
-                
-                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
             }
             
             self.downloadRequest[fileNameLocalPath] = nil
             
+            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["ocId":metadata.ocId, "serverUrl":metadata.serverUrl])
             
             completion(errorCode)

+ 7 - 14
iOSClient/Transfers/CCTransfers.m

@@ -79,7 +79,8 @@
     [self.tableView addGestureRecognizer:longPressRecognizer];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:k_notificationCenter_progressTask object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatasource) name:k_notificationCenter_reloadDataSource object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatasource) name:k_notificationCenter_uploadedFile object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatasource) name:k_notificationCenter_downloadedFile object:nil];
 
     [self changeTheming];
 }
@@ -267,21 +268,13 @@
         return;
     }
     
-    /*
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+    NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"(session CONTAINS 'upload') OR (session CONTAINS 'download')"] page:1 limit:100 sorted:@"sessionTaskIdentifier" ascending:NO];
+    CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
         
-        NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"(session CONTAINS 'upload') OR (session CONTAINS 'download')"] page:1 limit:100 sorted:@"sessionTaskIdentifier" ascending:NO];
+    sectionDataSourceTemp  = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:appDelegate.listProgressMetadata groupBy:@"session" filterTypeFileImage:NO filterTypeFileVideo:NO filterLivePhoto:NO sort:@"fileName" ascending:YES directoryOnTop:NO account:appDelegate.account];
         
-        CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
-        
-        sectionDataSourceTemp  = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:appDelegate.listProgressMetadata groupBy:@"session" filterTypeFileImage:NO filterTypeFileVideo:NO filterLivePhoto:NO sort:@"fileName" ascending:YES directoryOnTop:NO account:appDelegate.account];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            sectionDataSource = sectionDataSourceTemp;
-            [self.tableView reloadData];
-        });
-    });
-    */
+    sectionDataSource = sectionDataSourceTemp;
+    [self.tableView reloadData];
 }
 
 #pragma --------------------------------------------------------------------------------------------