Просмотр исходного кода

Auto upload on E2EE folder only in foreground

Marino Faggiana 7 лет назад
Родитель
Сommit
45cb120d5c
1 измененных файлов с 12 добавлено и 9 удалено
  1. 12 9
      iOSClient/AppDelegate.m

+ 12 - 9
iOSClient/AppDelegate.m

@@ -1407,15 +1407,9 @@
     // BACKGROND & FOREGROUND
     if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
         
-        // E2EE
-        NSString *serverUrlAutoUpload = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:self.activeUrl];
-        tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@ AND e2eEncrypted = 1", self.activeAccount, serverUrlAutoUpload]];
-        
-        // ONLY BACKGROUND NOT E2E
-        if (directory == nil) {
-            NSLog(@"[LOG] -PROCESS-AUTO-UPLOAD-");
-            [self performSelectorOnMainThread:@selector(loadAutoDownloadUpload:) withObject:[NSNumber numberWithInt:k_maxConcurrentOperationDownloadUploadBackground] waitUntilDone:NO];
-        }
+        // ONLY BACKGROUND
+        NSLog(@"[LOG] -PROCESS-AUTO-UPLOAD-");
+        [self performSelectorOnMainThread:@selector(loadAutoDownloadUpload:) withObject:[NSNumber numberWithInt:k_maxConcurrentOperationDownloadUploadBackground] waitUntilDone:NO];
         
     } else {
         
@@ -1429,6 +1423,15 @@
 {
     CCMetadataNet *metadataNet;
     
+    // E2EE : not in background
+    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
+        NSString *serverUrlAutoUpload = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:self.activeUrl];
+        tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@ AND e2eEncrypted = 1", self.activeAccount, serverUrlAutoUpload]];
+        if (directory != nil)
+            return;
+    }
+    
+    
     // Stop Timer
     [_timerProcessAutoDownloadUpload invalidate];