瀏覽代碼

Remove netQueueDownload and netQueueDownloadWWan

Marino Faggiana 7 年之前
父節點
當前提交
ebbee14d1a

+ 0 - 4
iOSClient/AppDelegate.h

@@ -68,8 +68,6 @@
 // Network Operation
 @property (nonatomic, strong) NSOperationQueue *netQueue;
 
-@property (nonatomic, strong) NSOperationQueue *netQueueDownload;
-@property (nonatomic, strong) NSOperationQueue *netQueueDownloadWWan;
 @property (nonatomic, strong) NSOperationQueue *netQueueUpload;
 @property (nonatomic, strong) NSOperationQueue *netQueueUploadWWan;
 
@@ -158,8 +156,6 @@
 - (void)cancelAllOperations;
 - (void)addNetworkingOperationQueue:(NSOperationQueue *)netQueue delegate:(id)delegate metadataNet:(CCMetadataNet *)metadataNet;
 
-- (NSMutableArray *)verifyExistsInQueuesDownloadSelector:(NSString *)selector;
-
 - (NSInteger)getNumberDownloadInQueues;
 - (NSInteger)getNumberDownloadInQueuesWWan;
 - (NSInteger)getNumberUploadInQueues;

+ 0 - 33
iOSClient/AppDelegate.m

@@ -164,14 +164,6 @@
     _netQueue.name = k_queue;
     _netQueue.maxConcurrentOperationCount = k_maxConcurrentOperation;
    
-    _netQueueDownload = [[NSOperationQueue alloc] init];
-    _netQueueDownload.name = k_download_queue;
-    _netQueueDownload.maxConcurrentOperationCount = k_maxConcurrentOperationDownloadUpload;
-
-    _netQueueDownloadWWan = [[NSOperationQueue alloc] init];
-    _netQueueDownloadWWan.name = k_download_queuewwan;
-    _netQueueDownloadWWan.maxConcurrentOperationCount = k_maxConcurrentOperationDownloadUpload;
-    
     _netQueueUpload = [[NSOperationQueue alloc] init];
     _netQueueUpload.name = k_upload_queue;
     _netQueueUpload.maxConcurrentOperationCount = k_maxConcurrentOperationDownloadUpload;
@@ -1312,8 +1304,6 @@
 {
     [_netQueue cancelAllOperations];
     
-    [_netQueueDownload cancelAllOperations];
-    [_netQueueDownloadWWan cancelAllOperations];
     [_netQueueUpload cancelAllOperations];
     [_netQueueUploadWWan cancelAllOperations];
 }
@@ -1329,31 +1319,12 @@
     [netQueue addOperation:operation];
 }
 
-- (NSMutableArray *)verifyExistsInQueuesDownloadSelector:(NSString *)selector
-{
-    NSMutableArray *metadatasNet = [[NSMutableArray alloc] init];
-    
-    for (OCnetworking *operation in [self.netQueueDownload operations])
-        if ([operation.metadataNet.selector isEqualToString:selector])
-            [metadatasNet addObject:[operation.metadataNet copy]];
-        
-    for (OCnetworking *operation in [self.netQueueDownloadWWan operations])
-        if ([operation.metadataNet.selector isEqualToString:selector])
-            [metadatasNet addObject:[operation.metadataNet copy]];
-    
-    return metadatasNet;
-}
-
 - (NSInteger)getNumberDownloadInQueues
 {
     NSArray *results = [[NCManageDatabase sharedInstance] getTableMetadataDownload];
     
     NSInteger queueNunDownload = [results count];
     
-    // netQueueDownload
-    for (NSOperation *operation in [self.netQueueDownload operations])
-        if (((OCnetworking *)operation).isExecuting == NO) queueNunDownload++;
-    
     return queueNunDownload;
 }
 
@@ -1363,10 +1334,6 @@
     
     NSInteger queueNumDownloadWWan = [results count];
     
-    // netQueueDownloadWWan
-    for (NSOperation *operation in [self.netQueueDownloadWWan operations])
-        if (((OCnetworking *)operation).isExecuting == NO) queueNumDownloadWWan++;
-    
     return queueNumDownloadWWan;
 }
 

+ 4 - 7
iOSClient/Favorites/CCFavorites.m

@@ -190,11 +190,7 @@
     // test
     if (app.activeAccount.length == 0)
         return;
-    
-    // verify if is already in progress selectorDownloadSynchronize
-    if ([[app verifyExistsInQueuesDownloadSelector:selectorDownloadSynchronize] count] > 0)
-        return;
-    
+
     [[CCActions sharedInstance] listingFavorites:@"" delegate:self];
 }
 
@@ -301,8 +297,9 @@
 #pragma --------------------------------------------------------------------------------------------
 
 - (void)downloadFileFailure:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector message:(NSString *)message errorCode:(NSInteger)errorCode
-{    
-    [app messageNotification:@"_download_file_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+{
+    if (errorCode != k_CCErrorFileAlreadyInDownload)
+        [app messageNotification:@"_download_file_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
 }
 
 - (void)downloadFileSuccess:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -3365,7 +3365,7 @@
     if ([NCBrandOptions sharedInstance].disable_multiaccount)
         return;
     
-    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countQueueUploadWithSession:nil] > 0) {
+    if ([app.netQueue operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countQueueUploadWithSession:nil] > 0) {
         
         [app messageNotification:@"_transfers_in_queue_" description:nil visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
         return;

+ 1 - 1
iOSClient/Settings/CCManageAccount.m

@@ -351,7 +351,7 @@
 
 - (void)ChangeDefaultAccount:(NSString *)account
 {
-    if ([app.netQueue operationCount] > 0 || [app.netQueueDownload operationCount] > 0 || [app.netQueueDownloadWWan operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countQueueUploadWithSession:nil] > 0) {
+    if ([app.netQueue operationCount] > 0 || [app.netQueueUpload operationCount] > 0 || [app.netQueueUploadWWan operationCount] > 0 || [[NCManageDatabase sharedInstance] countQueueUploadWithSession:nil] > 0) {
         
         [app messageNotification:@"_transfers_in_queue_" description:nil visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
         [self UpdateForm];

+ 2 - 15
iOSClient/Synchronize/CCSynchronize.m

@@ -371,21 +371,8 @@
         
         fileID = metadata.fileID;
         (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
-        
-        CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
-            
-        metadataNet.action = actionDownloadFile;
-        metadataNet.downloadData = downloadData;
-        metadataNet.downloadPlist = downloadPlist;
-        metadataNet.fileID = fileID;
-        metadataNet.priority = NSOperationQueuePriorityLow;
-        metadataNet.selector = selector;
-        metadataNet.selectorPost = selectorPost;
-        metadataNet.serverUrl = serverUrl;
-        metadataNet.session = k_download_session;
-        metadataNet.taskStatus = k_taskStatusResume;
-
-        [app addNetworkingOperationQueue:app.netQueueDownload delegate:app.activeMain metadataNet:metadataNet];
+       
+        [[CCNetworking sharedNetworking] downloadFile:fileID serverUrl:serverUrl downloadData:downloadData downloadPlist:downloadPlist selector:selector selectorPost:selectorPost session:k_download_session taskStatus:k_taskStatusResume delegate:app.activeMain];
     }
     
     dispatch_async(dispatch_get_main_queue(), ^{