Przeglądaj źródła

Advance Background processing TEST

marinofaggiana 4 lat temu
rodzic
commit
288626d277

+ 3 - 1
iOSClient/AppDelegate.m

@@ -587,7 +587,9 @@
         if (items == 0) {
             completionHandler(UIBackgroundFetchResultNoData);
         } else {
-            completionHandler(UIBackgroundFetchResultNewData);
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+                completionHandler(UIBackgroundFetchResultNewData);
+            });
         }
     }];
 }

+ 8 - 1
iOSClient/Networking/NCAutoUpload.swift

@@ -68,7 +68,11 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
             if account.autoUpload && account.autoUploadBackground && UIApplication.shared.applicationState == UIApplication.State.background {
                 NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: nil) { (hasPermission) in
                     if hasPermission {
-                        self.uploadAssetsNewAndFull(viewController: nil, selector: NCBrandGlobal.shared.selectorUploadAutoUpload) { (items) in }
+                        self.uploadAssetsNewAndFull(viewController: nil, selector: NCBrandGlobal.shared.selectorUploadAutoUpload) { (items) in
+                            if items > 0 {
+                                appDelegate.networkingAutoUpload.startProcess()
+                            }
+                        }
                     }
                 }
             }
@@ -99,6 +103,9 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
                 NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: viewController) { (hasPermission) in
                     if hasPermission {
                         self.uploadAssetsNewAndFull(viewController:viewController, selector: NCBrandGlobal.shared.selectorUploadAutoUpload) { (items) in
+                            if items > 0 {
+                                appDelegate.networkingAutoUpload.startProcess()
+                            }
                             completion(items)
                         }
                         if account.autoUploadBackground {