marinofaggiana 4 years ago
parent
commit
031a2e181e
1 changed files with 6 additions and 10 deletions
  1. 6 10
      iOSClient/Networking/NCAutoUpload.swift

+ 6 - 10
iOSClient/Networking/NCAutoUpload.swift

@@ -63,7 +63,11 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
         
         if let account = NCManageDatabase.shared.getAccountActive() {
             if account.autoUpload && account.autoUploadBackground && UIApplication.shared.applicationState == UIApplication.State.background {
-                self.uploadNewAssets()
+                NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: nil) { (hasPermission) in
+                    if hasPermission {
+                        self.uploadAssetsNewAndFull(selector: NCBrandGlobal.shared.selectorUploadAutoUpload)
+                    }
+                }
             }
         }
     }
@@ -86,7 +90,7 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
             if account.autoUpload {
                 NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: viewController) { (hasPermission) in
                     if hasPermission {
-                        self.uploadNewAssets()
+                        self.uploadAssetsNewAndFull(selector: NCBrandGlobal.shared.selectorUploadAutoUpload)
                         if account.autoUploadBackground {
                             NCAskAuthorization.shared.askAuthorizationLocationManager(viewController: viewController) { (hasPermissions) in
                                 if hasPermissions {
@@ -116,14 +120,6 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
         }
     }
     
-    func uploadNewAssets() {
-        NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: appDelegate.window.rootViewController) { (hasPermission) in
-            if hasPermission {
-                self.uploadAssetsNewAndFull(selector: NCBrandGlobal.shared.selectorUploadAutoUpload)
-            }
-        }
-    }
-    
     private func uploadAssetsNewAndFull(selector: String) {
         
     }