Browse Source

fix counter transfer

Marino Faggiana 8 năm trước cách đây
mục cha
commit
1d261d17a8
1 tập tin đã thay đổi với 12 bổ sung9 xóa
  1. 12 9
      iOSClient/Transfers/CCTransfers.m

+ 12 - 9
iOSClient/Transfers/CCTransfers.m

@@ -341,10 +341,10 @@
     NSString *titleSection, *numberTitle;
     NSInteger typeOfSession = 0;
     
-    NSInteger queueDownload = [app getNumberDownloadInQueues];
-    NSInteger queueDownloadWWan = [app getNumberDownloadInQueuesWWan];
-    NSInteger queueUpload = [app getNumberUploadInQueues];
-    NSInteger queueUploadWWan = [app getNumberUploadInQueuesWWan];
+    NSInteger queueDownload = [app getNumberDownloadInQueues] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_download_session];
+    NSInteger queueDownloadWWan = [app getNumberDownloadInQueuesWWan] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_download_session_wwan];
+    NSInteger queueUpload = [app getNumberUploadInQueues] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_upload_session];
+    NSInteger queueUploadWWan = [app getNumberUploadInQueuesWWan] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_upload_session_wwan];
     
     if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
     if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSDate class]]) titleSection = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:section]];
@@ -413,11 +413,6 @@
     NSString *titleSection;
     NSString *element_s;
     
-    NSInteger queueDownload = [app getNumberDownloadInQueues];
-    NSInteger queueDownloadWWan = [app getNumberDownloadInQueuesWWan];
-    NSInteger queueUpload = [app getNumberUploadInQueues];
-    NSInteger queueUploadWWan = [app getNumberUploadInQueuesWWan];
-    
     if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
     
     // Prepare view for title in footer
@@ -431,6 +426,8 @@
     // Footer Download
     if ([titleSection containsString:@"download"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
         
+        NSInteger queueDownload = [app getNumberDownloadInQueues] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_download_session];
+        
         // element or elements ?
         if (queueDownload > 1) element_s = NSLocalizedString(@"_elements_",nil);
         else element_s = NSLocalizedString(@"_element_",nil);
@@ -446,6 +443,8 @@
     // Footer Download WWAN
     if ([titleSection containsString:@"download"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
         
+        NSInteger queueDownloadWWan = [app getNumberDownloadInQueuesWWan] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_download_session_wwan];
+        
         // element or elements ?
         if (queueDownloadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
         else element_s = NSLocalizedString(@"_element_",nil);
@@ -465,6 +464,8 @@
     // Footer Upload
     if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
         
+        NSInteger queueUpload = [app getNumberUploadInQueues] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_upload_session];
+        
         // element or elements ?
         if (queueUpload > 1) element_s = NSLocalizedString(@"_elements_",nil);
         else element_s = NSLocalizedString(@"_element_",nil);
@@ -480,6 +481,8 @@
     // Footer Upload WWAN
     if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
         
+        NSInteger queueUploadWWan = [app getNumberUploadInQueuesWWan] + [[NCManageDatabase sharedInstance] countAutomaticUploadForAccount:app.activeAccount session:k_upload_session_wwan];
+        
         // element or elements ?
         if (queueUploadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
         else element_s = NSLocalizedString(@"_element_",nil);