marinofaggiana il y a 4 ans
Parent
commit
5fde1457b8
1 fichiers modifiés avec 17 ajouts et 1 suppressions
  1. 17 1
      iOSClient/AppDelegate.m

+ 17 - 1
iOSClient/AppDelegate.m

@@ -1138,7 +1138,7 @@
         sizeUpload = sizeUpload + metadata.size;
     }
     
-    NSLog(@"%@", [NSString stringWithFormat:@"[LOG] PROCESS-AUTO-UPLOAD Upload %ld - %@", counterUpload, [CCUtility transformedSize:sizeUpload]]);
+    NSLog(@"%@", [NSString stringWithFormat:@"[LOG] PROCESS-AUTO-UPLOAD %ld - %@", counterUpload, [CCUtility transformedSize:sizeUpload]]);
     
     // Stop Timer
     [_timerProcessAutoUpload invalidate];
@@ -1313,6 +1313,22 @@
         }
     }
     
+    // No upload available ? --> Retry Upload in Error
+    //
+    if (counterUpload == 0) {
+        
+        NSArray *metadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"status == %d", k_metadataStatusUploadError] sorted:nil ascending:NO];
+        for (tableMetadata *metadata in metadatas) {
+            
+            metadata.session = NCCommunicationCommon.shared.sessionIdentifierBackground;
+            metadata.sessionError = @"";
+            metadata.sessionTaskIdentifier = 0;
+            metadata.status = k_metadataStatusInUpload;
+            
+            [[NCManageDatabase sharedInstance] addMetadata:metadata];
+        }
+    }
+    
     // Start Timer
     _timerProcessAutoUpload = [NSTimer scheduledTimerWithTimeInterval:k_timerProcessAutoUpload target:self selector:@selector(loadAutoUpload) userInfo:nil repeats:YES];
 }